rolldown 1.0.0-beta.9-commit.0ec9e7d → 1.0.0-rc.1
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/README.md +11 -0
- package/bin/cli.mjs +1 -0
- package/dist/cli-setup.mjs +17 -0
- package/dist/cli.mjs +1085 -1281
- package/dist/config.d.mts +2 -4
- package/dist/config.mjs +8 -5
- package/dist/experimental-index.d.mts +161 -76
- package/dist/experimental-index.mjs +227 -61
- package/dist/experimental-runtime-types.d.ts +98 -0
- package/dist/filter-index.d.mts +196 -4
- package/dist/filter-index.mjs +328 -4
- package/dist/get-log-filter.d.mts +7 -0
- package/dist/get-log-filter.mjs +48 -0
- package/dist/index.d.mts +4 -4
- package/dist/index.mjs +56 -5
- package/dist/parallel-plugin-worker.mjs +27 -33
- package/dist/parallel-plugin.d.mts +7 -8
- package/dist/parse-ast-index.d.mts +4 -5
- package/dist/parse-ast-index.mjs +2 -2
- package/dist/plugins-index.d.mts +30 -0
- package/dist/plugins-index.mjs +40 -0
- package/dist/shared/binding-B92Lq__Q.d.mts +1687 -0
- package/dist/shared/binding-C-UNREnT.mjs +585 -0
- package/dist/shared/bindingify-input-options-Cb-01HR1.mjs +2233 -0
- package/dist/shared/constructors-D_KFsTQ-.d.mts +28 -0
- package/dist/shared/constructors-aZ82R2dj.mjs +61 -0
- package/dist/shared/define-config-BVG4QvnP.mjs +7 -0
- package/dist/shared/define-config-DO4TBkJV.d.mts +3457 -0
- package/dist/shared/{load-config-Dll-92l5.mjs → load-config-D6cey0o1.mjs} +23 -33
- package/dist/shared/logging-wIy4zY9I.d.mts +50 -0
- package/dist/shared/logs-NH298mHo.mjs +183 -0
- package/dist/shared/{misc-DGAe2XOW.mjs → misc-CCZIsXVO.mjs} +1 -7
- package/dist/shared/normalize-string-or-regex-Dq50a7l9.mjs +61 -0
- package/dist/shared/parse-ast-index-B6LAhWD8.mjs +99 -0
- package/dist/shared/{prompt-CxjDC0Gn.cjs → prompt-tlfjalEt.mjs} +301 -308
- package/dist/shared/rolldown-CIC_OHw3.mjs +42 -0
- package/dist/shared/rolldown-build-KB1YaNe-.mjs +2369 -0
- package/dist/shared/watch-B2WRkpw2.mjs +379 -0
- package/package.json +86 -98
- package/dist/cli.cjs +0 -1748
- package/dist/config.cjs +0 -12
- package/dist/config.d.cts +0 -12
- package/dist/experimental-index.cjs +0 -132
- package/dist/experimental-index.d.cts +0 -96
- package/dist/filter-index.cjs +0 -105
- package/dist/filter-index.d.cts +0 -5
- package/dist/index.cjs +0 -9
- package/dist/index.d.cts +0 -4
- package/dist/parallel-plugin-worker.cjs +0 -33
- package/dist/parallel-plugin-worker.d.cts +0 -1
- package/dist/parallel-plugin.cjs +0 -8
- package/dist/parallel-plugin.d.cts +0 -15
- package/dist/parse-ast-index.cjs +0 -4
- package/dist/parse-ast-index.d.cts +0 -9
- package/dist/shared/binding.d-Dz3qQrbl.d.mts +0 -1682
- package/dist/shared/binding.d-QXzDcVmm.d.cts +0 -1682
- package/dist/shared/chunk--iN_1bjD.mjs +0 -33
- package/dist/shared/chunk-DDkG_k5U.cjs +0 -39
- package/dist/shared/define-config.d-CUcDq_vm.d.cts +0 -1080
- package/dist/shared/define-config.d-qV1PzX_C.d.mts +0 -1080
- package/dist/shared/load-config-Bx9W9x2a.cjs +0 -125
- package/dist/shared/misc-BKp5iIef.cjs +0 -67
- package/dist/shared/parse-ast-index-0m6JgGc9.mjs +0 -655
- package/dist/shared/parse-ast-index-Cn_efzjO.cjs +0 -697
- package/dist/shared/prompt-uGrwvyp0.mjs +0 -854
- package/dist/shared/src-B4EklR3U.mjs +0 -4704
- package/dist/shared/src-BzFe16tX.cjs +0 -4654
- /package/dist/{cli.d.cts → cli-setup.d.mts} +0 -0
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
const require_chunk = require('./chunk-DDkG_k5U.cjs');
|
|
2
|
-
const require_src = require('./src-BzFe16tX.cjs');
|
|
3
|
-
const node_fs = require_chunk.__toESM(require("node:fs"));
|
|
4
|
-
const node_path = require_chunk.__toESM(require("node:path"));
|
|
5
|
-
const node_url = require_chunk.__toESM(require("node:url"));
|
|
6
|
-
const node_process = require_chunk.__toESM(require("node:process"));
|
|
7
|
-
const node_fs_promises = require_chunk.__toESM(require("node:fs/promises"));
|
|
8
|
-
|
|
9
|
-
//#region src/utils/load-config.ts
|
|
10
|
-
async function bundleTsConfig(configFile, isEsm) {
|
|
11
|
-
const dirnameVarName = "injected_original_dirname";
|
|
12
|
-
const filenameVarName = "injected_original_filename";
|
|
13
|
-
const importMetaUrlVarName = "injected_original_import_meta_url";
|
|
14
|
-
const bundle = await require_src.rolldown({
|
|
15
|
-
input: configFile,
|
|
16
|
-
platform: "node",
|
|
17
|
-
resolve: { mainFields: ["main"] },
|
|
18
|
-
define: {
|
|
19
|
-
__dirname: dirnameVarName,
|
|
20
|
-
__filename: filenameVarName,
|
|
21
|
-
"import.meta.url": importMetaUrlVarName,
|
|
22
|
-
"import.meta.dirname": dirnameVarName,
|
|
23
|
-
"import.meta.filename": filenameVarName
|
|
24
|
-
},
|
|
25
|
-
treeshake: false,
|
|
26
|
-
external: [/^[\w@][^:]/],
|
|
27
|
-
plugins: [{
|
|
28
|
-
name: "inject-file-scope-variables",
|
|
29
|
-
transform: {
|
|
30
|
-
filter: { id: /\.[cm]?[jt]s$/ },
|
|
31
|
-
async handler(code, id) {
|
|
32
|
-
const injectValues = `const ${dirnameVarName} = ${JSON.stringify(node_path.default.dirname(id))};const ${filenameVarName} = ${JSON.stringify(id)};const ${importMetaUrlVarName} = ${JSON.stringify((0, node_url.pathToFileURL)(id).href)};`;
|
|
33
|
-
return {
|
|
34
|
-
code: injectValues + code,
|
|
35
|
-
map: null
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
}]
|
|
40
|
-
});
|
|
41
|
-
const outputDir = node_path.default.dirname(configFile);
|
|
42
|
-
const result = await bundle.write({
|
|
43
|
-
dir: outputDir,
|
|
44
|
-
format: isEsm ? "esm" : "cjs",
|
|
45
|
-
sourcemap: "inline",
|
|
46
|
-
entryFileNames: `rolldown.config.[hash]${node_path.default.extname(configFile).replace("ts", "js")}`
|
|
47
|
-
});
|
|
48
|
-
const fileName = result.output.find((chunk) => chunk.type === "chunk" && chunk.isEntry).fileName;
|
|
49
|
-
return node_path.default.join(outputDir, fileName);
|
|
50
|
-
}
|
|
51
|
-
const SUPPORTED_JS_CONFIG_FORMATS = [
|
|
52
|
-
".js",
|
|
53
|
-
".mjs",
|
|
54
|
-
".cjs"
|
|
55
|
-
];
|
|
56
|
-
const SUPPORTED_TS_CONFIG_FORMATS = [
|
|
57
|
-
".ts",
|
|
58
|
-
".mts",
|
|
59
|
-
".cts"
|
|
60
|
-
];
|
|
61
|
-
const SUPPORTED_CONFIG_FORMATS = [...SUPPORTED_JS_CONFIG_FORMATS, ...SUPPORTED_TS_CONFIG_FORMATS];
|
|
62
|
-
const DEFAULT_CONFIG_BASE = "rolldown.config";
|
|
63
|
-
async function findConfigFileNameInCwd() {
|
|
64
|
-
const filesInWorkingDirectory = new Set(await (0, node_fs_promises.readdir)((0, node_process.cwd)()));
|
|
65
|
-
for (const extension of SUPPORTED_CONFIG_FORMATS) {
|
|
66
|
-
const fileName = `${DEFAULT_CONFIG_BASE}${extension}`;
|
|
67
|
-
if (filesInWorkingDirectory.has(fileName)) return fileName;
|
|
68
|
-
}
|
|
69
|
-
throw new Error("No `rolldown.config` configuration file found.");
|
|
70
|
-
}
|
|
71
|
-
async function loadTsConfig(configFile) {
|
|
72
|
-
const isEsm = isFilePathESM(configFile);
|
|
73
|
-
const file = await bundleTsConfig(configFile, isEsm);
|
|
74
|
-
try {
|
|
75
|
-
return (await import((0, node_url.pathToFileURL)(file).href)).default;
|
|
76
|
-
} finally {
|
|
77
|
-
node_fs.default.unlink(file, () => {});
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
function isFilePathESM(filePath) {
|
|
81
|
-
if (/\.m[jt]s$/.test(filePath)) return true;
|
|
82
|
-
else if (/\.c[jt]s$/.test(filePath)) return false;
|
|
83
|
-
else {
|
|
84
|
-
const pkg = findNearestPackageData(node_path.default.dirname(filePath));
|
|
85
|
-
if (pkg) return pkg.type === "module";
|
|
86
|
-
return false;
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
function findNearestPackageData(basedir) {
|
|
90
|
-
while (basedir) {
|
|
91
|
-
const pkgPath = node_path.default.join(basedir, "package.json");
|
|
92
|
-
if (tryStatSync(pkgPath)?.isFile()) try {
|
|
93
|
-
return JSON.parse(node_fs.default.readFileSync(pkgPath, "utf-8"));
|
|
94
|
-
} catch {}
|
|
95
|
-
const nextBasedir = node_path.default.dirname(basedir);
|
|
96
|
-
if (nextBasedir === basedir) break;
|
|
97
|
-
basedir = nextBasedir;
|
|
98
|
-
}
|
|
99
|
-
return null;
|
|
100
|
-
}
|
|
101
|
-
function tryStatSync(file) {
|
|
102
|
-
try {
|
|
103
|
-
return node_fs.default.statSync(file, { throwIfNoEntry: false });
|
|
104
|
-
} catch {}
|
|
105
|
-
}
|
|
106
|
-
async function loadConfig(configPath) {
|
|
107
|
-
const ext = node_path.default.extname(configPath = configPath || await findConfigFileNameInCwd());
|
|
108
|
-
try {
|
|
109
|
-
if (SUPPORTED_JS_CONFIG_FORMATS.includes(ext) || process.env.NODE_OPTIONS?.includes("--import=tsx") && SUPPORTED_TS_CONFIG_FORMATS.includes(ext)) return (await import((0, node_url.pathToFileURL)(configPath).href)).default;
|
|
110
|
-
else if (SUPPORTED_TS_CONFIG_FORMATS.includes(ext)) {
|
|
111
|
-
const rawConfigPath = node_path.default.resolve(configPath);
|
|
112
|
-
return await loadTsConfig(rawConfigPath);
|
|
113
|
-
} else throw new Error(`Unsupported config format. Expected: \`${SUPPORTED_CONFIG_FORMATS.join(",")}\` but got \`${ext}\``);
|
|
114
|
-
} catch (err) {
|
|
115
|
-
throw new Error("Error happened while loading config.", { cause: err });
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
//#endregion
|
|
120
|
-
Object.defineProperty(exports, 'loadConfig', {
|
|
121
|
-
enumerable: true,
|
|
122
|
-
get: function () {
|
|
123
|
-
return loadConfig;
|
|
124
|
-
}
|
|
125
|
-
});
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
//#region src/utils/misc.ts
|
|
3
|
-
function arraify(value) {
|
|
4
|
-
return Array.isArray(value) ? value : [value];
|
|
5
|
-
}
|
|
6
|
-
function isNullish(value) {
|
|
7
|
-
return value === null || value === void 0;
|
|
8
|
-
}
|
|
9
|
-
function isPromiseLike(value) {
|
|
10
|
-
return value && (typeof value === "object" || typeof value === "function") && typeof value.then === "function";
|
|
11
|
-
}
|
|
12
|
-
function unimplemented(info) {
|
|
13
|
-
if (info) throw new Error(`unimplemented: ${info}`);
|
|
14
|
-
throw new Error("unimplemented");
|
|
15
|
-
}
|
|
16
|
-
function unreachable(info) {
|
|
17
|
-
if (info) throw new Error(`unreachable: ${info}`);
|
|
18
|
-
throw new Error("unreachable");
|
|
19
|
-
}
|
|
20
|
-
function unsupported(info) {
|
|
21
|
-
throw new Error(`UNSUPPORTED: ${info}`);
|
|
22
|
-
}
|
|
23
|
-
function noop(..._args) {}
|
|
24
|
-
|
|
25
|
-
//#endregion
|
|
26
|
-
Object.defineProperty(exports, 'arraify', {
|
|
27
|
-
enumerable: true,
|
|
28
|
-
get: function () {
|
|
29
|
-
return arraify;
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
|
-
Object.defineProperty(exports, 'isNullish', {
|
|
33
|
-
enumerable: true,
|
|
34
|
-
get: function () {
|
|
35
|
-
return isNullish;
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
Object.defineProperty(exports, 'isPromiseLike', {
|
|
39
|
-
enumerable: true,
|
|
40
|
-
get: function () {
|
|
41
|
-
return isPromiseLike;
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
Object.defineProperty(exports, 'noop', {
|
|
45
|
-
enumerable: true,
|
|
46
|
-
get: function () {
|
|
47
|
-
return noop;
|
|
48
|
-
}
|
|
49
|
-
});
|
|
50
|
-
Object.defineProperty(exports, 'unimplemented', {
|
|
51
|
-
enumerable: true,
|
|
52
|
-
get: function () {
|
|
53
|
-
return unimplemented;
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
|
-
Object.defineProperty(exports, 'unreachable', {
|
|
57
|
-
enumerable: true,
|
|
58
|
-
get: function () {
|
|
59
|
-
return unreachable;
|
|
60
|
-
}
|
|
61
|
-
});
|
|
62
|
-
Object.defineProperty(exports, 'unsupported', {
|
|
63
|
-
enumerable: true,
|
|
64
|
-
get: function () {
|
|
65
|
-
return unsupported;
|
|
66
|
-
}
|
|
67
|
-
});
|