rolldown 1.0.0-beta.1-commit.1d4a330 → 1.0.0-beta.1-commit.2fe52d4

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/dist/cjs/cli.cjs CHANGED
@@ -1,9 +1,10 @@
1
1
  "use strict";
2
2
  const require_chunk = require('../shared/chunk-qZFfknuJ.cjs');
3
- const require_src = require('../shared/src-B7GNdu2r.cjs');
4
- const require_consola_36c0034f = require('../shared/consola_36c0034f-CnRr1OYk.cjs');
5
- const node_fs = require_chunk.__toESM(require("node:fs"));
3
+ const require_src = require('../shared/src-Dck9jWki.cjs');
4
+ require('../shared/binding-Cw1COxB5.cjs');
5
+ const require_consola_36c0034f = require('../shared/consola_36c0034f-7VQAd79i.cjs');
6
6
  const node_path = require_chunk.__toESM(require("node:path"));
7
+ const node_fs = require_chunk.__toESM(require("node:fs"));
7
8
  const node_process = require_chunk.__toESM(require("node:process"));
8
9
  const node_perf_hooks = require_chunk.__toESM(require("node:perf_hooks"));
9
10
  const node_util = require_chunk.__toESM(require("node:util"));
@@ -374,19 +375,17 @@ async function bundleInner(config, cliOptions) {
374
375
  const configList = require_src.arraify(config);
375
376
  for (const config$1 of configList) {
376
377
  const outputList = require_src.arraify(config$1.output || {});
377
- for (const output of outputList) {
378
- const build = await require_src.rolldown({
379
- ...config$1,
380
- ...cliOptions.input
381
- });
382
- try {
383
- result.push(await build.write({
384
- ...output,
385
- ...cliOptions.output
386
- }));
387
- } finally {
388
- await build.close();
389
- }
378
+ const build = await require_src.rolldown({
379
+ ...config$1,
380
+ ...cliOptions.input
381
+ });
382
+ for (const output of outputList) try {
383
+ result.push(await build.write({
384
+ ...output,
385
+ ...cliOptions.output
386
+ }));
387
+ } finally {
388
+ await build.close();
390
389
  }
391
390
  }
392
391
  result.forEach(printBundleOutputPretty);
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  const require_chunk = require('../shared/chunk-qZFfknuJ.cjs');
3
- const require_src = require('../shared/src-B7GNdu2r.cjs');
3
+ const require_src = require('../shared/src-Dck9jWki.cjs');
4
+ const require_binding$1 = require('../shared/binding-Cw1COxB5.cjs');
4
5
  const node_url = require_chunk.__toESM(require("node:url"));
5
6
 
6
7
  //#region src/plugin/parallel-plugin.ts
@@ -54,7 +55,7 @@ function aliasPlugin(config) {
54
55
 
55
56
  //#endregion
56
57
  //#region src/experimental-index.ts
57
- var import_binding = require_chunk.__toESM(require_src.require_binding());
58
+ var import_binding = require_chunk.__toESM(require_binding$1.require_binding());
58
59
 
59
60
  //#endregion
60
61
  exports.aliasPlugin = aliasPlugin
@@ -1,4 +1,5 @@
1
- const require_src = require('../shared/src-B7GNdu2r.cjs');
1
+ const require_src = require('../shared/src-Dck9jWki.cjs');
2
+ require('../shared/binding-Cw1COxB5.cjs');
2
3
 
3
4
  exports.VERSION = require_src.VERSION
4
5
  exports.build = require_src.build
@@ -1,10 +1,11 @@
1
1
  "use strict";
2
2
  const require_chunk = require('../shared/chunk-qZFfknuJ.cjs');
3
- const require_src = require('../shared/src-B7GNdu2r.cjs');
3
+ const require_src = require('../shared/src-Dck9jWki.cjs');
4
+ const require_binding$1 = require('../shared/binding-Cw1COxB5.cjs');
4
5
  const node_worker_threads = require_chunk.__toESM(require("node:worker_threads"));
5
6
 
6
7
  //#region src/parallel-plugin-worker.ts
7
- var import_binding = require_chunk.__toESM(require_src.require_binding());
8
+ var import_binding = require_chunk.__toESM(require_binding$1.require_binding());
8
9
  const { registryId, pluginInfos, threadNumber } = node_worker_threads.workerData;
9
10
  (async () => {
10
11
  try {
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+ const require_chunk = require('../shared/chunk-qZFfknuJ.cjs');
3
+ const require_binding$1 = require('../shared/binding-Cw1COxB5.cjs');
4
+
5
+ //#region src/parse-ast-index.ts
6
+ var import_binding = require_chunk.__toESM(require_binding$1.require_binding());
7
+ function wrap(result, sourceText) {
8
+ let program, module$1, comments, errors, magicString;
9
+ return {
10
+ get program() {
11
+ if (!errors) errors = result.errors;
12
+ if (errors.length > 0) return normalizeParseError(sourceText, errors);
13
+ if (!program) program = JSON.parse(result.program);
14
+ return program;
15
+ },
16
+ get module() {
17
+ if (!module$1) module$1 = result.module;
18
+ return module$1;
19
+ },
20
+ get comments() {
21
+ if (!comments) comments = result.comments;
22
+ return comments;
23
+ },
24
+ get errors() {
25
+ if (!errors) errors = result.errors;
26
+ return errors;
27
+ },
28
+ get magicString() {
29
+ if (!magicString) magicString = result.magicString;
30
+ return magicString;
31
+ }
32
+ };
33
+ }
34
+ function normalizeParseError(sourceText, errors) {
35
+ let message = `Parse failed with ${errors.length} error${errors.length < 2 ? "" : "s"}:\n`;
36
+ for (let i = 0; i < errors.length; i++) {
37
+ if (i >= 5) {
38
+ message += "\n...";
39
+ break;
40
+ }
41
+ const e = errors[i];
42
+ message += e.message + "\n" + e.labels.map((label) => {
43
+ const location = require_binding$1.locate(sourceText, label.start, { offsetLine: 1 });
44
+ if (!location) return;
45
+ return require_binding$1.getCodeFrame(sourceText, location.line, location.column);
46
+ }).filter(Boolean).join("\n");
47
+ }
48
+ return require_binding$1.error(require_binding$1.logParseError(message));
49
+ }
50
+ function parseAst(filename, sourceText, options) {
51
+ return wrap((0, import_binding.parseSync)(filename, sourceText, options), sourceText);
52
+ }
53
+ async function parseAstAsync(filename, sourceText, options) {
54
+ return wrap(await (0, import_binding.parseAsync)(filename, sourceText, options), sourceText);
55
+ }
56
+
57
+ //#endregion
58
+ exports.parseAst = parseAst
59
+ exports.parseAstAsync = parseAstAsync
package/dist/esm/cli.mjs CHANGED
@@ -1,7 +1,8 @@
1
- import { arraify, colors, description, getInputCliKeys, getJsonSchema, getOutputCliKeys, rolldown, validateCliOptions, version, watch } from "../shared/src-BKtzXvhI.mjs";
2
- import { createConsola } from "../shared/consola_36c0034f-rAZL9aWp.mjs";
3
- import fs from "node:fs";
1
+ import "../shared/binding-BMSG-hw7.mjs";
2
+ import { arraify, colors, description, getInputCliKeys, getJsonSchema, getOutputCliKeys, rolldown, validateCliOptions, version, watch } from "../shared/src-genj5En-.mjs";
3
+ import { createConsola } from "../shared/consola_36c0034f-DJFB73x3.mjs";
4
4
  import path from "node:path";
5
+ import fs from "node:fs";
5
6
  import process$1, { cwd } from "node:process";
6
7
  import { performance } from "node:perf_hooks";
7
8
  import { parseArgs } from "node:util";
@@ -371,19 +372,17 @@ async function bundleInner(config, cliOptions) {
371
372
  const configList = arraify(config);
372
373
  for (const config$1 of configList) {
373
374
  const outputList = arraify(config$1.output || {});
374
- for (const output of outputList) {
375
- const build = await rolldown({
376
- ...config$1,
377
- ...cliOptions.input
378
- });
379
- try {
380
- result.push(await build.write({
381
- ...output,
382
- ...cliOptions.output
383
- }));
384
- } finally {
385
- await build.close();
386
- }
375
+ const build = await rolldown({
376
+ ...config$1,
377
+ ...cliOptions.input
378
+ });
379
+ for (const output of outputList) try {
380
+ result.push(await build.write({
381
+ ...output,
382
+ ...cliOptions.output
383
+ }));
384
+ } finally {
385
+ await build.close();
387
386
  }
388
387
  }
389
388
  result.forEach(printBundleOutputPretty);
@@ -1,4 +1,5 @@
1
- import { BuiltinPlugin, __toESM, buildImportAnalysisPlugin, composeJsPlugins, createBundler, dynamicImportVarsPlugin, handleOutputErrors, importGlobPlugin, jsonPlugin, loadFallbackPlugin, manifestPlugin, modulePreloadPolyfillPlugin, normalizedStringOrRegex, require_binding, viteResolvePlugin, wasmFallbackPlugin, wasmHelperPlugin } from "../shared/src-BKtzXvhI.mjs";
1
+ import { __toESM, require_binding } from "../shared/binding-BMSG-hw7.mjs";
2
+ import { BuiltinPlugin, buildImportAnalysisPlugin, composeJsPlugins, createBundler, dynamicImportVarsPlugin, handleOutputErrors, importGlobPlugin, jsonPlugin, loadFallbackPlugin, manifestPlugin, modulePreloadPolyfillPlugin, normalizedStringOrRegex, viteResolvePlugin, wasmFallbackPlugin, wasmHelperPlugin } from "../shared/src-genj5En-.mjs";
2
3
  import { pathToFileURL } from "node:url";
3
4
 
4
5
  //#region src/plugin/parallel-plugin.ts
@@ -1,3 +1,4 @@
1
- import { VERSION, build, defineConfig, rolldown, watch } from "../shared/src-BKtzXvhI.mjs";
1
+ import "../shared/binding-BMSG-hw7.mjs";
2
+ import { VERSION, build, defineConfig, rolldown, watch } from "../shared/src-genj5En-.mjs";
2
3
 
3
4
  export { VERSION, build, defineConfig, rolldown, watch };
@@ -1,4 +1,5 @@
1
- import { PluginContextData, __toESM, bindingifyPlugin, require_binding } from "../shared/src-BKtzXvhI.mjs";
1
+ import { __toESM, require_binding } from "../shared/binding-BMSG-hw7.mjs";
2
+ import { PluginContextData, bindingifyPlugin } from "../shared/src-genj5En-.mjs";
2
3
  import { parentPort, workerData } from "node:worker_threads";
3
4
 
4
5
  //#region src/parallel-plugin-worker.ts
@@ -0,0 +1,56 @@
1
+ import { __toESM, error, getCodeFrame, locate, logParseError, require_binding } from "../shared/binding-BMSG-hw7.mjs";
2
+
3
+ //#region src/parse-ast-index.ts
4
+ var import_binding = __toESM(require_binding());
5
+ function wrap(result, sourceText) {
6
+ let program, module, comments, errors, magicString;
7
+ return {
8
+ get program() {
9
+ if (!errors) errors = result.errors;
10
+ if (errors.length > 0) return normalizeParseError(sourceText, errors);
11
+ if (!program) program = JSON.parse(result.program);
12
+ return program;
13
+ },
14
+ get module() {
15
+ if (!module) module = result.module;
16
+ return module;
17
+ },
18
+ get comments() {
19
+ if (!comments) comments = result.comments;
20
+ return comments;
21
+ },
22
+ get errors() {
23
+ if (!errors) errors = result.errors;
24
+ return errors;
25
+ },
26
+ get magicString() {
27
+ if (!magicString) magicString = result.magicString;
28
+ return magicString;
29
+ }
30
+ };
31
+ }
32
+ function normalizeParseError(sourceText, errors) {
33
+ let message = `Parse failed with ${errors.length} error${errors.length < 2 ? "" : "s"}:\n`;
34
+ for (let i = 0; i < errors.length; i++) {
35
+ if (i >= 5) {
36
+ message += "\n...";
37
+ break;
38
+ }
39
+ const e = errors[i];
40
+ message += e.message + "\n" + e.labels.map((label) => {
41
+ const location = locate(sourceText, label.start, { offsetLine: 1 });
42
+ if (!location) return;
43
+ return getCodeFrame(sourceText, location.line, location.column);
44
+ }).filter(Boolean).join("\n");
45
+ }
46
+ return error(logParseError(message));
47
+ }
48
+ function parseAst(filename, sourceText, options) {
49
+ return wrap((0, import_binding.parseSync)(filename, sourceText, options), sourceText);
50
+ }
51
+ async function parseAstAsync(filename, sourceText, options) {
52
+ return wrap(await (0, import_binding.parseAsync)(filename, sourceText, options), sourceText);
53
+ }
54
+
55
+ //#endregion
56
+ export { parseAst, parseAstAsync };