@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.
- package/lib/coverage/backend-discovery.mjs +6 -30
- package/lib/coverage/evidence.mjs +15 -3
- package/lib/coverage/evidence.test.mjs +13 -4
- package/lib/coverage/fs-walk.mjs +2 -2
- package/lib/coverage/graph-builder.mjs +23 -24
- package/lib/coverage/next-ir-to-graph.mjs +240 -0
- package/node_modules/@elench/next-analysis/package.json +14 -0
- package/node_modules/@elench/next-analysis/src/api-routes.mjs +81 -0
- package/node_modules/@elench/next-analysis/src/api-routes.test.mjs +22 -0
- package/node_modules/@elench/next-analysis/src/app-root.mjs +7 -0
- package/node_modules/@elench/next-analysis/src/backend-links.mjs +31 -0
- package/node_modules/@elench/next-analysis/src/index.mjs +21 -0
- package/node_modules/@elench/next-analysis/src/pages.mjs +68 -0
- package/node_modules/@elench/next-analysis/src/project.mjs +94 -0
- package/node_modules/@elench/next-analysis/src/project.test.mjs +35 -0
- package/node_modules/@elench/next-analysis/src/route-tree.mjs +621 -0
- package/node_modules/@elench/next-analysis/src/routes.mjs +41 -0
- package/node_modules/@elench/next-analysis/src/routes.test.mjs +25 -0
- package/node_modules/@elench/next-analysis/src/server-actions.mjs +53 -0
- package/node_modules/@elench/next-analysis/src/server-actions.test.mjs +37 -0
- package/node_modules/@elench/next-analysis/src/shared.mjs +209 -0
- package/node_modules/@elench/next-analysis/src/swc.mjs +388 -0
- package/node_modules/@elench/testkit-bridge/package.json +2 -2
- package/node_modules/@elench/testkit-protocol/package.json +1 -1
- package/node_modules/@elench/ts-analysis/package.json +10 -0
- package/node_modules/@elench/ts-analysis/src/callables.mjs +135 -0
- package/node_modules/@elench/ts-analysis/src/callables.test.mjs +55 -0
- package/node_modules/@elench/ts-analysis/src/exports.mjs +69 -0
- package/node_modules/@elench/ts-analysis/src/exports.test.mjs +50 -0
- package/node_modules/@elench/ts-analysis/src/index.mjs +14 -0
- package/node_modules/@elench/ts-analysis/src/jsx.mjs +69 -0
- package/node_modules/@elench/ts-analysis/src/jsx.test.mjs +43 -0
- package/node_modules/@elench/ts-analysis/src/project.mjs +100 -0
- package/node_modules/@elench/ts-analysis/src/project.test.mjs +54 -0
- package/node_modules/@elench/ts-analysis/src/requests.mjs +141 -0
- package/node_modules/@elench/ts-analysis/src/requests.test.mjs +35 -0
- package/node_modules/@elench/ts-analysis/src/resolution.mjs +53 -0
- package/node_modules/@elench/ts-analysis/src/shared.mjs +32 -0
- package/node_modules/@elench/ts-analysis/src/syntax.mjs +27 -0
- package/node_modules/@next/routing/README.md +91 -0
- package/node_modules/@next/routing/dist/__tests__/captures.test.d.ts +1 -0
- package/node_modules/@next/routing/dist/__tests__/conditions.test.d.ts +1 -0
- package/node_modules/@next/routing/dist/__tests__/dynamic-after-rewrites.test.d.ts +1 -0
- package/node_modules/@next/routing/dist/__tests__/i18n-resolve-routes.test.d.ts +1 -0
- package/node_modules/@next/routing/dist/__tests__/i18n.test.d.ts +1 -0
- package/node_modules/@next/routing/dist/__tests__/middleware.test.d.ts +1 -0
- package/node_modules/@next/routing/dist/__tests__/normalize-next-data.test.d.ts +1 -0
- package/node_modules/@next/routing/dist/__tests__/redirects.test.d.ts +1 -0
- package/node_modules/@next/routing/dist/__tests__/resolve-routes.test.d.ts +1 -0
- package/node_modules/@next/routing/dist/__tests__/rewrites.test.d.ts +1 -0
- package/node_modules/@next/routing/dist/destination.d.ts +22 -0
- package/node_modules/@next/routing/dist/i18n.d.ts +48 -0
- package/node_modules/@next/routing/dist/index.d.ts +5 -0
- package/node_modules/@next/routing/dist/index.js +1 -0
- package/node_modules/@next/routing/dist/matchers.d.ts +12 -0
- package/node_modules/@next/routing/dist/middleware.d.ts +12 -0
- package/node_modules/@next/routing/dist/next-data.d.ts +10 -0
- package/node_modules/@next/routing/dist/resolve-routes.d.ts +2 -0
- package/node_modules/@next/routing/dist/types.d.ts +97 -0
- package/node_modules/@next/routing/package.json +39 -0
- package/node_modules/@swc/core/README.md +100 -0
- package/node_modules/@swc/core/Visitor.d.ts +218 -0
- package/node_modules/@swc/core/Visitor.js +1399 -0
- package/node_modules/@swc/core/binding.d.ts +59 -0
- package/node_modules/@swc/core/binding.js +368 -0
- package/node_modules/@swc/core/index.d.ts +120 -0
- package/node_modules/@swc/core/index.js +443 -0
- package/node_modules/@swc/core/package.json +120 -0
- package/node_modules/@swc/core/postinstall.js +148 -0
- package/node_modules/@swc/core/spack.d.ts +51 -0
- package/node_modules/@swc/core/spack.js +87 -0
- package/node_modules/@swc/core/util.d.ts +1 -0
- package/node_modules/@swc/core/util.js +104 -0
- package/node_modules/@swc/core-linux-x64-gnu/README.md +3 -0
- package/node_modules/@swc/core-linux-x64-gnu/package.json +46 -0
- package/node_modules/@swc/core-linux-x64-gnu/swc.linux-x64-gnu.node +0 -0
- package/node_modules/@swc/counter/CHANGELOG.md +7 -0
- package/node_modules/@swc/counter/README.md +7 -0
- package/node_modules/@swc/counter/index.js +1 -0
- package/node_modules/@swc/counter/package.json +27 -0
- package/node_modules/@swc/types/LICENSE +201 -0
- package/node_modules/@swc/types/README.md +4 -0
- package/node_modules/@swc/types/assumptions.d.ts +92 -0
- package/node_modules/@swc/types/assumptions.js +2 -0
- package/node_modules/@swc/types/index.d.ts +2049 -0
- package/node_modules/@swc/types/index.js +2 -0
- package/node_modules/@swc/types/package.json +40 -0
- package/package.json +7 -3
- package/lib/coverage/next-discovery.mjs +0 -205
- package/lib/coverage/next-static-analysis.mjs +0 -1047
|
@@ -0,0 +1,148 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
|
+
/**
|
|
36
|
+
* A postinstall script runs after `@swc/core` is installed.
|
|
37
|
+
*
|
|
38
|
+
* It checks if corresponding optional dependencies for native binary is installed and can be loaded properly.
|
|
39
|
+
* If it fails, it'll internally try to install `@swc/wasm` as fallback.
|
|
40
|
+
*/
|
|
41
|
+
const fs_1 = require("fs");
|
|
42
|
+
const assert = __importStar(require("assert"));
|
|
43
|
+
const path = __importStar(require("path"));
|
|
44
|
+
const child_process = __importStar(require("child_process"));
|
|
45
|
+
const fs = __importStar(require("fs"));
|
|
46
|
+
function removeRecursive(dir) {
|
|
47
|
+
for (const entry of fs.readdirSync(dir)) {
|
|
48
|
+
const entryPath = path.join(dir, entry);
|
|
49
|
+
let stats;
|
|
50
|
+
try {
|
|
51
|
+
stats = fs.lstatSync(entryPath);
|
|
52
|
+
}
|
|
53
|
+
catch (_a) {
|
|
54
|
+
continue; // Guard against https://github.com/nodejs/node/issues/4760
|
|
55
|
+
}
|
|
56
|
+
if (stats.isDirectory())
|
|
57
|
+
removeRecursive(entryPath);
|
|
58
|
+
else
|
|
59
|
+
fs.unlinkSync(entryPath);
|
|
60
|
+
}
|
|
61
|
+
fs.rmdirSync(dir);
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Trying to validate @swc/core's native binary installation, then installs if it is not supported.
|
|
65
|
+
*/
|
|
66
|
+
const validateBinary = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
67
|
+
var _a;
|
|
68
|
+
try {
|
|
69
|
+
const { name } = require(path.resolve(process.env.INIT_CWD, "package.json"));
|
|
70
|
+
if (name === "@swc/core" || name === "@swc/workspace") {
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
catch (_) {
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
// TODO: We do not take care of the case if user try to install with `--no-optional`.
|
|
78
|
+
// For now, it is considered as deliberate decision.
|
|
79
|
+
let binding;
|
|
80
|
+
try {
|
|
81
|
+
binding = require("./binding.js");
|
|
82
|
+
// Check if binding binary actually works.
|
|
83
|
+
// For the latest version, checks target triple. If it's old version doesn't have target triple, use parseSync instead.
|
|
84
|
+
const triple = binding.getTargetTriple
|
|
85
|
+
? binding.getTargetTriple()
|
|
86
|
+
: binding.parseSync("console.log()", Buffer.from(JSON.stringify({ syntax: "ecmascript" })));
|
|
87
|
+
assert.ok(triple, "Failed to read target triple from native binary.");
|
|
88
|
+
}
|
|
89
|
+
catch (error) {
|
|
90
|
+
// if error is unsupported architecture, ignore to display.
|
|
91
|
+
if (!((_a = error.message) === null || _a === void 0 ? void 0 : _a.includes("Unsupported architecture"))) {
|
|
92
|
+
console.warn(error);
|
|
93
|
+
}
|
|
94
|
+
console.warn(`@swc/core was not able to resolve native bindings installation. It'll try to use @swc/wasm as fallback instead.`);
|
|
95
|
+
}
|
|
96
|
+
if (!!binding) {
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
// User choose to override the binary installation. Skip remanining validation.
|
|
100
|
+
if (!!process.env["SWC_BINARY_PATH"]) {
|
|
101
|
+
console.warn(`@swc/core could not resolve native bindings installation, but found manual override config SWC_BINARY_PATH specified. Skipping remaning validation.`);
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
// Check if top-level package.json installs @swc/wasm separately already
|
|
105
|
+
let wasmBinding;
|
|
106
|
+
try {
|
|
107
|
+
wasmBinding = require.resolve(`@swc/wasm`);
|
|
108
|
+
}
|
|
109
|
+
catch (_) { }
|
|
110
|
+
if (!!wasmBinding && (0, fs_1.existsSync)(wasmBinding)) {
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
const env = Object.assign(Object.assign({}, process.env), { npm_config_global: undefined });
|
|
114
|
+
const { version } = require(path.join(path.dirname(require.resolve("@swc/core")), "package.json"));
|
|
115
|
+
// We want to place @swc/wasm next to the @swc/core as if normal installation was done,
|
|
116
|
+
// but can't directly set cwd to INIT_CWD as npm seems to acquire lock to the working dir.
|
|
117
|
+
// Instead, create a temporary inner and move it out.
|
|
118
|
+
const coreDir = path.dirname(require.resolve("@swc/core"));
|
|
119
|
+
const installDir = path.join(coreDir, "npm-install");
|
|
120
|
+
try {
|
|
121
|
+
fs.mkdirSync(installDir);
|
|
122
|
+
fs.writeFileSync(path.join(installDir, "package.json"), "{}");
|
|
123
|
+
// Instead of carrying over own dependencies to download & resolve package which increases installation sizes of `@swc/core`,
|
|
124
|
+
// assume & relies on system's npm installation.
|
|
125
|
+
child_process.execSync(`npm install --no-save --loglevel=error --prefer-offline --no-audit --progress=false @swc/wasm@${version}`, { cwd: installDir, stdio: "pipe", env });
|
|
126
|
+
const installedBinPath = path.join(installDir, "node_modules", `@swc/wasm`);
|
|
127
|
+
// INIT_CWD is injected via npm. If it doesn't exists, can't proceed.
|
|
128
|
+
fs.renameSync(installedBinPath, path.resolve(process.env.INIT_CWD, "node_modules", `@swc/wasm`));
|
|
129
|
+
}
|
|
130
|
+
catch (error) {
|
|
131
|
+
console.error(error);
|
|
132
|
+
console.error(`Failed to install fallback @swc/wasm@${version}. @swc/core will not properly.
|
|
133
|
+
Please install @swc/wasm manually, or retry whole installation.
|
|
134
|
+
If there are unexpected errors, please report at https://github.com/swc-project/swc/issues`);
|
|
135
|
+
}
|
|
136
|
+
finally {
|
|
137
|
+
try {
|
|
138
|
+
removeRecursive(installDir);
|
|
139
|
+
}
|
|
140
|
+
catch (_) {
|
|
141
|
+
// Gracefully ignore any failures. This'll make few leftover files but it shouldn't block installation.
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
validateBinary().catch((error) => {
|
|
146
|
+
// for now just throw the error as-is.
|
|
147
|
+
throw error;
|
|
148
|
+
});
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { Options } from "@swc/types";
|
|
2
|
+
export type BundleInput = BundleOptions | BundleOptions[];
|
|
3
|
+
export declare const isLocalFile: RegExp;
|
|
4
|
+
export declare function compileBundleOptions(config: BundleInput | string | undefined): Promise<BundleInput>;
|
|
5
|
+
/**
|
|
6
|
+
* Usage: In `spack.config.js` / `spack.config.ts`, you can utilize type annotations (to get autocompletions) like
|
|
7
|
+
*
|
|
8
|
+
* ```ts
|
|
9
|
+
* import { config } from '@swc/core/spack';
|
|
10
|
+
*
|
|
11
|
+
* export default config({
|
|
12
|
+
* name: 'web',
|
|
13
|
+
* });
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
*
|
|
17
|
+
*
|
|
18
|
+
*/
|
|
19
|
+
export declare function config(c: BundleInput): BundleInput;
|
|
20
|
+
export interface BundleOptions extends SpackConfig {
|
|
21
|
+
workingDir?: string;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* `spack.config,js`
|
|
25
|
+
*/
|
|
26
|
+
export interface SpackConfig {
|
|
27
|
+
/**
|
|
28
|
+
* @default process.env.NODE_ENV
|
|
29
|
+
*/
|
|
30
|
+
mode?: Mode;
|
|
31
|
+
target?: Target;
|
|
32
|
+
entry: EntryConfig;
|
|
33
|
+
output: OutputConfig;
|
|
34
|
+
module: ModuleConfig;
|
|
35
|
+
options?: Options;
|
|
36
|
+
/**
|
|
37
|
+
* Modules to exclude from bundle.
|
|
38
|
+
*/
|
|
39
|
+
externalModules?: string[];
|
|
40
|
+
}
|
|
41
|
+
export interface OutputConfig {
|
|
42
|
+
name: string;
|
|
43
|
+
path: string;
|
|
44
|
+
}
|
|
45
|
+
export interface ModuleConfig {
|
|
46
|
+
}
|
|
47
|
+
export type Mode = "production" | "development" | "none";
|
|
48
|
+
export type Target = "browser" | "node";
|
|
49
|
+
export type EntryConfig = string | string[] | {
|
|
50
|
+
[name: string]: string;
|
|
51
|
+
};
|
|
@@ -0,0 +1,87 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
|
+
exports.config = exports.compileBundleOptions = exports.isLocalFile = void 0;
|
|
36
|
+
const path = __importStar(require("path"));
|
|
37
|
+
exports.isLocalFile = /^\.{0,2}\//; // starts with '/' './' '../'
|
|
38
|
+
function compileBundleOptions(config) {
|
|
39
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
40
|
+
const f = config === undefined ? "." : config;
|
|
41
|
+
try {
|
|
42
|
+
const filepath = typeof f === "string" ? f : "spack.config.js";
|
|
43
|
+
const fileModule = exports.isLocalFile.test(filepath)
|
|
44
|
+
? path.resolve(filepath)
|
|
45
|
+
: filepath;
|
|
46
|
+
let configFromFile = require(fileModule);
|
|
47
|
+
if (configFromFile.default) {
|
|
48
|
+
configFromFile = configFromFile.default;
|
|
49
|
+
}
|
|
50
|
+
if (Array.isArray(configFromFile)) {
|
|
51
|
+
if (Array.isArray(f)) {
|
|
52
|
+
return [...configFromFile, ...f];
|
|
53
|
+
}
|
|
54
|
+
if (typeof f !== "string") {
|
|
55
|
+
configFromFile.push(f);
|
|
56
|
+
}
|
|
57
|
+
return configFromFile;
|
|
58
|
+
}
|
|
59
|
+
return Object.assign(Object.assign({}, configFromFile), (typeof config === "string" ? {} : config));
|
|
60
|
+
}
|
|
61
|
+
catch (e) {
|
|
62
|
+
if (typeof f === "string") {
|
|
63
|
+
throw new Error(`Error occurred while loading config file at ${config}: ${e}`);
|
|
64
|
+
}
|
|
65
|
+
return f;
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
exports.compileBundleOptions = compileBundleOptions;
|
|
70
|
+
/**
|
|
71
|
+
* Usage: In `spack.config.js` / `spack.config.ts`, you can utilize type annotations (to get autocompletions) like
|
|
72
|
+
*
|
|
73
|
+
* ```ts
|
|
74
|
+
* import { config } from '@swc/core/spack';
|
|
75
|
+
*
|
|
76
|
+
* export default config({
|
|
77
|
+
* name: 'web',
|
|
78
|
+
* });
|
|
79
|
+
* ```
|
|
80
|
+
*
|
|
81
|
+
*
|
|
82
|
+
*
|
|
83
|
+
*/
|
|
84
|
+
function config(c) {
|
|
85
|
+
return c;
|
|
86
|
+
}
|
|
87
|
+
exports.config = config;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function wrapNativeSuper(Class: any): never;
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.wrapNativeSuper = void 0;
|
|
4
|
+
//@ts-ignore
|
|
5
|
+
function wrapNativeSuper(Class) {
|
|
6
|
+
var _cache = typeof Map === "function" ? new Map() : undefined;
|
|
7
|
+
//@ts-ignore
|
|
8
|
+
exports.wrapNativeSuper = wrapNativeSuper = function wrapNativeSuper(Class) {
|
|
9
|
+
if (Class === null || !_isNativeFunction(Class))
|
|
10
|
+
return Class;
|
|
11
|
+
if (typeof Class !== "function") {
|
|
12
|
+
throw new TypeError("Super expression must either be null or a function");
|
|
13
|
+
}
|
|
14
|
+
if (typeof _cache !== "undefined") {
|
|
15
|
+
if (_cache.has(Class))
|
|
16
|
+
return _cache.get(Class);
|
|
17
|
+
_cache.set(Class, Wrapper);
|
|
18
|
+
}
|
|
19
|
+
function Wrapper() {
|
|
20
|
+
//@ts-ignore
|
|
21
|
+
return _construct(Class, arguments, _getPrototypeOf(this).constructor);
|
|
22
|
+
}
|
|
23
|
+
Wrapper.prototype = Object.create(Class.prototype, {
|
|
24
|
+
constructor: {
|
|
25
|
+
value: Wrapper,
|
|
26
|
+
enumerable: false,
|
|
27
|
+
writable: true,
|
|
28
|
+
configurable: true,
|
|
29
|
+
},
|
|
30
|
+
});
|
|
31
|
+
return _setPrototypeOf(Wrapper, Class);
|
|
32
|
+
};
|
|
33
|
+
return wrapNativeSuper(Class);
|
|
34
|
+
}
|
|
35
|
+
exports.wrapNativeSuper = wrapNativeSuper;
|
|
36
|
+
function isNativeReflectConstruct() {
|
|
37
|
+
if (typeof Reflect === "undefined" || !Reflect.construct)
|
|
38
|
+
return false;
|
|
39
|
+
//@ts-ignore
|
|
40
|
+
if (Reflect.construct.sham)
|
|
41
|
+
return false;
|
|
42
|
+
if (typeof Proxy === "function")
|
|
43
|
+
return true;
|
|
44
|
+
try {
|
|
45
|
+
Date.prototype.toString.call(Reflect.construct(Date, [], function () { }));
|
|
46
|
+
return true;
|
|
47
|
+
}
|
|
48
|
+
catch (e) {
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
//@ts-ignore
|
|
53
|
+
function _construct(Parent, args, Class) {
|
|
54
|
+
if (isNativeReflectConstruct()) {
|
|
55
|
+
//@ts-ignore
|
|
56
|
+
_construct = Reflect.construct;
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
//@ts-ignore
|
|
60
|
+
_construct = function _construct(Parent, args, Class) {
|
|
61
|
+
var a = [null];
|
|
62
|
+
a.push.apply(a, args);
|
|
63
|
+
//@ts-ignore
|
|
64
|
+
var Constructor = Function.bind.apply(Parent, a);
|
|
65
|
+
//@ts-ignore
|
|
66
|
+
var instance = new Constructor();
|
|
67
|
+
if (Class)
|
|
68
|
+
_setPrototypeOf(instance, Class.prototype);
|
|
69
|
+
return instance;
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
//@ts-ignore
|
|
73
|
+
return _construct.apply(null, arguments);
|
|
74
|
+
}
|
|
75
|
+
function _isNativeFunction(fn) {
|
|
76
|
+
return Function.toString.call(fn).indexOf("[native code]") !== -1;
|
|
77
|
+
}
|
|
78
|
+
//@ts-ignore
|
|
79
|
+
function _setPrototypeOf(o, p) {
|
|
80
|
+
//@ts-ignore
|
|
81
|
+
_setPrototypeOf =
|
|
82
|
+
Object.setPrototypeOf ||
|
|
83
|
+
//@ts-ignore
|
|
84
|
+
function _setPrototypeOf(o, p) {
|
|
85
|
+
o.__proto__ = p;
|
|
86
|
+
return o;
|
|
87
|
+
};
|
|
88
|
+
return _setPrototypeOf(o, p);
|
|
89
|
+
}
|
|
90
|
+
//@ts-ignore
|
|
91
|
+
function _getPrototypeOf(o) {
|
|
92
|
+
//@ts-ignore
|
|
93
|
+
_getPrototypeOf = Object.setPrototypeOf
|
|
94
|
+
? Object.getPrototypeOf
|
|
95
|
+
: function _getPrototypeOf(
|
|
96
|
+
//@ts-ignore
|
|
97
|
+
o) {
|
|
98
|
+
return o.__proto__ || Object.getPrototypeOf(o);
|
|
99
|
+
};
|
|
100
|
+
return _getPrototypeOf(o);
|
|
101
|
+
}
|
|
102
|
+
module.exports = {
|
|
103
|
+
wrapNativeSuper,
|
|
104
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@swc/core-linux-x64-gnu",
|
|
3
|
+
"version": "1.15.32",
|
|
4
|
+
"os": [
|
|
5
|
+
"linux"
|
|
6
|
+
],
|
|
7
|
+
"cpu": [
|
|
8
|
+
"x64"
|
|
9
|
+
],
|
|
10
|
+
"main": "swc.linux-x64-gnu.node",
|
|
11
|
+
"files": [
|
|
12
|
+
"swc.linux-x64-gnu.node",
|
|
13
|
+
"swc"
|
|
14
|
+
],
|
|
15
|
+
"libc": [
|
|
16
|
+
"glibc"
|
|
17
|
+
],
|
|
18
|
+
"description": "Super-fast alternative for babel",
|
|
19
|
+
"keywords": [
|
|
20
|
+
"swc",
|
|
21
|
+
"swcpack",
|
|
22
|
+
"babel",
|
|
23
|
+
"typescript",
|
|
24
|
+
"rust",
|
|
25
|
+
"webpack",
|
|
26
|
+
"tsc"
|
|
27
|
+
],
|
|
28
|
+
"author": "강동윤 <kdy1997.dev@gmail.com>",
|
|
29
|
+
"homepage": "https://swc.rs",
|
|
30
|
+
"license": "Apache-2.0 AND MIT",
|
|
31
|
+
"engines": {
|
|
32
|
+
"node": ">=10"
|
|
33
|
+
},
|
|
34
|
+
"publishConfig": {
|
|
35
|
+
"registry": "https://registry.npmjs.org/",
|
|
36
|
+
"access": "public",
|
|
37
|
+
"provenance": true
|
|
38
|
+
},
|
|
39
|
+
"repository": {
|
|
40
|
+
"type": "git",
|
|
41
|
+
"url": "git+https://github.com/swc-project/swc.git"
|
|
42
|
+
},
|
|
43
|
+
"bugs": {
|
|
44
|
+
"url": "https://github.com/swc-project/swc/issues"
|
|
45
|
+
}
|
|
46
|
+
}
|
|
Binary file
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# @swc/couter
|
|
2
|
+
|
|
3
|
+
Download counter for swc packages.
|
|
4
|
+
|
|
5
|
+
This package does not contain any code. It is used solely to track number of downloads of npm packages like `@swc/core` and `@next/swc`. If you are building a huge project using SWC, please consider depending on this package. It will not add any code to your bundle, but it will help us determine the number of users of SWC.
|
|
6
|
+
|
|
7
|
+
Counting is done by npm, just like other packages.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
console.log("download-counter/index.js");
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@swc/counter",
|
|
3
|
+
"packageManager": "pnpm@8.6.7",
|
|
4
|
+
"main": "index.js",
|
|
5
|
+
"version": "0.1.3",
|
|
6
|
+
"description": "Downloade counter for the swc project",
|
|
7
|
+
"sideEffects": false,
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/swc-project/pkgs.git"
|
|
11
|
+
},
|
|
12
|
+
"publishConfig": {
|
|
13
|
+
"registry": "https://registry.npmjs.org/",
|
|
14
|
+
"access": "public"
|
|
15
|
+
},
|
|
16
|
+
"keywords": [
|
|
17
|
+
"swc",
|
|
18
|
+
"download",
|
|
19
|
+
"counter"
|
|
20
|
+
],
|
|
21
|
+
"author": "강동윤 <kdy1997.dev@gmail.com>",
|
|
22
|
+
"license": "Apache-2.0",
|
|
23
|
+
"bugs": {
|
|
24
|
+
"url": "https://github.com/swc-project/swc/issues"
|
|
25
|
+
},
|
|
26
|
+
"homepage": "https://swc.rs"
|
|
27
|
+
}
|