@elench/testkit 0.1.63 → 0.1.65

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.
Files changed (90) hide show
  1. package/lib/coverage/backend-discovery.mjs +6 -30
  2. package/lib/coverage/evidence.mjs +15 -3
  3. package/lib/coverage/evidence.test.mjs +13 -4
  4. package/lib/coverage/fs-walk.mjs +2 -2
  5. package/lib/coverage/graph-builder.mjs +23 -24
  6. package/lib/coverage/next-ir-to-graph.mjs +240 -0
  7. package/node_modules/@elench/next-analysis/package.json +14 -0
  8. package/node_modules/@elench/next-analysis/src/api-routes.mjs +81 -0
  9. package/node_modules/@elench/next-analysis/src/api-routes.test.mjs +22 -0
  10. package/node_modules/@elench/next-analysis/src/app-root.mjs +7 -0
  11. package/node_modules/@elench/next-analysis/src/backend-links.mjs +31 -0
  12. package/node_modules/@elench/next-analysis/src/index.mjs +21 -0
  13. package/node_modules/@elench/next-analysis/src/pages.mjs +68 -0
  14. package/node_modules/@elench/next-analysis/src/project.mjs +94 -0
  15. package/node_modules/@elench/next-analysis/src/project.test.mjs +35 -0
  16. package/node_modules/@elench/next-analysis/src/route-tree.mjs +621 -0
  17. package/node_modules/@elench/next-analysis/src/routes.mjs +41 -0
  18. package/node_modules/@elench/next-analysis/src/routes.test.mjs +25 -0
  19. package/node_modules/@elench/next-analysis/src/server-actions.mjs +53 -0
  20. package/node_modules/@elench/next-analysis/src/server-actions.test.mjs +37 -0
  21. package/node_modules/@elench/next-analysis/src/shared.mjs +209 -0
  22. package/node_modules/@elench/next-analysis/src/swc.mjs +388 -0
  23. package/node_modules/@elench/testkit-bridge/package.json +2 -2
  24. package/node_modules/@elench/testkit-protocol/package.json +1 -1
  25. package/node_modules/@elench/ts-analysis/package.json +10 -0
  26. package/node_modules/@elench/ts-analysis/src/callables.mjs +135 -0
  27. package/node_modules/@elench/ts-analysis/src/callables.test.mjs +55 -0
  28. package/node_modules/@elench/ts-analysis/src/exports.mjs +69 -0
  29. package/node_modules/@elench/ts-analysis/src/exports.test.mjs +50 -0
  30. package/node_modules/@elench/ts-analysis/src/index.mjs +14 -0
  31. package/node_modules/@elench/ts-analysis/src/jsx.mjs +69 -0
  32. package/node_modules/@elench/ts-analysis/src/jsx.test.mjs +43 -0
  33. package/node_modules/@elench/ts-analysis/src/project.mjs +100 -0
  34. package/node_modules/@elench/ts-analysis/src/project.test.mjs +54 -0
  35. package/node_modules/@elench/ts-analysis/src/requests.mjs +141 -0
  36. package/node_modules/@elench/ts-analysis/src/requests.test.mjs +35 -0
  37. package/node_modules/@elench/ts-analysis/src/resolution.mjs +53 -0
  38. package/node_modules/@elench/ts-analysis/src/shared.mjs +32 -0
  39. package/node_modules/@elench/ts-analysis/src/syntax.mjs +27 -0
  40. package/node_modules/@next/routing/README.md +91 -0
  41. package/node_modules/@next/routing/dist/__tests__/captures.test.d.ts +1 -0
  42. package/node_modules/@next/routing/dist/__tests__/conditions.test.d.ts +1 -0
  43. package/node_modules/@next/routing/dist/__tests__/dynamic-after-rewrites.test.d.ts +1 -0
  44. package/node_modules/@next/routing/dist/__tests__/i18n-resolve-routes.test.d.ts +1 -0
  45. package/node_modules/@next/routing/dist/__tests__/i18n.test.d.ts +1 -0
  46. package/node_modules/@next/routing/dist/__tests__/middleware.test.d.ts +1 -0
  47. package/node_modules/@next/routing/dist/__tests__/normalize-next-data.test.d.ts +1 -0
  48. package/node_modules/@next/routing/dist/__tests__/redirects.test.d.ts +1 -0
  49. package/node_modules/@next/routing/dist/__tests__/resolve-routes.test.d.ts +1 -0
  50. package/node_modules/@next/routing/dist/__tests__/rewrites.test.d.ts +1 -0
  51. package/node_modules/@next/routing/dist/destination.d.ts +22 -0
  52. package/node_modules/@next/routing/dist/i18n.d.ts +48 -0
  53. package/node_modules/@next/routing/dist/index.d.ts +5 -0
  54. package/node_modules/@next/routing/dist/index.js +1 -0
  55. package/node_modules/@next/routing/dist/matchers.d.ts +12 -0
  56. package/node_modules/@next/routing/dist/middleware.d.ts +12 -0
  57. package/node_modules/@next/routing/dist/next-data.d.ts +10 -0
  58. package/node_modules/@next/routing/dist/resolve-routes.d.ts +2 -0
  59. package/node_modules/@next/routing/dist/types.d.ts +97 -0
  60. package/node_modules/@next/routing/package.json +39 -0
  61. package/node_modules/@swc/core/README.md +100 -0
  62. package/node_modules/@swc/core/Visitor.d.ts +218 -0
  63. package/node_modules/@swc/core/Visitor.js +1399 -0
  64. package/node_modules/@swc/core/binding.d.ts +59 -0
  65. package/node_modules/@swc/core/binding.js +368 -0
  66. package/node_modules/@swc/core/index.d.ts +120 -0
  67. package/node_modules/@swc/core/index.js +443 -0
  68. package/node_modules/@swc/core/package.json +120 -0
  69. package/node_modules/@swc/core/postinstall.js +148 -0
  70. package/node_modules/@swc/core/spack.d.ts +51 -0
  71. package/node_modules/@swc/core/spack.js +87 -0
  72. package/node_modules/@swc/core/util.d.ts +1 -0
  73. package/node_modules/@swc/core/util.js +104 -0
  74. package/node_modules/@swc/core-linux-x64-gnu/README.md +3 -0
  75. package/node_modules/@swc/core-linux-x64-gnu/package.json +46 -0
  76. package/node_modules/@swc/core-linux-x64-gnu/swc.linux-x64-gnu.node +0 -0
  77. package/node_modules/@swc/counter/CHANGELOG.md +7 -0
  78. package/node_modules/@swc/counter/README.md +7 -0
  79. package/node_modules/@swc/counter/index.js +1 -0
  80. package/node_modules/@swc/counter/package.json +27 -0
  81. package/node_modules/@swc/types/LICENSE +201 -0
  82. package/node_modules/@swc/types/README.md +4 -0
  83. package/node_modules/@swc/types/assumptions.d.ts +92 -0
  84. package/node_modules/@swc/types/assumptions.js +2 -0
  85. package/node_modules/@swc/types/index.d.ts +2049 -0
  86. package/node_modules/@swc/types/index.js +2 -0
  87. package/node_modules/@swc/types/package.json +40 -0
  88. package/package.json +7 -3
  89. package/lib/coverage/next-discovery.mjs +0 -205
  90. package/lib/coverage/next-static-analysis.mjs +0 -1047
@@ -0,0 +1,443 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
26
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
27
+ return new (P || (P = Promise))(function (resolve, reject) {
28
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
29
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
30
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
31
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
32
+ });
33
+ };
34
+ var __rest = (this && this.__rest) || function (s, e) {
35
+ var t = {};
36
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
37
+ t[p] = s[p];
38
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
39
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
40
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
41
+ t[p[i]] = s[p[i]];
42
+ }
43
+ return t;
44
+ };
45
+ Object.defineProperty(exports, "__esModule", { value: true });
46
+ exports.DEFAULT_EXTENSIONS = exports.getBinaryMetadata = exports.__experimental_registerGlobalTraceConfig = exports.minifySync = exports.minify = exports.bundle = exports.transformFileSync = exports.transformFile = exports.transformSync = exports.transform = exports.printSync = exports.print = exports.parseFileSync = exports.parseFile = exports.parseSync = exports.parse = exports.experimental_analyze = exports.Compiler = exports.plugins = exports.version = exports.experimental_newMangleNameCache = void 0;
47
+ const path_1 = require("path");
48
+ // @ts-ignore
49
+ var binding_1 = require("./binding");
50
+ Object.defineProperty(exports, "experimental_newMangleNameCache", { enumerable: true, get: function () { return binding_1.newMangleNameCache; } });
51
+ const spack_1 = require("./spack");
52
+ const assert = __importStar(require("assert"));
53
+ // Allow overrides to the location of the .node binding file
54
+ const bindingsOverride = process.env["SWC_BINARY_PATH"];
55
+ // `@swc/core` includes d.ts for the `@swc/wasm` to provide typed fallback bindings
56
+ // todo: fix package.json scripts
57
+ let fallbackBindings;
58
+ const bindings = (() => {
59
+ let binding;
60
+ try {
61
+ binding = !!bindingsOverride
62
+ ? require((0, path_1.resolve)(bindingsOverride))
63
+ : require("./binding.js");
64
+ // If native binding loaded successfully, it should return proper target triple constant.
65
+ const triple = binding.getTargetTriple();
66
+ assert.ok(triple, "Failed to read target triple from native binary.");
67
+ return binding;
68
+ }
69
+ catch (_) {
70
+ // postinstall supposed to install `@swc/wasm` already
71
+ fallbackBindings = require("@swc/wasm");
72
+ }
73
+ finally {
74
+ return binding;
75
+ }
76
+ })();
77
+ /**
78
+ * Version of the swc binding.
79
+ */
80
+ exports.version = require("./package.json").version;
81
+ /**
82
+ * @deprecated JavaScript API is deprecated. Please use Wasm plugin instead.
83
+ */
84
+ function plugins(ps) {
85
+ return (mod) => {
86
+ let m = mod;
87
+ for (const p of ps) {
88
+ m = p(m);
89
+ }
90
+ return m;
91
+ };
92
+ }
93
+ exports.plugins = plugins;
94
+ class Compiler {
95
+ constructor() {
96
+ this.fallbackBindingsPluginWarningDisplayed = false;
97
+ }
98
+ minify(src, opts, extras) {
99
+ return __awaiter(this, void 0, void 0, function* () {
100
+ if (bindings) {
101
+ return bindings.minify(Buffer.from(!Buffer.isBuffer(src) && typeof src === 'object' ? JSON.stringify(src) : src), toBuffer(opts !== null && opts !== void 0 ? opts : {}), !Buffer.isBuffer(src) && typeof src === 'object', extras !== null && extras !== void 0 ? extras : {});
102
+ }
103
+ else if (fallbackBindings) {
104
+ return fallbackBindings.minify(src, opts);
105
+ }
106
+ throw new Error("Bindings not found.");
107
+ });
108
+ }
109
+ minifySync(src, opts, extras) {
110
+ if (bindings) {
111
+ return bindings.minifySync(Buffer.from(!Buffer.isBuffer(src) && typeof src === 'object' ? JSON.stringify(src) : src), toBuffer(opts !== null && opts !== void 0 ? opts : {}), !Buffer.isBuffer(src) && typeof src === 'object', extras !== null && extras !== void 0 ? extras : {});
112
+ }
113
+ else if (fallbackBindings) {
114
+ return fallbackBindings.minifySync(src, opts);
115
+ }
116
+ throw new Error("Bindings not found.");
117
+ }
118
+ parse(src, options, filename) {
119
+ return __awaiter(this, void 0, void 0, function* () {
120
+ options = options || { syntax: "ecmascript" };
121
+ options.syntax = options.syntax || "ecmascript";
122
+ if (!bindings && !!fallbackBindings) {
123
+ throw new Error("Fallback bindings does not support this interface yet.");
124
+ }
125
+ else if (!bindings) {
126
+ throw new Error("Bindings not found.");
127
+ }
128
+ if (bindings) {
129
+ const res = yield bindings.parse(src, toBuffer(options), filename);
130
+ return JSON.parse(res);
131
+ }
132
+ else if (fallbackBindings) {
133
+ return fallbackBindings.parse(src, options);
134
+ }
135
+ throw new Error("Bindings not found.");
136
+ });
137
+ }
138
+ parseSync(src, options, filename) {
139
+ options = options || { syntax: "ecmascript" };
140
+ options.syntax = options.syntax || "ecmascript";
141
+ if (bindings) {
142
+ return JSON.parse(bindings.parseSync(src, toBuffer(options), filename));
143
+ }
144
+ else if (fallbackBindings) {
145
+ return fallbackBindings.parseSync(src, options);
146
+ }
147
+ throw new Error("Bindings not found.");
148
+ }
149
+ parseFile(path, options) {
150
+ return __awaiter(this, void 0, void 0, function* () {
151
+ options = options || { syntax: "ecmascript" };
152
+ options.syntax = options.syntax || "ecmascript";
153
+ if (!bindings && !!fallbackBindings) {
154
+ throw new Error("Fallback bindings does not support filesystem access.");
155
+ }
156
+ else if (!bindings) {
157
+ throw new Error("Bindings not found.");
158
+ }
159
+ const res = yield bindings.parseFile(path, toBuffer(options));
160
+ return JSON.parse(res);
161
+ });
162
+ }
163
+ parseFileSync(path, options) {
164
+ options = options || { syntax: "ecmascript" };
165
+ options.syntax = options.syntax || "ecmascript";
166
+ if (!bindings && !!fallbackBindings) {
167
+ throw new Error("Fallback bindings does not support filesystem access");
168
+ }
169
+ else if (!bindings) {
170
+ throw new Error("Bindings not found.");
171
+ }
172
+ return JSON.parse(bindings.parseFileSync(path, toBuffer(options)));
173
+ }
174
+ /**
175
+ * Note: this method should be invoked on the compiler instance used
176
+ * for `parse()` / `parseSync()`.
177
+ */
178
+ print(m, options) {
179
+ return __awaiter(this, void 0, void 0, function* () {
180
+ options = options || {};
181
+ if (bindings) {
182
+ return bindings.print(JSON.stringify(m), toBuffer(options));
183
+ }
184
+ else if (fallbackBindings) {
185
+ return fallbackBindings.print(m, options);
186
+ }
187
+ throw new Error("Bindings not found.");
188
+ });
189
+ }
190
+ /**
191
+ * Note: this method should be invoked on the compiler instance used
192
+ * for `parse()` / `parseSync()`.
193
+ */
194
+ printSync(m, options) {
195
+ options = options || {};
196
+ if (bindings) {
197
+ return bindings.printSync(JSON.stringify(m), toBuffer(options));
198
+ }
199
+ else if (fallbackBindings) {
200
+ return fallbackBindings.printSync(m, options);
201
+ }
202
+ throw new Error("Bindings not found.");
203
+ }
204
+ transform(src, options) {
205
+ var _a, _b, _c;
206
+ return __awaiter(this, void 0, void 0, function* () {
207
+ const isModule = typeof src !== "string";
208
+ options = options || {};
209
+ if ((_a = options === null || options === void 0 ? void 0 : options.jsc) === null || _a === void 0 ? void 0 : _a.parser) {
210
+ options.jsc.parser.syntax =
211
+ (_b = options.jsc.parser.syntax) !== null && _b !== void 0 ? _b : "ecmascript";
212
+ }
213
+ const { plugin } = options, newOptions = __rest(options, ["plugin"]);
214
+ if (bindings) {
215
+ if (plugin) {
216
+ const m = typeof src === "string"
217
+ ? yield this.parse(src, (_c = options === null || options === void 0 ? void 0 : options.jsc) === null || _c === void 0 ? void 0 : _c.parser, options.filename)
218
+ : src;
219
+ return this.transform(plugin(m), newOptions);
220
+ }
221
+ return bindings.transform(isModule ? JSON.stringify(src) : src, isModule, toBuffer(newOptions));
222
+ }
223
+ else if (fallbackBindings) {
224
+ if (plugin && !this.fallbackBindingsPluginWarningDisplayed) {
225
+ console.warn(`Fallback bindings does not support legacy plugins, it'll be ignored.`);
226
+ this.fallbackBindingsPluginWarningDisplayed = true;
227
+ }
228
+ return fallbackBindings.transform(src, options);
229
+ }
230
+ throw new Error("Bindings not found.");
231
+ });
232
+ }
233
+ transformSync(src, options) {
234
+ var _a, _b, _c;
235
+ const isModule = typeof src !== "string";
236
+ options = options || {};
237
+ if ((_a = options === null || options === void 0 ? void 0 : options.jsc) === null || _a === void 0 ? void 0 : _a.parser) {
238
+ options.jsc.parser.syntax =
239
+ (_b = options.jsc.parser.syntax) !== null && _b !== void 0 ? _b : "ecmascript";
240
+ }
241
+ const { plugin } = options, newOptions = __rest(options, ["plugin"]);
242
+ if (bindings) {
243
+ if (plugin) {
244
+ const m = typeof src === "string"
245
+ ? this.parseSync(src, (_c = options === null || options === void 0 ? void 0 : options.jsc) === null || _c === void 0 ? void 0 : _c.parser, options.filename)
246
+ : src;
247
+ return this.transformSync(plugin(m), newOptions);
248
+ }
249
+ return bindings.transformSync(isModule ? JSON.stringify(src) : src, isModule, toBuffer(newOptions));
250
+ }
251
+ else if (fallbackBindings) {
252
+ if (plugin && !this.fallbackBindingsPluginWarningDisplayed) {
253
+ console.warn(`Fallback bindings does not support legacy plugins, it'll be ignored.`);
254
+ this.fallbackBindingsPluginWarningDisplayed = true;
255
+ }
256
+ return fallbackBindings.transformSync(isModule ? JSON.stringify(src) : src, options);
257
+ }
258
+ throw new Error("Bindings not found");
259
+ }
260
+ transformFile(path, options) {
261
+ var _a, _b, _c;
262
+ return __awaiter(this, void 0, void 0, function* () {
263
+ if (!bindings && !!fallbackBindings) {
264
+ throw new Error("Fallback bindings does not support filesystem access.");
265
+ }
266
+ else if (!bindings) {
267
+ throw new Error("Bindings not found.");
268
+ }
269
+ options = options || {};
270
+ if ((_a = options === null || options === void 0 ? void 0 : options.jsc) === null || _a === void 0 ? void 0 : _a.parser) {
271
+ options.jsc.parser.syntax =
272
+ (_b = options.jsc.parser.syntax) !== null && _b !== void 0 ? _b : "ecmascript";
273
+ }
274
+ const { plugin } = options, newOptions = __rest(options, ["plugin"]);
275
+ newOptions.filename = path;
276
+ if (plugin) {
277
+ const m = yield this.parseFile(path, (_c = options === null || options === void 0 ? void 0 : options.jsc) === null || _c === void 0 ? void 0 : _c.parser);
278
+ return this.transform(plugin(m), newOptions);
279
+ }
280
+ return bindings.transformFile(path, false, toBuffer(newOptions));
281
+ });
282
+ }
283
+ transformFileSync(path, options) {
284
+ var _a, _b, _c;
285
+ if (!bindings && !!fallbackBindings) {
286
+ throw new Error("Fallback bindings does not support filesystem access.");
287
+ }
288
+ else if (!bindings) {
289
+ throw new Error("Bindings not found.");
290
+ }
291
+ options = options || {};
292
+ if ((_a = options === null || options === void 0 ? void 0 : options.jsc) === null || _a === void 0 ? void 0 : _a.parser) {
293
+ options.jsc.parser.syntax =
294
+ (_b = options.jsc.parser.syntax) !== null && _b !== void 0 ? _b : "ecmascript";
295
+ }
296
+ const { plugin } = options, newOptions = __rest(options, ["plugin"]);
297
+ newOptions.filename = path;
298
+ if (plugin) {
299
+ const m = this.parseFileSync(path, (_c = options === null || options === void 0 ? void 0 : options.jsc) === null || _c === void 0 ? void 0 : _c.parser);
300
+ return this.transformSync(plugin(m), newOptions);
301
+ }
302
+ return bindings.transformFileSync(path,
303
+ /* isModule */ false, toBuffer(newOptions));
304
+ }
305
+ bundle(options) {
306
+ return __awaiter(this, void 0, void 0, function* () {
307
+ if (!bindings && !!fallbackBindings) {
308
+ throw new Error("Fallback bindings does not support this interface yet.");
309
+ }
310
+ else if (!bindings) {
311
+ throw new Error("Bindings not found.");
312
+ }
313
+ const opts = yield (0, spack_1.compileBundleOptions)(options);
314
+ if (Array.isArray(opts)) {
315
+ const all = yield Promise.all(opts.map((opt) => __awaiter(this, void 0, void 0, function* () {
316
+ return this.bundle(opt);
317
+ })));
318
+ let obj = {};
319
+ for (const o of all) {
320
+ obj = Object.assign(Object.assign({}, obj), o);
321
+ }
322
+ return obj;
323
+ }
324
+ return bindings.bundle(toBuffer(Object.assign({}, opts)));
325
+ });
326
+ }
327
+ }
328
+ exports.Compiler = Compiler;
329
+ const compiler = new Compiler();
330
+ function experimental_analyze(src, options) {
331
+ return bindings.analyze(src, toBuffer(options));
332
+ }
333
+ exports.experimental_analyze = experimental_analyze;
334
+ function parse(src, options) {
335
+ return compiler.parse(src, options);
336
+ }
337
+ exports.parse = parse;
338
+ function parseSync(src, options) {
339
+ return compiler.parseSync(src, options);
340
+ }
341
+ exports.parseSync = parseSync;
342
+ function parseFile(path, options) {
343
+ return compiler.parseFile(path, options);
344
+ }
345
+ exports.parseFile = parseFile;
346
+ function parseFileSync(path, options) {
347
+ return compiler.parseFileSync(path, options);
348
+ }
349
+ exports.parseFileSync = parseFileSync;
350
+ function print(m, options) {
351
+ return compiler.print(m, options);
352
+ }
353
+ exports.print = print;
354
+ function printSync(m, options) {
355
+ return compiler.printSync(m, options);
356
+ }
357
+ exports.printSync = printSync;
358
+ function transform(src, options) {
359
+ return compiler.transform(src, options);
360
+ }
361
+ exports.transform = transform;
362
+ function transformSync(src, options) {
363
+ return compiler.transformSync(src, options);
364
+ }
365
+ exports.transformSync = transformSync;
366
+ function transformFile(path, options) {
367
+ return compiler.transformFile(path, options);
368
+ }
369
+ exports.transformFile = transformFile;
370
+ function transformFileSync(path, options) {
371
+ return compiler.transformFileSync(path, options);
372
+ }
373
+ exports.transformFileSync = transformFileSync;
374
+ function bundle(options) {
375
+ return compiler.bundle(options);
376
+ }
377
+ exports.bundle = bundle;
378
+ function minify(src, opts, extras) {
379
+ return __awaiter(this, void 0, void 0, function* () {
380
+ return compiler.minify(src, opts, extras);
381
+ });
382
+ }
383
+ exports.minify = minify;
384
+ function minifySync(src, opts, extras) {
385
+ return compiler.minifySync(src, opts, extras);
386
+ }
387
+ exports.minifySync = minifySync;
388
+ /**
389
+ * Configure custom trace configuration runs for a process lifecycle.
390
+ * Currently only chromium's trace event format is supported.
391
+ * (https://docs.google.com/document/d/1CvAClvFfyA5R-PhYUmn5OOQtYMH4h6I0nSsKchNAySU/preview)
392
+ *
393
+ * This should be called before calling any binding interfaces exported in `@swc/core`, such as
394
+ * `transform*`, or `parse*` or anything. To avoid breaking changes, each binding fn internally
395
+ * sets default trace subscriber if not set.
396
+ *
397
+ * Unlike other configuration, this does not belong to individual api surface using swcrc
398
+ * or api's parameters (`transform(..., {trace})`). This is due to current tracing subscriber
399
+ * can be configured only once for the global scope. Calling `registerGlobalTraceConfig` multiple
400
+ * time won't cause error, subsequent calls will be ignored.
401
+ *
402
+ * As name implies currently this is experimental interface may change over time without semver
403
+ * major breaking changes. Please provide feedbacks,
404
+ * or bug report at https://github.com/swc-project/swc/discussions.
405
+ */
406
+ function __experimental_registerGlobalTraceConfig(traceConfig) {
407
+ // Do not raise error if binding doesn't exists - fallback binding will not support
408
+ // this ever.
409
+ if (bindings) {
410
+ if (traceConfig.type === "traceEvent") {
411
+ bindings.initCustomTraceSubscriber(traceConfig.fileName);
412
+ }
413
+ }
414
+ }
415
+ exports.__experimental_registerGlobalTraceConfig = __experimental_registerGlobalTraceConfig;
416
+ /**
417
+ * @ignore
418
+ *
419
+ * Returns current binary's metadata to determine which binary is actually loaded.
420
+ *
421
+ * This is undocumented interface, does not guarantee stability across `@swc/core`'s semver
422
+ * as internal representation may change anytime. Use it with caution.
423
+ */
424
+ function getBinaryMetadata() {
425
+ return {
426
+ target: bindings ? bindings === null || bindings === void 0 ? void 0 : bindings.getTargetTriple() : undefined,
427
+ };
428
+ }
429
+ exports.getBinaryMetadata = getBinaryMetadata;
430
+ exports.DEFAULT_EXTENSIONS = Object.freeze([
431
+ ".js",
432
+ ".jsx",
433
+ ".es6",
434
+ ".es",
435
+ ".mjs",
436
+ ".ts",
437
+ ".tsx",
438
+ ".cts",
439
+ ".mts",
440
+ ]);
441
+ function toBuffer(t) {
442
+ return Buffer.from(JSON.stringify(t));
443
+ }
@@ -0,0 +1,120 @@
1
+ {
2
+ "name": "@swc/core",
3
+ "version": "1.15.32",
4
+ "description": "Super-fast alternative for babel",
5
+ "homepage": "https://swc.rs",
6
+ "main": "./index.js",
7
+ "author": "강동윤 <kdy1997.dev@gmail.com>",
8
+ "license": "Apache-2.0",
9
+ "keywords": [
10
+ "swc",
11
+ "swcpack",
12
+ "babel",
13
+ "typescript",
14
+ "rust",
15
+ "webpack",
16
+ "tsc"
17
+ ],
18
+ "engines": {
19
+ "node": ">=10"
20
+ },
21
+ "repository": {
22
+ "type": "git",
23
+ "url": "git+https://github.com/swc-project/swc.git",
24
+ "directory": "packages/core"
25
+ },
26
+ "bugs": {
27
+ "url": "https://github.com/swc-project/swc/issues"
28
+ },
29
+ "napi": {
30
+ "binaryName": "swc",
31
+ "targets": [
32
+ "x86_64-apple-darwin",
33
+ "x86_64-pc-windows-msvc",
34
+ "x86_64-unknown-linux-gnu",
35
+ "powerpc64le-unknown-linux-gnu",
36
+ "s390x-unknown-linux-gnu",
37
+ "x86_64-unknown-linux-musl",
38
+ "i686-pc-windows-msvc",
39
+ "armv7-unknown-linux-gnueabihf",
40
+ "aarch64-apple-darwin",
41
+ "aarch64-unknown-linux-gnu",
42
+ "aarch64-unknown-linux-musl",
43
+ "aarch64-pc-windows-msvc"
44
+ ]
45
+ },
46
+ "publishConfig": {
47
+ "registry": "https://registry.npmjs.org/",
48
+ "access": "public",
49
+ "provenance": true
50
+ },
51
+ "types": "./index.d.ts",
52
+ "scripts": {
53
+ "postinstall": "node postinstall.js",
54
+ "artifacts": "napi artifacts --npm-dir scripts/npm",
55
+ "prepack": "tsc -d && napi prepublish -p scripts/npm --tag-style npm --skip-optional-publish && node scripts/copy-readme.js",
56
+ "pack": "wasm-pack",
57
+ "build:ts": "tsc -d",
58
+ "build:wasm": "npm-run-all \"pack -- build ../../bindings/binding_core_wasm --scope swc {1} -t {2} --features plugin\" --",
59
+ "build": "tsc -d && napi build --manifest-path ../../Cargo.toml --platform -p binding_core_node --js ./binding.js --dts ./binding.d.ts --release -o .",
60
+ "build:dev": "tsc -d && napi build --manifest-path ../../Cargo.toml --platform -p binding_core_node --js ./binding.js --dts ./binding.d.ts -o .",
61
+ "test": "rstest",
62
+ "version": "napi version --npm-dir scripts/npm"
63
+ },
64
+ "peerDependencies": {
65
+ "@swc/helpers": ">=0.5.17"
66
+ },
67
+ "peerDependenciesMeta": {
68
+ "@swc/helpers": {
69
+ "optional": true
70
+ }
71
+ },
72
+ "funding": {
73
+ "type": "opencollective",
74
+ "url": "https://opencollective.com/swc"
75
+ },
76
+ "files": [
77
+ "CHANGELOG.md",
78
+ "Visitor.d.ts",
79
+ "index.d.ts",
80
+ "spack.js",
81
+ "util.d.ts",
82
+ "LICENSE",
83
+ "Visitor.js",
84
+ "binding.d.ts",
85
+ "index.js",
86
+ "types.d.ts",
87
+ "util.js",
88
+ "README.md",
89
+ "binding.js",
90
+ "package.json",
91
+ "spack.d.ts",
92
+ "types.js",
93
+ "postinstall.js",
94
+ "bindings/binding_core_wasm/pkg/binding_core_wasm.d.ts"
95
+ ],
96
+ "dependencies": {
97
+ "@swc/counter": "^0.1.3",
98
+ "@swc/types": "^0.1.26"
99
+ },
100
+ "devDependencies": {
101
+ "@napi-rs/cli": "^3.2.0",
102
+ "@rstest/core": "^0.7.8",
103
+ "cross-env": "^7.0.3",
104
+ "typescript": "^5.3.3"
105
+ },
106
+ "optionalDependencies": {
107
+ "@swc/core-darwin-x64": "1.15.32",
108
+ "@swc/core-win32-x64-msvc": "1.15.32",
109
+ "@swc/core-linux-x64-gnu": "1.15.32",
110
+ "@swc/core-linux-ppc64-gnu": "1.15.32",
111
+ "@swc/core-linux-s390x-gnu": "1.15.32",
112
+ "@swc/core-linux-x64-musl": "1.15.32",
113
+ "@swc/core-win32-ia32-msvc": "1.15.32",
114
+ "@swc/core-linux-arm-gnueabihf": "1.15.32",
115
+ "@swc/core-darwin-arm64": "1.15.32",
116
+ "@swc/core-linux-arm64-gnu": "1.15.32",
117
+ "@swc/core-linux-arm64-musl": "1.15.32",
118
+ "@swc/core-win32-arm64-msvc": "1.15.32"
119
+ }
120
+ }