diff --git a/Cargo.lock b/Cargo.lock index e76df6152..2663531ce 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1154,7 +1154,7 @@ dependencies = [ [[package]] name = "modularize_imports" -version = "0.67.0" +version = "0.68.0" dependencies = [ "convert_case", "handlebars", @@ -1692,7 +1692,7 @@ dependencies = [ [[package]] name = "react_remove_properties" -version = "0.23.0" +version = "0.24.0" dependencies = [ "serde", "swc_atoms", @@ -1767,7 +1767,7 @@ checksum = "c707298afce11da2efef2f600116fa93ffa7a032b5d7b628aa17711ec81383ca" [[package]] name = "remove_console" -version = "0.24.0" +version = "0.25.0" dependencies = [ "serde", "swc_atoms", @@ -2153,7 +2153,7 @@ checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" [[package]] name = "styled_components" -version = "0.95.0" +version = "0.96.0" dependencies = [ "Inflector", "once_cell", @@ -2174,7 +2174,7 @@ dependencies = [ [[package]] name = "styled_jsx" -version = "0.72.0" +version = "0.73.0" dependencies = [ "anyhow", "lightningcss", @@ -2314,7 +2314,7 @@ dependencies = [ [[package]] name = "swc_constify" -version = "0.35.0" +version = "0.36.0" dependencies = [ "once_cell", "rustc-hash", @@ -2775,7 +2775,7 @@ dependencies = [ [[package]] name = "swc_emotion" -version = "0.71.0" +version = "0.72.0" dependencies = [ "base64 0.13.1", "byteorder", @@ -2849,7 +2849,7 @@ dependencies = [ [[package]] name = "swc_magic" -version = "0.18.0" +version = "0.19.0" dependencies = [ "serde", "swc_atoms", @@ -2874,7 +2874,7 @@ dependencies = [ [[package]] name = "swc_plugin_constify" -version = "0.6.0" +version = "0.7.0" dependencies = [ "swc_common", "swc_constify", @@ -2887,7 +2887,7 @@ dependencies = [ [[package]] name = "swc_plugin_emotion" -version = "0.17.0" +version = "0.18.0" dependencies = [ "serde", "serde_json", @@ -2904,7 +2904,7 @@ dependencies = [ [[package]] name = "swc_plugin_jest" -version = "0.30.0" +version = "0.31.0" dependencies = [ "phf 0.10.1", "serde", @@ -2919,7 +2919,7 @@ dependencies = [ [[package]] name = "swc_plugin_loadable_components" -version = "0.17.0" +version = "0.18.0" dependencies = [ "once_cell", "regex", @@ -2948,7 +2948,7 @@ dependencies = [ [[package]] name = "swc_plugin_noop" -version = "0.17.0" +version = "0.18.0" dependencies = [ "swc_common", "swc_core", @@ -2975,7 +2975,7 @@ dependencies = [ [[package]] name = "swc_plugin_react_remove_properties" -version = "0.18.0" +version = "0.19.0" dependencies = [ "react_remove_properties", "serde_json", @@ -2991,7 +2991,7 @@ dependencies = [ [[package]] name = "swc_plugin_relay" -version = "0.6.0" +version = "0.7.0" dependencies = [ "once_cell", "regex", @@ -3009,7 +3009,7 @@ dependencies = [ [[package]] name = "swc_plugin_remove_console" -version = "0.18.0" +version = "0.19.0" dependencies = [ "remove_console", "serde_json", @@ -3024,7 +3024,7 @@ dependencies = [ [[package]] name = "swc_plugin_styled_components" -version = "0.39.0" +version = "0.40.0" dependencies = [ "serde", "serde_json", @@ -3041,7 +3041,7 @@ dependencies = [ [[package]] name = "swc_plugin_styled_jsx" -version = "0.19.0" +version = "0.20.0" dependencies = [ "anyhow", "serde_json", @@ -3062,7 +3062,7 @@ dependencies = [ [[package]] name = "swc_plugin_swc_magic" -version = "0.6.0" +version = "0.7.0" dependencies = [ "serde_json", "swc_core", @@ -3071,7 +3071,7 @@ dependencies = [ [[package]] name = "swc_plugin_transform_imports" -version = "0.18.0" +version = "0.19.0" dependencies = [ "modularize_imports", "serde_json", @@ -3086,7 +3086,7 @@ dependencies = [ [[package]] name = "swc_relay" -version = "0.43.0" +version = "0.44.0" dependencies = [ "once_cell", "regex", @@ -3646,7 +3646,7 @@ dependencies = [ [[package]] name = "xtask" -version = "0.7.0" +version = "0.8.0" dependencies = [ "anyhow", "cargo_metadata 0.18.0", diff --git a/packages/constify/CHANGELOG.md b/packages/constify/CHANGELOG.md index 20c9d8c65..fabb5cefb 100644 --- a/packages/constify/CHANGELOG.md +++ b/packages/constify/CHANGELOG.md @@ -1,5 +1,11 @@ # @swc/plugin-constify +## 0.1.44 + +### Patch Changes + +- 4ef0b7f: Add changelog to the readme + ## 0.1.43 ### Patch Changes diff --git a/packages/constify/Cargo.toml b/packages/constify/Cargo.toml index a90ce5b21..26011312a 100644 --- a/packages/constify/Cargo.toml +++ b/packages/constify/Cargo.toml @@ -5,7 +5,7 @@ edition = "2021" license = "Apache-2.0" name = "swc_plugin_constify" publish = false -version = "0.6.0" +version = "0.7.0" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/packages/constify/README.md b/packages/constify/README.md index 6bea4cb57..d6ac2b358 100644 --- a/packages/constify/README.md +++ b/packages/constify/README.md @@ -153,3 +153,23 @@ export function call(d1) { return a; } ``` + +# @swc/plugin-constify + +## 0.1.44 + +### Patch Changes + +- 4ef0b7f: Add changelog to the readme + +## 0.1.43 + +### Patch Changes + +- 4e72680: swc_core@0.88.0 + +## 0.1.42 + +### Patch Changes + +- 16bb4d8: swc_core@0.82.x diff --git a/packages/constify/README.md.tmpl b/packages/constify/README.md.tmpl new file mode 100644 index 000000000..9d3e5d53d --- /dev/null +++ b/packages/constify/README.md.tmpl @@ -0,0 +1,157 @@ +# `@swc/constify` + +This plugin can be used to hoist constant parts of any expressions as constant variables, without affecting the runtime behavior or readability of the code. + +## Why? + +There are lots of cases where some parts of expressions are constant and thus can be reused, but others are not. + +## Configuration + +This plugin can be configured with `.swcrc` + +```json +{ + "jsc": { + "experimental": { + "plugins": [ ["@swc/plugin-constify", { + }] ] + } +} +``` + +## Usage + +Basically, this plugins is about extracting some parts of expressions. + +```ts +import { constify, lazyConst } from "@swc/constify"; + +export function call(dynamic) { + const options = [ + constify({ + code: 1, + onClick() {}, + }), + { + code: 2, + onClick() { + console.log(dynamic); + }, + }, + lazyConst({ + code: 3, + onClick() {}, + }), + ]; + + return options; +} +``` + +becomes + +```ts +const __CONST_0__ = { + code: 1, + onClick() {}, +}; +function __CONST_1__() { + const __data__ = { + code: 3, + onClick() {}, + }; + return (__CONST_1__ = function () { + return __data__; + })(); +} + +export function call(dynamic) { + const options = [ + __CONST_0__, + { + code: 2, + onClick() { + console.log(dynamic); + }, + }, + __CONST_1__(), + ]; + + return options; +} +``` + +Note that this plugin supports using non-top-level variables. Those are hoisted to uppermost scope with the all used variable in the scope. +In other words, you can write code like + +```ts +import { constify, lazyConst } from "@swc/constify"; + +export function call(d1) { + function a(d2) { + function a1() { + return [ + constify({ + code: d1, + onClick() {}, + }), + constify({ + code: d2, + onClick() { + console.log(d2); + }, + }), + lazyConst({ + code: d1, + onClick() {}, + }), + ]; + } + + return a1; + } + + return a; +} +``` + +and it will be compiled as + +```ts +export function call(d1) { + const __CONST_0__ = { + code: d1, + onClick() {}, + }; + + function __CONST_2__() { + const __data__ = { + code: d1, + onClick() {}, + }; + return (__CONST_2__ = function () { + return __data__; + })(); + } + + function a(d2) { + const __CONST_1__ = { + code: d2, + onClick() { + console.log(d2); + }, + }; + + function a1() { + return [__CONST_0__, __CONST_1__, __CONST_2__()]; + } + + return a1; + } + + return a; +} +``` + +${CHANGELOG} diff --git a/packages/constify/package.json b/packages/constify/package.json index eb491d310..e7c9c8cd4 100644 --- a/packages/constify/package.json +++ b/packages/constify/package.json @@ -1,6 +1,6 @@ { "name": "@swc/plugin-constify", - "version": "0.1.43", + "version": "0.1.44", "description": "SWC plugin for optimization", "main": "swc_plugin_constify.wasm", "scripts": { diff --git a/packages/constify/transform/Cargo.toml b/packages/constify/transform/Cargo.toml index 220b3b69d..600475b21 100644 --- a/packages/constify/transform/Cargo.toml +++ b/packages/constify/transform/Cargo.toml @@ -5,7 +5,7 @@ edition = "2021" license = "Apache-2.0" name = "swc_constify" repository = "https://github.com/swc-project/plugins.git" -version = "0.35.0" +version = "0.36.0" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/packages/emotion/CHANGELOG.md b/packages/emotion/CHANGELOG.md index d4d45d177..62f64a1a0 100644 --- a/packages/emotion/CHANGELOG.md +++ b/packages/emotion/CHANGELOG.md @@ -1,5 +1,11 @@ # @swc/plugin-emotion +## 2.5.114 + +### Patch Changes + +- 4ef0b7f: Add changelog to the readme + ## 2.5.113 ### Patch Changes diff --git a/packages/emotion/Cargo.toml b/packages/emotion/Cargo.toml index 3a2b14785..2f9f6d8b8 100644 --- a/packages/emotion/Cargo.toml +++ b/packages/emotion/Cargo.toml @@ -5,7 +5,7 @@ edition = "2021" license = "Apache-2.0" name = "swc_plugin_emotion" publish = false -version = "0.17.0" +version = "0.18.0" [lib] crate-type = ["cdylib", "rlib"] diff --git a/packages/emotion/README.md b/packages/emotion/README.md index 67ff1bb5f..a92c3ab84 100644 --- a/packages/emotion/README.md +++ b/packages/emotion/README.md @@ -31,3 +31,23 @@ The plugin uses the same config as described in [Next emotion documentation](htt ## Credit Source code for plugin itself (not transforms) are copied from https://github.com/IvanRodriCalleja/emotion-swc-plugin + +# @swc/plugin-emotion + +## 2.5.114 + +### Patch Changes + +- 4ef0b7f: Add changelog to the readme + +## 2.5.113 + +### Patch Changes + +- 4e72680: swc_core@0.88.0 + +## 2.5.112 + +### Patch Changes + +- 16bb4d8: swc_core@0.82.x diff --git a/packages/emotion/README.md.tmpl b/packages/emotion/README.md.tmpl new file mode 100644 index 000000000..5951fab0e --- /dev/null +++ b/packages/emotion/README.md.tmpl @@ -0,0 +1,35 @@ +# emotion + +The official plugin for emotion css-in-js library. + +## Configuration + +The plugin uses the same config as described in [Next emotion documentation](https://nextjs.org/docs/advanced-features/compiler#emotion). + +```js +{ + jsc: { + ... + experimental: { + plugins: [ ['@swc/plugin-emotion', { + // default is true. It will be disabled when build type is production. + sourceMap?: boolean, + // default is 'dev-only'. + autoLabel?: 'never' | 'dev-only' | 'always', + // default is '[local]'. + // Allowed values: `[local]` `[filename]` and `[dirname]` + // This option only works when autoLabel is set to 'dev-only' or 'always'. + // It allows you to define the format of the resulting label. + // The format is defined via string where variable parts are enclosed in square brackets []. + // For example labelFormat: "my-classname--[local]", where [local] will be replaced with the name of the variable the result is assigned to. + labelFormat?: string, + }] ] + } +} +``` + +## Credit + +Source code for plugin itself (not transforms) are copied from https://github.com/IvanRodriCalleja/emotion-swc-plugin + +${CHANGELOG} diff --git a/packages/emotion/package.json b/packages/emotion/package.json index 5b09576de..70c67a5e1 100644 --- a/packages/emotion/package.json +++ b/packages/emotion/package.json @@ -1,6 +1,6 @@ { "name": "@swc/plugin-emotion", - "version": "2.5.113", + "version": "2.5.114", "description": "SWC plugin for emotion css-in-js library", "main": "swc_plugin_emotion.wasm", "scripts": { diff --git a/packages/emotion/transform/Cargo.toml b/packages/emotion/transform/Cargo.toml index b28de8cb5..bb31cd0d3 100644 --- a/packages/emotion/transform/Cargo.toml +++ b/packages/emotion/transform/Cargo.toml @@ -5,7 +5,7 @@ edition = "2021" license = "Apache-2.0" name = "swc_emotion" repository = "https://github.com/swc-project/plugins.git" -version = "0.71.0" +version = "0.72.0" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/packages/jest/CHANGELOG.md b/packages/jest/CHANGELOG.md index 1ea00112c..61b4cd3d8 100644 --- a/packages/jest/CHANGELOG.md +++ b/packages/jest/CHANGELOG.md @@ -1,5 +1,11 @@ # @swc/plugin-jest +## 1.5.114 + +### Patch Changes + +- 4ef0b7f: Add changelog to the readme + ## 1.5.113 ### Patch Changes diff --git a/packages/jest/Cargo.toml b/packages/jest/Cargo.toml index 0f1b7f8b5..21d74d3fb 100644 --- a/packages/jest/Cargo.toml +++ b/packages/jest/Cargo.toml @@ -5,7 +5,7 @@ edition = "2021" license = "Apache-2.0" name = "swc_plugin_jest" publish = false -version = "0.30.0" +version = "0.31.0" [lib] crate-type = ["cdylib", "rlib"] diff --git a/packages/jest/README.md b/packages/jest/README.md new file mode 100644 index 000000000..f46674fab --- /dev/null +++ b/packages/jest/README.md @@ -0,0 +1,21 @@ +# @swc/plugin-jest + +# @swc/plugin-jest + +## 1.5.114 + +### Patch Changes + +- 4ef0b7f: Add changelog to the readme + +## 1.5.113 + +### Patch Changes + +- 4e72680: swc_core@0.88.0 + +## 1.5.112 + +### Patch Changes + +- 16bb4d8: swc_core@0.82.x diff --git a/packages/jest/README.md.tmpl b/packages/jest/README.md.tmpl new file mode 100644 index 000000000..1660f8c44 --- /dev/null +++ b/packages/jest/README.md.tmpl @@ -0,0 +1,3 @@ +# @swc/plugin-jest + +${CHANGELOG} diff --git a/packages/jest/package.json b/packages/jest/package.json index d2e6a0cae..320aedfd3 100644 --- a/packages/jest/package.json +++ b/packages/jest/package.json @@ -1,6 +1,6 @@ { "name": "@swc/plugin-jest", - "version": "1.5.113", + "version": "1.5.114", "description": "SWC plugin for jest", "main": "swc_plugin_jest.wasm", "scripts": { diff --git a/packages/loadable-components/CHANGELOG.md b/packages/loadable-components/CHANGELOG.md index be4e7d7f2..623626cae 100644 --- a/packages/loadable-components/CHANGELOG.md +++ b/packages/loadable-components/CHANGELOG.md @@ -1,5 +1,11 @@ # @swc/plugin-loadable-components +## 0.3.114 + +### Patch Changes + +- 4ef0b7f: Add changelog to the readme + ## 0.3.113 ### Patch Changes diff --git a/packages/loadable-components/Cargo.toml b/packages/loadable-components/Cargo.toml index bd5f48f9f..c9e9cf392 100644 --- a/packages/loadable-components/Cargo.toml +++ b/packages/loadable-components/Cargo.toml @@ -5,7 +5,7 @@ edition = "2021" license = "Apache-2.0" name = "swc_plugin_loadable_components" publish = false -version = "0.17.0" +version = "0.18.0" [lib] crate-type = ["cdylib", "rlib"] diff --git a/packages/loadable-components/README.md b/packages/loadable-components/README.md index 5c6c2972e..66a9374d5 100644 --- a/packages/loadable-components/README.md +++ b/packages/loadable-components/README.md @@ -5,3 +5,23 @@ ```json ["loadable-components", {}] ``` + +# @swc/plugin-loadable-components + +## 0.3.114 + +### Patch Changes + +- 4ef0b7f: Add changelog to the readme + +## 0.3.113 + +### Patch Changes + +- 4e72680: swc_core@0.88.0 + +## 0.3.112 + +### Patch Changes + +- 16bb4d8: swc_core@0.82.x diff --git a/packages/loadable-components/README.md.tmpl b/packages/loadable-components/README.md.tmpl new file mode 100644 index 000000000..fa2e974e7 --- /dev/null +++ b/packages/loadable-components/README.md.tmpl @@ -0,0 +1,9 @@ +# loadable-components + +## Config + +```json +["loadable-components", {}] +``` + +${CHANGELOG} diff --git a/packages/loadable-components/package.json b/packages/loadable-components/package.json index 9f6bc2cd5..3293408dc 100644 --- a/packages/loadable-components/package.json +++ b/packages/loadable-components/package.json @@ -1,6 +1,6 @@ { "name": "@swc/plugin-loadable-components", - "version": "0.3.113", + "version": "0.3.114", "description": "SWC plugin for `@loadable/components`", "main": "swc_plugin_loadable_components.wasm", "scripts": { diff --git a/packages/noop/CHANGELOG.md b/packages/noop/CHANGELOG.md index e13da5245..df5dfa439 100644 --- a/packages/noop/CHANGELOG.md +++ b/packages/noop/CHANGELOG.md @@ -1,5 +1,11 @@ # @swc/plugin-noop +## 1.5.112 + +### Patch Changes + +- 4ef0b7f: Add changelog to the readme + ## 1.5.111 ### Patch Changes diff --git a/packages/noop/Cargo.toml b/packages/noop/Cargo.toml index 6aa174445..5c097b6f1 100644 --- a/packages/noop/Cargo.toml +++ b/packages/noop/Cargo.toml @@ -5,7 +5,7 @@ edition = "2021" license = "Apache-2.0" name = "swc_plugin_noop" publish = false -version = "0.17.0" +version = "0.18.0" [lib] crate-type = ["cdylib", "rlib"] diff --git a/packages/noop/README.md b/packages/noop/README.md new file mode 100644 index 000000000..23ee872dd --- /dev/null +++ b/packages/noop/README.md @@ -0,0 +1,21 @@ +# @swc/plugin-noop + +# @swc/plugin-noop + +## 1.5.112 + +### Patch Changes + +- 4ef0b7f: Add changelog to the readme + +## 1.5.111 + +### Patch Changes + +- 4e72680: swc_core@0.88.0 + +## 1.5.110 + +### Patch Changes + +- 16bb4d8: swc_core@0.82.x diff --git a/packages/noop/README.md.tmpl b/packages/noop/README.md.tmpl new file mode 100644 index 000000000..7642e0df2 --- /dev/null +++ b/packages/noop/README.md.tmpl @@ -0,0 +1,3 @@ +# @swc/plugin-noop + +${CHANGELOG} diff --git a/packages/noop/package.json b/packages/noop/package.json index 858a20e3e..b2d9392ae 100644 --- a/packages/noop/package.json +++ b/packages/noop/package.json @@ -1,6 +1,6 @@ { "name": "@swc/plugin-noop", - "version": "1.5.111", + "version": "1.5.112", "description": "Noop SWC plugin, for debugging", "main": "swc_plugin_noop.wasm", "scripts": { diff --git a/packages/react-remove-properties/CHANGELOG.md b/packages/react-remove-properties/CHANGELOG.md index b2c74c95c..8a3109d89 100644 --- a/packages/react-remove-properties/CHANGELOG.md +++ b/packages/react-remove-properties/CHANGELOG.md @@ -1,5 +1,11 @@ # @swc/plugin-react-remove-properties +## 1.5.114 + +### Patch Changes + +- 4ef0b7f: Add changelog to the readme + ## 1.5.113 ### Patch Changes diff --git a/packages/react-remove-properties/Cargo.toml b/packages/react-remove-properties/Cargo.toml index 564708362..b44a88361 100644 --- a/packages/react-remove-properties/Cargo.toml +++ b/packages/react-remove-properties/Cargo.toml @@ -5,7 +5,7 @@ edition = "2021" license = "Apache-2.0" name = "swc_plugin_react_remove_properties" publish = false -version = "0.18.0" +version = "0.19.0" [lib] crate-type = ["cdylib", "rlib"] diff --git a/packages/react-remove-properties/README.md b/packages/react-remove-properties/README.md index 57bb331d6..b5c0c3a47 100644 --- a/packages/react-remove-properties/README.md +++ b/packages/react-remove-properties/README.md @@ -20,3 +20,23 @@ or } ] ``` + +# @swc/plugin-react-remove-properties + +## 1.5.114 + +### Patch Changes + +- 4ef0b7f: Add changelog to the readme + +## 1.5.113 + +### Patch Changes + +- 4e72680: swc_core@0.88.0 + +## 1.5.112 + +### Patch Changes + +- 16bb4d8: swc_core@0.82.x diff --git a/packages/react-remove-properties/README.md.tmpl b/packages/react-remove-properties/README.md.tmpl new file mode 100644 index 000000000..8a63f4e37 --- /dev/null +++ b/packages/react-remove-properties/README.md.tmpl @@ -0,0 +1,24 @@ +# react-remove-properties + +See https://nextjs.org/docs/architecture/nextjs-compiler#remove-react-properties for more information. + +## Config + +```json +["react-remove-properties"] +``` + +or + +```json +[ + "react-remove-properties", + { + // The regexes defined here are processed in Rust so the syntax is different from + // JavaScript `RegExp`s. See https://docs.rs/regex. + "properties": ["^data-custom$"] + } +] +``` + +${CHANGELOG} diff --git a/packages/react-remove-properties/package.json b/packages/react-remove-properties/package.json index a8afb7f0c..c8afcbd28 100644 --- a/packages/react-remove-properties/package.json +++ b/packages/react-remove-properties/package.json @@ -1,6 +1,6 @@ { "name": "@swc/plugin-react-remove-properties", - "version": "1.5.113", + "version": "1.5.114", "description": "SWC plugin for https://www.npmjs.com/package/babel-plugin-react-remove-properties", "main": "swc_plugin_react_remove_properties.wasm", "scripts": { diff --git a/packages/react-remove-properties/transform/Cargo.toml b/packages/react-remove-properties/transform/Cargo.toml index 584e4d3ab..809bae73b 100644 --- a/packages/react-remove-properties/transform/Cargo.toml +++ b/packages/react-remove-properties/transform/Cargo.toml @@ -5,7 +5,7 @@ edition = "2021" license = "Apache-2.0" name = "react_remove_properties" repository = "https://github.com/swc-project/plugins.git" -version = "0.23.0" +version = "0.24.0" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/packages/relay/CHANGELOG.md b/packages/relay/CHANGELOG.md index 3a66b69f4..4f193bc9b 100644 --- a/packages/relay/CHANGELOG.md +++ b/packages/relay/CHANGELOG.md @@ -1,5 +1,11 @@ # @swc/plugin-relay +## 1.5.114 + +### Patch Changes + +- 4ef0b7f: Add changelog to the readme + ## 1.5.113 ### Patch Changes diff --git a/packages/relay/Cargo.toml b/packages/relay/Cargo.toml index 3675d603c..50041272b 100644 --- a/packages/relay/Cargo.toml +++ b/packages/relay/Cargo.toml @@ -5,7 +5,7 @@ edition = "2021" license = "Apache-2.0" name = "swc_plugin_relay" publish = false -version = "0.6.0" +version = "0.7.0" [lib] crate-type = ["cdylib", "rlib"] diff --git a/packages/relay/README.md b/packages/relay/README.md index 85e5cae58..65b9a9fbb 100644 --- a/packages/relay/README.md +++ b/packages/relay/README.md @@ -83,4 +83,25 @@ plugins: [ ], ], ``` -In this example typescript graphql files will output transpiled import path of `javascript` ending with `.js`. \ No newline at end of file + +In this example typescript graphql files will output transpiled import path of `javascript` ending with `.js`. + +# @swc/plugin-relay + +## 1.5.114 + +### Patch Changes + +- 4ef0b7f: Add changelog to the readme + +## 1.5.113 + +### Patch Changes + +- 4e72680: swc_core@0.88.0 + +## 1.5.112 + +### Patch Changes + +- 16bb4d8: swc_core@0.82.x diff --git a/packages/relay/README.md.tmpl b/packages/relay/README.md.tmpl new file mode 100644 index 000000000..34b3f477d --- /dev/null +++ b/packages/relay/README.md.tmpl @@ -0,0 +1,89 @@ +### `@swc/plugin-relay` + +#### Setup + +```sh +npm install --save-dev @swc/plugin-relay @swc/core +``` + +### Example + +The below shows how to configure `@swc/plugin-relay` and pass the options to Webpack: + +Create an `.swcrc.js` file like the below: + +```js +// .swcrc.js + +module.exports = { + jsc: { + experimental: { + plugins: [ + [ + "@swc/plugin-relay", + { + rootDir: __dirname, + artifactDirectory: "src/__generated__", + language: "typescript", + eagerEsModules: true, + }, + ], + ], + }, + parser: { + syntax: "typescript", + tsx: true, + }, + transform: { + react: { + runtime: "automatic", + }, + }, + }, +}; +``` + +And then update your `swc-loader` Webpack config: + +```js +const swcConfig = require("./.swcrc.js") + +// ... + +{ + include: path.resolve("./src"), + test: /\.ts$/, + use: [ + { + loader: "swc-loader", + options: swcConfig, + }, + ], +} +``` + +> Note: We're using a `.swcrc.js` file extension up above and importing the config directly because Relay needs access to `__dirname`, which can't be derived from the default JSON parsed from `.swcrc`. + +#### Output import paths + +By default, `@swc/plugin-relay` will transpile import paths based on the `language` option. +You can use `outputFileExtension` to change the file extension of the generated import paths. + +```js +plugins: [ + [ + "@swc/plugin-relay", + { + rootDir: __dirname, + artifactDirectory: "src/__generated__", + language: "typescript", + eagerEsModules: true, + outputFileExtension: "js", + }, + ], +], +``` + +In this example typescript graphql files will output transpiled import path of `javascript` ending with `.js`. + +${CHANGELOG} diff --git a/packages/relay/package.json b/packages/relay/package.json index d8c841d39..2bab6c0a7 100644 --- a/packages/relay/package.json +++ b/packages/relay/package.json @@ -1,6 +1,6 @@ { "name": "@swc/plugin-relay", - "version": "1.5.113", + "version": "1.5.114", "description": "SWC plugin for relay", "main": "swc_plugin_relay.wasm", "types": "./types.d.ts", diff --git a/packages/relay/transform/Cargo.toml b/packages/relay/transform/Cargo.toml index 2571c26b3..c878684d0 100644 --- a/packages/relay/transform/Cargo.toml +++ b/packages/relay/transform/Cargo.toml @@ -5,7 +5,7 @@ edition = "2021" license = "Apache-2.0" name = "swc_relay" repository = "https://github.com/swc-project/plugins.git" -version = "0.43.0" +version = "0.44.0" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/packages/remove-console/CHANGELOG.md b/packages/remove-console/CHANGELOG.md index 7aa3afe5b..379704ffc 100644 --- a/packages/remove-console/CHANGELOG.md +++ b/packages/remove-console/CHANGELOG.md @@ -1,5 +1,11 @@ # @swc/plugin-remove-console +## 1.5.114 + +### Patch Changes + +- 4ef0b7f: Add changelog to the readme + ## 1.5.113 ### Patch Changes diff --git a/packages/remove-console/Cargo.toml b/packages/remove-console/Cargo.toml index 577024817..6c96aad2c 100644 --- a/packages/remove-console/Cargo.toml +++ b/packages/remove-console/Cargo.toml @@ -5,7 +5,7 @@ edition = "2021" license = "Apache-2.0" name = "swc_plugin_remove_console" publish = false -version = "0.18.0" +version = "0.19.0" [lib] crate-type = ["cdylib", "rlib"] diff --git a/packages/remove-console/README.md b/packages/remove-console/README.md index 6fc1ae76e..00b58d19b 100644 --- a/packages/remove-console/README.md +++ b/packages/remove-console/README.md @@ -18,3 +18,23 @@ or } ] ``` + +# @swc/plugin-remove-console + +## 1.5.114 + +### Patch Changes + +- 4ef0b7f: Add changelog to the readme + +## 1.5.113 + +### Patch Changes + +- 4e72680: swc_core@0.88.0 + +## 1.5.112 + +### Patch Changes + +- 16bb4d8: swc_core@0.82.x diff --git a/packages/remove-console/README.md.tmpl b/packages/remove-console/README.md.tmpl new file mode 100644 index 000000000..4f161aa62 --- /dev/null +++ b/packages/remove-console/README.md.tmpl @@ -0,0 +1,22 @@ +# remove-console + +See https://nextjs.org/docs/architecture/nextjs-compiler#remove-console for more information. + +## Config + +```json +["remove-console"] +``` + +or + +```json +[ + "remove-console", + { + "exclude": ["error"] + } +] +``` + +${CHANGELOG} diff --git a/packages/remove-console/package.json b/packages/remove-console/package.json index dbbad275b..387b55702 100644 --- a/packages/remove-console/package.json +++ b/packages/remove-console/package.json @@ -1,6 +1,6 @@ { "name": "@swc/plugin-remove-console", - "version": "1.5.113", + "version": "1.5.114", "description": "SWC plugin for https://www.npmjs.com/package/babel-plugin-remove-console", "main": "swc_plugin_remove_console.wasm", "scripts": { diff --git a/packages/remove-console/transform/Cargo.toml b/packages/remove-console/transform/Cargo.toml index 3c65eac3c..cb627c957 100644 --- a/packages/remove-console/transform/Cargo.toml +++ b/packages/remove-console/transform/Cargo.toml @@ -5,7 +5,7 @@ edition = "2021" license = "Apache-2.0" name = "remove_console" repository = "https://github.com/swc-project/plugins.git" -version = "0.24.0" +version = "0.25.0" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/packages/styled-components/CHANGELOG.md b/packages/styled-components/CHANGELOG.md index 1bf5aac2a..dd107d4b8 100644 --- a/packages/styled-components/CHANGELOG.md +++ b/packages/styled-components/CHANGELOG.md @@ -1,5 +1,11 @@ # @swc/plugin-styled-components +## 1.5.114 + +### Patch Changes + +- 4ef0b7f: Add changelog to the readme + ## 1.5.113 ### Patch Changes diff --git a/packages/styled-components/Cargo.toml b/packages/styled-components/Cargo.toml index 8247ea2e4..505da208f 100644 --- a/packages/styled-components/Cargo.toml +++ b/packages/styled-components/Cargo.toml @@ -4,7 +4,7 @@ edition = "2021" license = "Apache-2.0" name = "swc_plugin_styled_components" publish = false -version = "0.39.0" +version = "0.40.0" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [lib] diff --git a/packages/styled-components/README.md b/packages/styled-components/README.md index 4922e5e20..789c6f798 100644 --- a/packages/styled-components/README.md +++ b/packages/styled-components/README.md @@ -25,3 +25,23 @@ Then update your `.swcrc` file like below: } } ``` + +# @swc/plugin-styled-components + +## 1.5.114 + +### Patch Changes + +- 4ef0b7f: Add changelog to the readme + +## 1.5.113 + +### Patch Changes + +- 4e72680: swc_core@0.88.0 + +## 1.5.112 + +### Patch Changes + +- 16bb4d8: swc_core@0.82.x diff --git a/packages/styled-components/README.md.tmpl b/packages/styled-components/README.md.tmpl new file mode 100644 index 000000000..5bc209be5 --- /dev/null +++ b/packages/styled-components/README.md.tmpl @@ -0,0 +1,29 @@ +### `@swc/plugin-styled-components` + +#### Setup + +```sh +npm install --save-dev @swc/plugin-styled-components @swc/core +``` + +Then update your `.swcrc` file like below: + +```json +{ + "jsc": { + "experimental": { + "plugins": [ + [ + "@swc/plugin-styled-components", + { + "displayName": true, + "ssr": true + } + ] + ] + } + } +} +``` + +${CHANGELOG} diff --git a/packages/styled-components/package.json b/packages/styled-components/package.json index 3668da3b3..a66fc9520 100644 --- a/packages/styled-components/package.json +++ b/packages/styled-components/package.json @@ -1,6 +1,6 @@ { "name": "@swc/plugin-styled-components", - "version": "1.5.113", + "version": "1.5.114", "description": "SWC plugin for styled-components", "main": "swc_plugin_styled_components.wasm", "scripts": { diff --git a/packages/styled-components/transform/Cargo.toml b/packages/styled-components/transform/Cargo.toml index f1fb170ea..8fa242543 100644 --- a/packages/styled-components/transform/Cargo.toml +++ b/packages/styled-components/transform/Cargo.toml @@ -6,7 +6,7 @@ include = ["Cargo.toml", "src/**/*.rs"] license = "Apache-2.0" name = "styled_components" repository = "https://github.com/swc-project/plugins.git" -version = "0.95.0" +version = "0.96.0" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/packages/styled-jsx/CHANGELOG.md b/packages/styled-jsx/CHANGELOG.md index 7293c2778..5351ad373 100644 --- a/packages/styled-jsx/CHANGELOG.md +++ b/packages/styled-jsx/CHANGELOG.md @@ -1,5 +1,11 @@ # @swc/plugin-styled-jsx +## 1.5.114 + +### Patch Changes + +- 4ef0b7f: Add changelog to the readme + ## 1.5.113 ### Patch Changes diff --git a/packages/styled-jsx/Cargo.toml b/packages/styled-jsx/Cargo.toml index 6b20fae38..fddfaa709 100644 --- a/packages/styled-jsx/Cargo.toml +++ b/packages/styled-jsx/Cargo.toml @@ -5,7 +5,7 @@ edition = "2021" license = "Apache-2.0" name = "swc_plugin_styled_jsx" publish = false -version = "0.19.0" +version = "0.20.0" [lib] crate-type = ["cdylib", "rlib"] diff --git a/packages/styled-jsx/README.md b/packages/styled-jsx/README.md new file mode 100644 index 000000000..10285e4df --- /dev/null +++ b/packages/styled-jsx/README.md @@ -0,0 +1,21 @@ +# @swc/plugin-styled-jsx + +# @swc/plugin-styled-jsx + +## 1.5.114 + +### Patch Changes + +- 4ef0b7f: Add changelog to the readme + +## 1.5.113 + +### Patch Changes + +- 4e72680: swc_core@0.88.0 + +## 1.5.112 + +### Patch Changes + +- 16bb4d8: swc_core@0.82.x diff --git a/packages/styled-jsx/README.md.tmpl b/packages/styled-jsx/README.md.tmpl new file mode 100644 index 000000000..4a5477fe9 --- /dev/null +++ b/packages/styled-jsx/README.md.tmpl @@ -0,0 +1,3 @@ +# @swc/plugin-styled-jsx + +${CHANGELOG} diff --git a/packages/styled-jsx/package.json b/packages/styled-jsx/package.json index 2917a75ee..d7464f103 100644 --- a/packages/styled-jsx/package.json +++ b/packages/styled-jsx/package.json @@ -1,6 +1,6 @@ { "name": "@swc/plugin-styled-jsx", - "version": "1.5.113", + "version": "1.5.114", "description": "SWC plugin for styled-jsx", "main": "swc_plugin_styled_jsx.wasm", "scripts": { diff --git a/packages/styled-jsx/transform/Cargo.toml b/packages/styled-jsx/transform/Cargo.toml index b1f7c985d..859e5f8a7 100644 --- a/packages/styled-jsx/transform/Cargo.toml +++ b/packages/styled-jsx/transform/Cargo.toml @@ -4,7 +4,7 @@ description = "AST transforms visitor for styled-jsx" edition = "2021" license = "Apache-2.0" name = "styled_jsx" -version = "0.72.0" +version = "0.73.0" [features] custom_transform = ["swc_common/concurrent"] diff --git a/packages/swc-magic/CHANGELOG.md b/packages/swc-magic/CHANGELOG.md index 116bedd36..f5db6bc36 100644 --- a/packages/swc-magic/CHANGELOG.md +++ b/packages/swc-magic/CHANGELOG.md @@ -1,5 +1,11 @@ # @swc/plugin-swc-magic +## 1.5.114 + +### Patch Changes + +- 4ef0b7f: Add changelog to the readme + ## 1.5.113 ### Patch Changes diff --git a/packages/swc-magic/Cargo.toml b/packages/swc-magic/Cargo.toml index bd3d2d03f..6accb214c 100644 --- a/packages/swc-magic/Cargo.toml +++ b/packages/swc-magic/Cargo.toml @@ -5,7 +5,7 @@ edition = "2021" license = "Apache-2.0" name = "swc_plugin_swc_magic" publish = false -version = "0.6.0" +version = "0.7.0" [lib] crate-type = ["cdylib", "rlib"] diff --git a/packages/swc-magic/README.md b/packages/swc-magic/README.md index 6954bb4ab..a4d3e7a64 100644 --- a/packages/swc-magic/README.md +++ b/packages/swc-magic/README.md @@ -19,3 +19,23 @@ import { markAsPure } from "@swc/magic"; markAsPure(() => console.log("This will be removed by the SWC minifier")); ``` + +# @swc/plugin-swc-magic + +## 1.5.114 + +### Patch Changes + +- 4ef0b7f: Add changelog to the readme + +## 1.5.113 + +### Patch Changes + +- 4e72680: swc_core@0.88.0 + +## 1.5.112 + +### Patch Changes + +- 16bb4d8: swc_core@0.82.x diff --git a/packages/swc-magic/README.md.tmpl b/packages/swc-magic/README.md.tmpl new file mode 100644 index 000000000..42d439937 --- /dev/null +++ b/packages/swc-magic/README.md.tmpl @@ -0,0 +1,23 @@ +# @swc/plugin-swc-magic + +## Usage + +.swcrc: + +```json +{ + "jsc": { + "experimental": { + "plugins": ["@swc/plugin-swc-magic"] + } + } +} +``` + +```js +import { markAsPure } from "@swc/magic"; + +markAsPure(() => console.log("This will be removed by the SWC minifier")); +``` + +${CHANGELOG} diff --git a/packages/swc-magic/package.json b/packages/swc-magic/package.json index 0f1820fc8..59676f5e9 100644 --- a/packages/swc-magic/package.json +++ b/packages/swc-magic/package.json @@ -1,6 +1,6 @@ { "name": "@swc/plugin-swc-magic", - "version": "1.5.113", + "version": "1.5.114", "description": "SWC plugin for swc-magic", "main": "swc_plugin_swc_magic.wasm", "scripts": { diff --git a/packages/swc-magic/transform/Cargo.toml b/packages/swc-magic/transform/Cargo.toml index f28f626fe..94670a022 100644 --- a/packages/swc-magic/transform/Cargo.toml +++ b/packages/swc-magic/transform/Cargo.toml @@ -4,7 +4,7 @@ description = "AST transforms visitor for swc-magic" edition = "2021" license = "Apache-2.0" name = "swc_magic" -version = "0.18.0" +version = "0.19.0" [dependencies] serde = { version = "1.0.189", features = ["derive"] } diff --git a/packages/transform-imports/CHANGELOG.md b/packages/transform-imports/CHANGELOG.md index bfa8d1a67..dd5c79a19 100644 --- a/packages/transform-imports/CHANGELOG.md +++ b/packages/transform-imports/CHANGELOG.md @@ -1,5 +1,11 @@ # @swc/plugin-transform-imports +## 1.5.114 + +### Patch Changes + +- 4ef0b7f: Add changelog to the readme + ## 1.5.113 ### Patch Changes diff --git a/packages/transform-imports/Cargo.toml b/packages/transform-imports/Cargo.toml index 18dbaec2e..bbbf7a5e9 100644 --- a/packages/transform-imports/Cargo.toml +++ b/packages/transform-imports/Cargo.toml @@ -5,7 +5,7 @@ edition = "2021" license = "Apache-2.0" name = "swc_plugin_transform_imports" publish = false -version = "0.18.0" +version = "0.19.0" [lib] crate-type = ["cdylib", "rlib"] diff --git a/packages/transform-imports/README.md b/packages/transform-imports/README.md index 53b51dfb5..25b10a2a1 100644 --- a/packages/transform-imports/README.md +++ b/packages/transform-imports/README.md @@ -15,3 +15,23 @@ } ] ``` + +# @swc/plugin-transform-imports + +## 1.5.114 + +### Patch Changes + +- 4ef0b7f: Add changelog to the readme + +## 1.5.113 + +### Patch Changes + +- 4e72680: swc_core@0.88.0 + +## 1.5.112 + +### Patch Changes + +- 16bb4d8: swc_core@0.82.x diff --git a/packages/transform-imports/README.md.tmpl b/packages/transform-imports/README.md.tmpl new file mode 100644 index 000000000..dd5617e11 --- /dev/null +++ b/packages/transform-imports/README.md.tmpl @@ -0,0 +1,19 @@ +# transform-imports + +## Config + +```json +[ + "transform-imports", + { + "react-bootstrap": { + "transform": "react-bootstrap/lib/{{member}}" + }, + "lodash": { + "transform": "lodash/{{member}}" + } + } +] +``` + +${CHANGELOG} diff --git a/packages/transform-imports/package.json b/packages/transform-imports/package.json index f9190e211..224688d61 100644 --- a/packages/transform-imports/package.json +++ b/packages/transform-imports/package.json @@ -1,6 +1,6 @@ { "name": "@swc/plugin-transform-imports", - "version": "1.5.113", + "version": "1.5.114", "description": "SWC plugin for https://www.npmjs.com/package/babel-plugin-transform-imports", "main": "swc_plugin_transform_imports.wasm", "scripts": { diff --git a/packages/transform-imports/transform/Cargo.toml b/packages/transform-imports/transform/Cargo.toml index f1668b685..b29ec0ce9 100644 --- a/packages/transform-imports/transform/Cargo.toml +++ b/packages/transform-imports/transform/Cargo.toml @@ -5,7 +5,7 @@ edition = "2021" license = "Apache-2.0" name = "modularize_imports" repository = "https://github.com/swc-project/plugins.git" -version = "0.67.0" +version = "0.68.0" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/scripts/bump.sh b/scripts/bump.sh index 8412ac5f5..1b549a205 100755 --- a/scripts/bump.sh +++ b/scripts/bump.sh @@ -4,5 +4,12 @@ set -eu pnpm changeset pnpm changeset version +for pkg in $(ls -d packages/*); do + CHANGELOG=$(cat ./$pkg/CHANGELOG.md) envsubst < ./$pkg/README.md.tmpl > ./$pkg/README.md + git add ./$pkg/README.md +done + +git commit -am "Merge CHANGELOG into README" + cargo set-version --workspace --bump minor git commit -a -m "Bump crates" || true diff --git a/xtask/Cargo.toml b/xtask/Cargo.toml index 2d3e18a38..86d0c062d 100644 --- a/xtask/Cargo.toml +++ b/xtask/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "xtask" -version = "0.7.0" +version = "0.8.0" edition = "2021" publish = false