@swc/core 1.3.24 → 1.3.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -5,6 +5,154 @@
5
5
 
6
6
 
7
7
 
8
+ - **(common)** Mark `\r` as a line ending (#6752) ([26a0c13](https://github.com/swc-project/swc/commit/26a0c135896098e1e1a8fbb99a623311828af5b2))
9
+
10
+
11
+ - **(es)** Remove useless context (#6777) ([ae3cfa7](https://github.com/swc-project/swc/commit/ae3cfa7d2d4cff7f3246691d24286bc2470792e1))
12
+
13
+
14
+ - **(es/codegen)** Fix LineCol calculation of printed files (#6763) ([2b503c1](https://github.com/swc-project/swc/commit/2b503c16d5f338c6a786a19c7c0acbc4c06bcfee))
15
+
16
+
17
+ - **(es/codegen)** Skip `lo` of a program if body is not empty (#6773) ([3f0f664](https://github.com/swc-project/swc/commit/3f0f664c488b4f51a12d277b29ad17e28a413a2b))
18
+
19
+
20
+ - **(es/decorator)** Fix type detection for template literal types (#6786) ([bbfa97a](https://github.com/swc-project/swc/commit/bbfa97a475fdfe18fe9e3ea29329ecb39ed2ddac))
21
+
22
+
23
+ - **(es/helpers)** Make `_classPrivateFieldLooseBase ` return receiver (#6770) ([1d14760](https://github.com/swc-project/swc/commit/1d147602c0bfe291408c65b2e444cea0b5ceba89))
24
+
25
+
26
+ - **(es/minifier)** Make name mangler respect `toplevel` (#6774) ([ec7e913](https://github.com/swc-project/swc/commit/ec7e9138158426b83d12dc3a29896098fb4c9ffa))
27
+
28
+
29
+ - **(es/minifier)** Don't inline conditionally initialized vars (#6751) ([336b1d8](https://github.com/swc-project/swc/commit/336b1d8b4d6489da8f78731d9e12fef962a005da))
30
+
31
+
32
+ - **(es/minifier)** Make AST compressor respect `toplevel` (#6775) ([06770cf](https://github.com/swc-project/swc/commit/06770cff047055b9cea27970e7ce882d770257ba))
33
+
34
+
35
+ - **(es/parser)** Allow parsing `import.meta` as an expression (#6783) ([ff8face](https://github.com/swc-project/swc/commit/ff8facef64ffe115936cfc154b35ec08359524f8))
36
+
37
+ ### Features
38
+
39
+
40
+
41
+ - **(es/minifier)** Make name mangler understand block scoping (#6670) ([a1ccc8a](https://github.com/swc-project/swc/commit/a1ccc8afdff1f252210d571907124508cf760694))
42
+
43
+
44
+ - **(es/minifier)** Handle boolean in `Evaluator` (#6756) ([8a6a1cb](https://github.com/swc-project/swc/commit/8a6a1cbcf1279b805e740f4d77ebb9fb72d52d41))
45
+
46
+
47
+ - **(es/typescript)** Support const modifier on type parameters (#6672) ([019cf37](https://github.com/swc-project/swc/commit/019cf371994b87a92fd26fc623959a797f35991b))
48
+
49
+ ### Miscellaneous Tasks
50
+
51
+
52
+
53
+ - **(ci)** Fix CI action (#6772) ([6d365de](https://github.com/swc-project/swc/commit/6d365de9e21d57c785f1634f4c19418765d9ca9b))
54
+
55
+ ### Testing
56
+
57
+
58
+
59
+ - **(es)** Add a test for a fixed source map issue (#6768) ([6c126da](https://github.com/swc-project/swc/commit/6c126da1d42922229e9bb1c7594570f701e083ba))
60
+
61
+
62
+ - **(es/module)** Add a test for invalid issue (#6785) ([0ef84e1](https://github.com/swc-project/swc/commit/0ef84e1c0004ec5282d26e9a84ea5729681ff106))
63
+
64
+ ## [1.3.25] - 2023-01-05
65
+
66
+ ### Bug Fixes
67
+
68
+
69
+
70
+ - **(bindings/cli)** Skip empty stdin in non tty environments (#6714) ([0076418](https://github.com/swc-project/swc/commit/00764188195c63af1e5a8e34ce29dcf650b20f04))
71
+
72
+
73
+ - **(cli)** Use the `--source-maps` option (#6708) ([24cd384](https://github.com/swc-project/swc/commit/24cd384c20abc9bacdc89b50cd6a9a9df243b687))
74
+
75
+
76
+ - **(es)** Preserve license comments by default (#6703) ([58700f2](https://github.com/swc-project/swc/commit/58700f2bec696d0d2b2466ab6b4641f0a7017808))
77
+
78
+
79
+ - **(es)** Remove import statement canonicalization (#6716) ([b451fa9](https://github.com/swc-project/swc/commit/b451fa9e88aee33368759a67913e7c6eb9c3898f))
80
+
81
+
82
+ - **(es)** Fix wasm (#6755) ([b46815a](https://github.com/swc-project/swc/commit/b46815a684a13ff3b364b2913c18acf57afbbac7))
83
+
84
+
85
+ - **(es/compat)** Fix syntax context of `async-to-generator` (#6741) ([206c0db](https://github.com/swc-project/swc/commit/206c0dbebe5eecaa8a5c1846189b26cb5517d84c))
86
+
87
+
88
+ - **(es/minifier)** Fix usage counter to fix infinite loop (#6744) ([88d40e8](https://github.com/swc-project/swc/commit/88d40e8ab899976c123b5b5f74f0ad02ec9d7868))
89
+
90
+
91
+ - **(es/parser)** Fix priority of `>>>` (#6748) ([65a0d3a](https://github.com/swc-project/swc/commit/65a0d3a3109f3d32818f7bf2c8ebbeb863c62060))
92
+
93
+
94
+ - **(es/plugin)** Fix plugin starter template (#6723) ([082dc21](https://github.com/swc-project/swc/commit/082dc2101b8f3c05b103cf59484355ef87016a57))
95
+
96
+
97
+ - **(es/react)** Force refresh if code contains `@refresh reset` (#6749) ([36b26d3](https://github.com/swc-project/swc/commit/36b26d3496fd9ad7e3ccb41c164600657476a8a3))
98
+
99
+
100
+ - **(es/utils)** Fix detection of hoisting (#6738) ([b5d31cc](https://github.com/swc-project/swc/commit/b5d31cc2dabcf79886606946c75d0a15f2fe4091))
101
+
102
+
103
+ - **(preset-env)** Update data (#6719) ([d506c96](https://github.com/swc-project/swc/commit/d506c9680577173e5abb1dd0f75456145fda60c9))
104
+
105
+ ### Documentation
106
+
107
+
108
+
109
+ - **(es)** Fix example (#6743) ([79afcb5](https://github.com/swc-project/swc/commit/79afcb5d81cb5cca89c48d39b950ddc24f31d434))
110
+
111
+ ### Features
112
+
113
+
114
+
115
+ - **(bindings)** Remove `swcx` from `@swc/core` (#6720) ([30dd65b](https://github.com/swc-project/swc/commit/30dd65bb83a3159ca9d569af6b29aed03796056f))
116
+
117
+
118
+ - **(css/parser)** Normalize urange (#6704) ([8af627d](https://github.com/swc-project/swc/commit/8af627d5c4720644246f99012b6f49b419066eef))
119
+
120
+
121
+ - **(css/prefixer)** Support page break (#6693) ([27a8b7e](https://github.com/swc-project/swc/commit/27a8b7e50b67de076089ca8b05d6e44944182b31))
122
+
123
+
124
+ - **(css/prefixer)** Support `clamp` (#6695) ([1722428](https://github.com/swc-project/swc/commit/1722428909ba380fec114be1e2a75f0d2462a645))
125
+
126
+
127
+ - **(es/jest)** Support chaining of jest function calls (#6747) ([72fb606](https://github.com/swc-project/swc/commit/72fb606eb204fddad5df284afda0955fd6e760ff))
128
+
129
+ ### Miscellaneous Tasks
130
+
131
+
132
+
133
+ - **(ci)** Fix publish action ([ed2277f](https://github.com/swc-project/swc/commit/ed2277fc07bc1be133001eefcee707c8e6f194fd))
134
+
135
+
136
+ - **(ci)** Fix publish action (#6757) ([7e6e7b1](https://github.com/swc-project/swc/commit/7e6e7b107e40b7ca2192f6c04f668a526fc2db35))
137
+
138
+ ### Performance
139
+
140
+
141
+
142
+ - **(es/preset-env)** Use `VisitMut` instead of `Fold` for polyfill (#6734) ([98da644](https://github.com/swc-project/swc/commit/98da6444b6499d3b3d895d3f81941c778340cf3b))
143
+
144
+ ### Refactor
145
+
146
+
147
+
148
+ - **(css/codegen)** Do not use `raw` (#6674) ([ebebd60](https://github.com/swc-project/swc/commit/ebebd608750bf63d6f715350835a1a5349efdb68))
149
+
150
+ ## [1.3.24] - 2022-12-21
151
+
152
+ ### Bug Fixes
153
+
154
+
155
+
8
156
  - **(css/minifier)** Don't remove custom variables with different case (#6655) ([dd7280d](https://github.com/swc-project/swc/commit/dd7280d5bda960292bf5f4e12816d5a340277222))
9
157
 
10
158
 
package/binding.js CHANGED
@@ -9,7 +9,8 @@ function isMusl() {
9
9
  // For Node 10
10
10
  if (!process.report || typeof process.report.getReport !== 'function') {
11
11
  try {
12
- return readFileSync('/usr/bin/ldd', 'utf8').includes('musl');
12
+ const lddPath = require('child_process').execSync('which ldd').toString().trim();
13
+ return readFileSync(lddPath, 'utf8').includes('musl');
13
14
  }
14
15
  catch (e) {
15
16
  return true;
@@ -104,6 +105,17 @@ switch (platform) {
104
105
  }
105
106
  break;
106
107
  case 'darwin':
108
+ localFileExisted = existsSync(join(__dirname, 'swc.darwin-universal.node'));
109
+ try {
110
+ if (localFileExisted) {
111
+ nativeBinding = require('./swc.darwin-universal.node');
112
+ }
113
+ else {
114
+ nativeBinding = require('@swc/core-darwin-universal');
115
+ }
116
+ break;
117
+ }
118
+ catch (_a) { }
107
119
  switch (arch) {
108
120
  case 'x64':
109
121
  localFileExisted = existsSync(join(__dirname, 'swc.darwin-x64.node'));
package/package.json CHANGED
@@ -1,12 +1,9 @@
1
1
  {
2
2
  "name": "@swc/core",
3
- "version": "1.3.24",
3
+ "version": "1.3.26",
4
4
  "description": "Super-fast alternative for babel",
5
5
  "homepage": "https://swc.rs",
6
6
  "main": "./index.js",
7
- "bin": {
8
- "swcx": "run_swcx.js"
9
- },
10
7
  "author": "강동윤 <kdy1997.dev@gmail.com>",
11
8
  "license": "Apache-2.0",
12
9
  "keywords": [
@@ -94,7 +91,7 @@
94
91
  "@babel/preset-react": "^7.13.13",
95
92
  "@babel/preset-typescript": "^7.13.0",
96
93
  "@babel/types": "^7.14.0",
97
- "@napi-rs/cli": "^2.13.3",
94
+ "@napi-rs/cli": "^2.14.1",
98
95
  "@swc/core": "=1.2.220",
99
96
  "@swc/helpers": "^0.4.2",
100
97
  "@swc/plugin-jest": "1.5.25",
@@ -141,16 +138,16 @@
141
138
  "url": "https://opencollective.com/swc"
142
139
  },
143
140
  "optionalDependencies": {
144
- "@swc/core-win32-x64-msvc": "1.3.24",
145
- "@swc/core-darwin-x64": "1.3.24",
146
- "@swc/core-linux-x64-gnu": "1.3.24",
147
- "@swc/core-linux-x64-musl": "1.3.24",
148
- "@swc/core-win32-ia32-msvc": "1.3.24",
149
- "@swc/core-linux-arm64-gnu": "1.3.24",
150
- "@swc/core-linux-arm-gnueabihf": "1.3.24",
151
- "@swc/core-darwin-arm64": "1.3.24",
152
- "@swc/core-linux-arm64-musl": "1.3.24",
153
- "@swc/core-win32-arm64-msvc": "1.3.24"
141
+ "@swc/core-win32-x64-msvc": "1.3.26",
142
+ "@swc/core-darwin-x64": "1.3.26",
143
+ "@swc/core-linux-x64-gnu": "1.3.26",
144
+ "@swc/core-linux-x64-musl": "1.3.26",
145
+ "@swc/core-win32-ia32-msvc": "1.3.26",
146
+ "@swc/core-linux-arm64-gnu": "1.3.26",
147
+ "@swc/core-linux-arm-gnueabihf": "1.3.26",
148
+ "@swc/core-darwin-arm64": "1.3.26",
149
+ "@swc/core-linux-arm64-musl": "1.3.26",
150
+ "@swc/core-win32-arm64-msvc": "1.3.26"
154
151
  },
155
152
  "files": [
156
153
  "CHANGELOG.md",
@@ -162,7 +159,6 @@
162
159
  "Visitor.js",
163
160
  "binding.d.ts",
164
161
  "index.js",
165
- "run_swcx.js",
166
162
  "types.d.ts",
167
163
  "util.js",
168
164
  "README.md",
package/run_swcx.js DELETED
@@ -1,85 +0,0 @@
1
- #!/usr/bin/env node
2
- "use strict";
3
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
4
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
5
- return new (P || (P = Promise))(function (resolve, reject) {
6
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
7
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
8
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
9
- step((generator = generator.apply(thisArg, _arguments || [])).next());
10
- });
11
- };
12
- var __importDefault = (this && this.__importDefault) || function (mod) {
13
- return (mod && mod.__esModule) ? mod : { "default": mod };
14
- };
15
- Object.defineProperty(exports, "__esModule", { value: true });
16
- /**
17
- * Lightweight entrypoint to native swc cli binary.
18
- *
19
- * This is to locate corresponding per-platform executables correctly, as well as
20
- * let npm links binary to `node_modules/.bin` allows npm-related ecosystem (`npx swcx`, etcs)
21
- * works correctly. However, it means spawning native binary still requires warmup from node.js
22
- * process.
23
- *
24
- * NOTE: THIS IS NOT A PERMANENT APPROACH.
25
- * Distribution of native cli binary is not fully concluded yet. This allows easier
26
- * opt-in while implementation is in progress to collect feedback.
27
- */
28
- const child_process_1 = require("child_process");
29
- const path_1 = __importDefault(require("path"));
30
- const fs_1 = require("fs");
31
- const { platform, arch } = process;
32
- const isMusl = () => (() => {
33
- function isMusl() {
34
- if (!process.report || typeof process.report.getReport !== "function") {
35
- try {
36
- return (0, fs_1.readFileSync)("/usr/bin/ldd", "utf8").includes("musl");
37
- }
38
- catch (e) {
39
- return true;
40
- }
41
- }
42
- else {
43
- const { glibcVersionRuntime } = process.report.getReport().header;
44
- return !glibcVersionRuntime;
45
- }
46
- }
47
- return isMusl();
48
- })();
49
- const platformPackagesMap = {
50
- "android": {
51
- "arm64": "@swc/core-android-arm64",
52
- "arm": "@swc/core-android-arm-eabi",
53
- },
54
- "win32": {
55
- "x64": "@swc/core-win32-x64-msvc",
56
- "ia32": "@swc/core-win32-ia32-msvc",
57
- "arm64": "@swc/core-win32-arm64-msvc"
58
- },
59
- "darwin": {
60
- "x64": "@swc/core-darwin-x64",
61
- "arm64": "@swc/core-darwin-arm64",
62
- },
63
- "freebsd": {
64
- "x64": "@swc/core-freebsd-x64",
65
- },
66
- "linux": {
67
- "x64": `@swc/core-linux-x64-${isMusl() ? 'musl' : 'gnu'}`,
68
- "arm64": `@swc/core-linux-arm64-${isMusl() ? 'musl' : 'gnu'}`,
69
- "arm": "@swc/core-linux-arm64-gnu"
70
- },
71
- };
72
- const inferBinaryName = () => {
73
- const packageName = platformPackagesMap[platform][arch];
74
- if (!packageName) {
75
- throw new Error(`Unsupported platform: binary for '${platform} ${arch}' is not available`);
76
- }
77
- return path_1.default.join(path_1.default.dirname(require.resolve(packageName)), platform === 'win32' ? 'swc.exe' : 'swc');
78
- };
79
- const executeBinary = () => __awaiter(void 0, void 0, void 0, function* () {
80
- const binary = inferBinaryName();
81
- const [, , ...args] = process.argv;
82
- const options = { cwd: process.cwd(), stdio: "inherit" };
83
- return (0, child_process_1.spawn)(binary, args, options);
84
- });
85
- executeBinary().catch((e) => console.error(e));