rollup 4.0.0-2 → 4.0.0-20

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.
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v4.0.0-2
4
- Tue, 01 Aug 2023 11:16:13 GMT - commit d62558dbc45912c9c4478dc761bb290738c3b968
3
+ Rollup.js v4.0.0-20
4
+ Sun, 24 Sep 2023 06:09:55 GMT - commit 9d6dc574c6dca3d85e9eda512b09797a6d15462f
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -30,7 +30,7 @@ require('node:path');
30
30
  require('tty');
31
31
  require('node:perf_hooks');
32
32
  require('node:crypto');
33
- require('../native');
33
+ require('../native.js');
34
34
  require('node:url');
35
35
  require('../getLogFilter.js');
36
36
 
@@ -110,7 +110,6 @@ if (process.platform !== 'win32') {
110
110
  if (process.platform === 'linux') {
111
111
  signals.push('SIGIO', 'SIGPOLL', 'SIGPWR', 'SIGSTKFLT');
112
112
  }
113
- //# sourceMappingURL=signals.js.map
114
113
 
115
114
  // Note: since nyc uses this module to output coverage, any lines
116
115
  // that are in the direct sync flow of nyc's outputCoverage are
@@ -128,7 +127,7 @@ const processOk = (process) => !!process &&
128
127
  const kExitEmitter = Symbol.for('signal-exit emitter');
129
128
  const global = globalThis;
130
129
  const ObjectDefineProperty = Object.defineProperty.bind(Object);
131
- // teeny tiny ee
130
+ // teeny special purpose ee
132
131
  class Emitter {
133
132
  emitted = {
134
133
  afterExit: false,
@@ -171,12 +170,17 @@ class Emitter {
171
170
  }
172
171
  emit(ev, code, signal) {
173
172
  if (this.emitted[ev]) {
174
- return;
173
+ return false;
175
174
  }
176
175
  this.emitted[ev] = true;
176
+ let ret = false;
177
177
  for (const fn of this.listeners[ev]) {
178
- fn(code, signal);
178
+ ret = fn(code, signal) === true || ret;
179
+ }
180
+ if (ev === 'exit') {
181
+ ret = this.emit('afterExit', code, signal) || ret;
179
182
  }
183
+ return ret;
180
184
  }
181
185
  }
182
186
  class SignalExitBase {
@@ -230,18 +234,22 @@ class SignalExit extends SignalExitBase {
230
234
  // exit v4 are not aware of each other, and each will attempt to let
231
235
  // the other handle it, so neither of them do. To correct this, we
232
236
  // detect if we're the only handler *except* for previous versions
233
- // of signal-exit.
237
+ // of signal-exit, and increment by the count of listeners it has
238
+ // created.
234
239
  /* c8 ignore start */
235
- //@ts-ignore
236
- if (typeof process.__signal_exit_emitter__ === 'object')
237
- count++;
240
+ const p = process;
241
+ if (typeof p.__signal_exit_emitter__ === 'object' &&
242
+ typeof p.__signal_exit_emitter__.count === 'number') {
243
+ count += p.__signal_exit_emitter__.count;
244
+ }
238
245
  /* c8 ignore stop */
239
246
  if (listeners.length === count) {
240
247
  this.unload();
241
- this.#emitter.emit('exit', null, sig);
242
- this.#emitter.emit('afterExit', null, sig);
248
+ const ret = this.#emitter.emit('exit', null, sig);
243
249
  /* c8 ignore start */
244
- process.kill(process.pid, sig === 'SIGHUP' ? this.#hupSig : sig);
250
+ const s = sig === 'SIGHUP' ? this.#hupSig : sig;
251
+ if (!ret)
252
+ process.kill(process.pid, s);
245
253
  /* c8 ignore stop */
246
254
  }
247
255
  };
@@ -324,7 +332,6 @@ class SignalExit extends SignalExitBase {
324
332
  this.#process.exitCode = code || 0;
325
333
  /* c8 ignore stop */
326
334
  this.#emitter.emit('exit', this.#process.exitCode, null);
327
- this.#emitter.emit('afterExit', this.#process.exitCode, null);
328
335
  return this.#originalProcessReallyExit.call(this.#process, this.#process.exitCode);
329
336
  }
330
337
  #processEmit(ev, ...args) {
@@ -338,7 +345,6 @@ class SignalExit extends SignalExitBase {
338
345
  const ret = og.call(this.#process, ev, ...args);
339
346
  /* c8 ignore start */
340
347
  this.#emitter.emit('exit', this.#process.exitCode, null);
341
- this.#emitter.emit('afterExit', this.#process.exitCode, null);
342
348
  /* c8 ignore stop */
343
349
  return ret;
344
350
  }
@@ -377,7 +383,6 @@ load,
377
383
  * @internal
378
384
  */
379
385
  unload, } = signalExitWrap(processOk(process$1) ? new SignalExit(process$1) : new SignalExitFallback());
380
- //# sourceMappingURL=index.js.map
381
386
 
382
387
  const CLEAR_SCREEN = '\u001Bc';
383
388
  function getResetScreen(configs, allowClearScreen) {
@@ -398,7 +403,6 @@ function getResetScreen(configs, allowClearScreen) {
398
403
  }
399
404
  };
400
405
  }
401
- //# sourceMappingURL=resetScreen.js.map
402
406
 
403
407
  function extractWatchHooks(command) {
404
408
  if (!Array.isArray(command.watch))
@@ -426,7 +430,6 @@ function createWatchHooks(command) {
426
430
  }
427
431
  };
428
432
  }
429
- //# sourceMappingURL=watchHooks.js.map
430
433
 
431
434
  async function watch(command) {
432
435
  process$2.env.ROLLUP_WATCH = 'true';
@@ -554,7 +557,6 @@ function closeWithError(error) {
554
557
  error.name = `Uncaught ${error.name}`;
555
558
  rollup.handleError(error);
556
559
  }
557
- //# sourceMappingURL=watch-cli.js.map
558
560
 
559
561
  exports.watch = watch;
560
562
  //# sourceMappingURL=watch-cli.js.map
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v4.0.0-2
4
- Tue, 01 Aug 2023 11:16:13 GMT - commit d62558dbc45912c9c4478dc761bb290738c3b968
3
+ Rollup.js v4.0.0-20
4
+ Sun, 24 Sep 2023 06:09:55 GMT - commit 9d6dc574c6dca3d85e9eda512b09797a6d15462f
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -64,7 +64,6 @@ class WatchEmitter {
64
64
  return this.persistentHandlers[event] || (this.persistentHandlers[event] = []);
65
65
  }
66
66
  }
67
- //# sourceMappingURL=WatchEmitter.js.map
68
67
 
69
68
  function watch(configs) {
70
69
  const emitter = new WatchEmitter();
@@ -83,7 +82,6 @@ async function watchInternal(configs, emitter) {
83
82
  const { Watcher } = await Promise.resolve().then(() => require('./watch.js'));
84
83
  new Watcher(watchOptionsList, emitter);
85
84
  }
86
- //# sourceMappingURL=watch-proxy.js.map
87
85
 
88
86
  exports.watch = watch;
89
87
  //# sourceMappingURL=watch-proxy.js.map
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v4.0.0-2
4
- Tue, 01 Aug 2023 11:16:13 GMT - commit d62558dbc45912c9c4478dc761bb290738c3b968
3
+ Rollup.js v4.0.0-20
4
+ Sun, 24 Sep 2023 06:09:55 GMT - commit 9d6dc574c6dca3d85e9eda512b09797a6d15462f
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -20,7 +20,7 @@ require('tty');
20
20
  require('path');
21
21
  require('node:perf_hooks');
22
22
  require('node:crypto');
23
- require('../native');
23
+ require('../native.js');
24
24
  require('node:fs/promises');
25
25
  require('fs');
26
26
  require('util');
@@ -83,7 +83,6 @@ class FileWatcher {
83
83
  return watcher;
84
84
  }
85
85
  }
86
- //# sourceMappingURL=fileWatcher.js.map
87
86
 
88
87
  const eventsRewrites = {
89
88
  create: {
@@ -312,7 +311,6 @@ class Task {
312
311
  this.fileWatcher.watch(id, isTransformDependency);
313
312
  }
314
313
  }
315
- //# sourceMappingURL=watch.js.map
316
314
 
317
315
  exports.Task = Task;
318
316
  exports.Watcher = Watcher;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rollup",
3
- "version": "4.0.0-2",
3
+ "version": "4.0.0-20",
4
4
  "description": "Next-generation ES module bundler",
5
5
  "main": "dist/rollup.js",
6
6
  "module": "dist/es/rollup.js",
@@ -31,11 +31,15 @@
31
31
  }
32
32
  },
33
33
  "scripts": {
34
- "build": "concurrently -c green,blue 'npm run build:napi -- --release' 'npm:build:js' && npm run build:copy-native",
34
+ "build": "npm run build:wasm && concurrently -c green,blue \"npm run build:napi -- --release\" \"npm:build:js\" && npm run build:copy-native",
35
35
  "build:quick": "concurrently -c green,blue 'npm:build:napi' 'npm:build:cjs' && npm run build:copy-native",
36
36
  "build:napi": "napi build --platform --dts native.d.ts --js native.js --cargo-cwd rust -p bindings_napi --cargo-name bindings_napi",
37
+ "build:wasm": "wasm-pack build rust/bindings_wasm --out-dir ../../wasm --target web --no-pack && shx rm wasm/.gitignore",
38
+ "build:wasm:node": "wasm-pack build rust/bindings_wasm --out-dir ../../wasm-node --target nodejs --no-pack && shx rm wasm-node/.gitignore",
37
39
  "update:napi": "npm run build:napi && npm run build:copy-native",
38
40
  "build:js": "rollup --config rollup.config.ts --configPlugin typescript",
41
+ "build:js:node": "rollup --config rollup.config.ts --configPlugin typescript --configIsBuildNode",
42
+ "build:prepare": "concurrently -c green,blue \"npm run build:napi -- --release\" \"npm:build:js:node\" && npm run build:copy-native",
39
43
  "update:js": "npm run build:js && npm run build:copy-native",
40
44
  "build:copy-native": "shx mkdir -p dist && shx cp rollup.*.node dist/",
41
45
  "dev": "vitepress dev docs",
@@ -46,7 +50,7 @@
46
50
  "ci:artifacts": "napi artifacts",
47
51
  "ci:lint": "concurrently -c red,green,blue 'npm:lint:js:nofix' 'npm:lint:markdown:nofix' 'npm:lint:rust:nofix'",
48
52
  "ci:test:only": "npm run build:cjs && npm run build:copy-native && npm run build:bootstrap && npm run build:copy-native && npm run test:only",
49
- "ci:test:all": "npm run build:cjs && npm run build:copy-native && npm run build:bootstrap && npm run build:copy-native && concurrently --kill-others-on-fail -c green,blue,magenta 'npm:test:only' 'npm:test:typescript' 'npm:test:leak'",
53
+ "ci:test:all": "npm run build:cjs && npm run build:copy-native && npm run build:bootstrap && npm run build:copy-native && concurrently --kill-others-on-fail -c green,blue,magenta,cyan 'npm:test:only' 'npm:test:typescript' 'npm:test:leak' 'npm:test:browser'",
50
54
  "ci:coverage": "npm run build:cjs && npm run build:copy-native && npm run build:bootstrap && npm run build:copy-native && nyc --reporter lcovonly mocha",
51
55
  "lint": "concurrently -c red,green,blue 'npm:lint:js' 'npm:lint:markdown' 'npm:lint:rust'",
52
56
  "lint:js": "eslint . --fix --cache",
@@ -57,10 +61,11 @@
57
61
  "lint:rust:nofix": "cd rust && cargo fmt --check",
58
62
  "perf": "npm run build:cjs && node --expose-gc scripts/perf.js",
59
63
  "perf:init": "node scripts/perf-init.js",
60
- "prepare": "husky install && node scripts/check-release.js || npm run build",
64
+ "prepare": "husky install && node scripts/check-release.js || npm run build:prepare",
61
65
  "prepublishOnly": "node scripts/check-release.js && node scripts/prepublish.js",
66
+ "postpublish": "node scripts/postpublish.js",
62
67
  "prepublish:napi": "napi prepublish --skip-gh-release",
63
- "release": "node scripts/release.js",
68
+ "release": "node scripts/prepare-release.js",
64
69
  "release:docs": "git fetch --update-head-ok origin master:master && git branch --force documentation-published master && git push origin documentation-published",
65
70
  "test": "npm run build && npm run test:all",
66
71
  "test:update-snapshots": "node scripts/update-snapshots.js",
@@ -93,98 +98,100 @@
93
98
  "homepage": "https://rollupjs.org/",
94
99
  "optionalDependencies": {
95
100
  "fsevents": "~2.3.2",
96
- "@rollup/rollup-darwin-arm64": "4.0.0-2",
97
- "@rollup/rollup-android-arm64": "4.0.0-2",
98
- "@rollup/rollup-win32-arm64-msvc": "4.0.0-2",
99
- "@rollup/rollup-linux-arm64-gnu": "4.0.0-2",
100
- "@rollup/rollup-android-arm-eabi": "4.0.0-2",
101
- "@rollup/rollup-linux-arm-gnueabihf": "4.0.0-2",
102
- "@rollup/rollup-win32-ia32-msvc": "4.0.0-2",
103
- "@rollup/rollup-darwin-x64": "4.0.0-2",
104
- "@rollup/rollup-win32-x64-msvc": "4.0.0-2",
105
- "@rollup/rollup-linux-x64-gnu": "4.0.0-2",
106
- "@rollup/rollup-linux-x64-musl": "4.0.0-2"
101
+ "@rollup/rollup-darwin-arm64": "4.0.0-20",
102
+ "@rollup/rollup-android-arm64": "4.0.0-20",
103
+ "@rollup/rollup-win32-arm64-msvc": "4.0.0-20",
104
+ "@rollup/rollup-linux-arm64-gnu": "4.0.0-20",
105
+ "@rollup/rollup-android-arm-eabi": "4.0.0-20",
106
+ "@rollup/rollup-linux-arm-gnueabihf": "4.0.0-20",
107
+ "@rollup/rollup-win32-ia32-msvc": "4.0.0-20",
108
+ "@rollup/rollup-darwin-x64": "4.0.0-20",
109
+ "@rollup/rollup-win32-x64-msvc": "4.0.0-20",
110
+ "@rollup/rollup-linux-x64-gnu": "4.0.0-20",
111
+ "@rollup/rollup-linux-x64-musl": "4.0.0-20"
112
+ },
113
+ "devDependenciesComments": {
114
+ "@rollup/plugin-typescript": "It appears that 11.1.3 breaks sourcemaps"
107
115
  },
108
116
  "devDependencies": {
109
- "@codemirror/commands": "^6.2.4",
110
- "@codemirror/lang-javascript": "^6.1.9",
111
- "@codemirror/language": "^6.8.0",
112
- "@codemirror/search": "^6.5.0",
117
+ "@codemirror/commands": "^6.2.5",
118
+ "@codemirror/lang-javascript": "^6.2.1",
119
+ "@codemirror/language": "^6.9.0",
120
+ "@codemirror/search": "^6.5.3",
113
121
  "@codemirror/state": "^6.2.1",
114
- "@codemirror/view": "^6.14.1",
122
+ "@codemirror/view": "^6.19.0",
115
123
  "@jridgewell/sourcemap-codec": "^1.4.15",
116
- "@mermaid-js/mermaid-cli": "^10.2.4",
124
+ "@mermaid-js/mermaid-cli": "^10.4.0",
117
125
  "@napi-rs/cli": "^2.16.2",
118
126
  "@rollup/plugin-alias": "^5.0.0",
119
127
  "@rollup/plugin-buble": "^1.0.2",
120
- "@rollup/plugin-commonjs": "^25.0.3",
128
+ "@rollup/plugin-commonjs": "^25.0.4",
121
129
  "@rollup/plugin-json": "^6.0.0",
122
- "@rollup/plugin-node-resolve": "^15.1.0",
130
+ "@rollup/plugin-node-resolve": "^15.2.1",
123
131
  "@rollup/plugin-replace": "^5.0.2",
124
132
  "@rollup/plugin-terser": "^0.4.3",
125
- "@rollup/plugin-typescript": "^11.1.2",
126
- "@rollup/pluginutils": "^5.0.2",
133
+ "@rollup/plugin-typescript": "11.1.2",
134
+ "@rollup/pluginutils": "^5.0.4",
127
135
  "@types/estree": "1.0.1",
128
136
  "@types/mocha": "^10.0.1",
129
- "@types/node": "~14.18.54",
137
+ "@types/node": "18.0.0",
130
138
  "@types/yargs-parser": "^21.0.0",
131
- "@typescript-eslint/eslint-plugin": "^6.2.0",
132
- "@typescript-eslint/parser": "^6.2.0",
139
+ "@typescript-eslint/eslint-plugin": "^6.7.2",
140
+ "@typescript-eslint/parser": "^6.7.2",
133
141
  "@vue/eslint-config-prettier": "^8.0.0",
134
- "@vue/eslint-config-typescript": "^11.0.3",
142
+ "@vue/eslint-config-typescript": "^12.0.0",
135
143
  "acorn": "^8.10.0",
136
144
  "acorn-import-assertions": "^1.9.0",
137
- "acorn-jsx": "^5.3.2",
138
- "acorn-walk": "^8.2.0",
139
145
  "buble": "^0.20.0",
140
146
  "builtin-modules": "^3.3.0",
141
147
  "chokidar": "^3.5.3",
142
148
  "colorette": "^2.0.20",
143
- "concurrently": "^8.2.0",
144
- "core-js": "^3.31.1",
149
+ "concurrently": "^8.2.1",
150
+ "core-js": "^3.32.2",
145
151
  "date-time": "^4.0.0",
146
152
  "es5-shim": "^4.6.7",
147
153
  "es6-shim": "^0.35.8",
148
- "eslint": "^8.45.0",
149
- "eslint-config-prettier": "^8.8.0",
150
- "eslint-plugin-import": "^2.27.5",
154
+ "eslint": "^8.49.0",
155
+ "eslint-config-prettier": "^9.0.0",
156
+ "eslint-plugin-import": "^2.28.1",
151
157
  "eslint-plugin-prettier": "^5.0.0",
152
- "eslint-plugin-unicorn": "^48.0.0",
153
- "eslint-plugin-vue": "^9.15.1",
158
+ "eslint-plugin-unicorn": "^48.0.1",
159
+ "eslint-plugin-vue": "^9.17.0",
154
160
  "fixturify": "^3.0.0",
155
161
  "flru": "^1.0.2",
156
162
  "fs-extra": "^11.1.1",
157
163
  "github-api": "^3.4.0",
158
164
  "hash.js": "^1.1.7",
159
165
  "husky": "^8.0.3",
160
- "inquirer": "^9.2.8",
161
- "is-reference": "^3.0.1",
162
- "lint-staged": "^13.2.3",
166
+ "inquirer": "^9.2.11",
167
+ "is-reference": "^3.0.2",
168
+ "lint-staged": "^14.0.1",
163
169
  "locate-character": "^3.0.0",
164
- "magic-string": "^0.30.1",
170
+ "magic-string": "^0.30.3",
165
171
  "mocha": "^10.2.0",
166
172
  "nyc": "^15.1.0",
167
- "pinia": "^2.1.4",
168
- "prettier": "^3.0.0",
173
+ "pinia": "^2.1.6",
174
+ "prettier": "^3.0.3",
169
175
  "pretty-bytes": "^6.1.1",
170
176
  "pretty-ms": "^8.0.0",
171
177
  "requirejs": "^2.3.6",
172
- "rollup": "^3.26.3",
173
- "rollup-plugin-license": "^3.0.1",
178
+ "rollup": "^3.29.2",
179
+ "rollup-plugin-license": "^3.1.0",
174
180
  "rollup-plugin-string": "^3.0.0",
175
181
  "rollup-plugin-thatworks": "^1.0.4",
176
182
  "semver": "^7.5.4",
177
183
  "shx": "^0.3.4",
178
- "signal-exit": "^4.0.2",
184
+ "signal-exit": "^4.1.0",
179
185
  "source-map": "^0.7.4",
180
186
  "source-map-support": "^0.5.21",
181
- "systemjs": "^6.14.1",
182
- "terser": "^5.19.2",
183
- "tslib": "^2.6.1",
184
- "typescript": "^5.1.6",
185
- "vite": "^4.4.7",
186
- "vitepress": "^1.0.0-beta.6",
187
+ "systemjs": "^6.14.2",
188
+ "terser": "^5.19.4",
189
+ "tslib": "^2.6.2",
190
+ "typescript": "^5.2.2",
191
+ "vite": "^4.4.9",
192
+ "vitepress": "^1.0.0-rc.14",
187
193
  "vue": "^3.3.4",
194
+ "wasm-pack": "^0.12.1",
188
195
  "weak-napi": "^2.0.2",
189
196
  "yargs-parser": "^21.1.1"
190
197
  },
@@ -192,6 +199,7 @@
192
199
  "semver": "^7.5.4"
193
200
  },
194
201
  "files": [
202
+ "dist/*.node",
195
203
  "dist/**/*.js",
196
204
  "dist/*.d.ts",
197
205
  "dist/bin/rollup",
package/dist/es/native.js DELETED
@@ -1,257 +0,0 @@
1
- /* tslint:disable */
2
- /* eslint-disable */
3
- /* prettier-ignore */
4
-
5
- /* auto-generated by NAPI-RS */
6
-
7
- const { existsSync, readFileSync } = require('fs')
8
- const { join } = require('path')
9
-
10
- const { platform, arch } = process
11
-
12
- let nativeBinding = null
13
- let localFileExisted = false
14
- let loadError = null
15
-
16
- function isMusl() {
17
- // For Node 10
18
- if (!process.report || typeof process.report.getReport !== 'function') {
19
- try {
20
- const lddPath = require('child_process').execSync('which ldd').toString().trim()
21
- return readFileSync(lddPath, 'utf8').includes('musl')
22
- } catch (e) {
23
- return true
24
- }
25
- } else {
26
- const { glibcVersionRuntime } = process.report.getReport().header
27
- return !glibcVersionRuntime
28
- }
29
- }
30
-
31
- switch (platform) {
32
- case 'android':
33
- switch (arch) {
34
- case 'arm64':
35
- localFileExisted = existsSync(join(__dirname, 'rollup.android-arm64.node'))
36
- try {
37
- if (localFileExisted) {
38
- nativeBinding = require('./rollup.android-arm64.node')
39
- } else {
40
- nativeBinding = require('@rollup/rollup-android-arm64')
41
- }
42
- } catch (e) {
43
- loadError = e
44
- }
45
- break
46
- case 'arm':
47
- localFileExisted = existsSync(join(__dirname, 'rollup.android-arm-eabi.node'))
48
- try {
49
- if (localFileExisted) {
50
- nativeBinding = require('./rollup.android-arm-eabi.node')
51
- } else {
52
- nativeBinding = require('@rollup/rollup-android-arm-eabi')
53
- }
54
- } catch (e) {
55
- loadError = e
56
- }
57
- break
58
- default:
59
- throw new Error(`Unsupported architecture on Android ${arch}`)
60
- }
61
- break
62
- case 'win32':
63
- switch (arch) {
64
- case 'x64':
65
- localFileExisted = existsSync(
66
- join(__dirname, 'rollup.win32-x64-msvc.node')
67
- )
68
- try {
69
- if (localFileExisted) {
70
- nativeBinding = require('./rollup.win32-x64-msvc.node')
71
- } else {
72
- nativeBinding = require('@rollup/rollup-win32-x64-msvc')
73
- }
74
- } catch (e) {
75
- loadError = e
76
- }
77
- break
78
- case 'ia32':
79
- localFileExisted = existsSync(
80
- join(__dirname, 'rollup.win32-ia32-msvc.node')
81
- )
82
- try {
83
- if (localFileExisted) {
84
- nativeBinding = require('./rollup.win32-ia32-msvc.node')
85
- } else {
86
- nativeBinding = require('@rollup/rollup-win32-ia32-msvc')
87
- }
88
- } catch (e) {
89
- loadError = e
90
- }
91
- break
92
- case 'arm64':
93
- localFileExisted = existsSync(
94
- join(__dirname, 'rollup.win32-arm64-msvc.node')
95
- )
96
- try {
97
- if (localFileExisted) {
98
- nativeBinding = require('./rollup.win32-arm64-msvc.node')
99
- } else {
100
- nativeBinding = require('@rollup/rollup-win32-arm64-msvc')
101
- }
102
- } catch (e) {
103
- loadError = e
104
- }
105
- break
106
- default:
107
- throw new Error(`Unsupported architecture on Windows: ${arch}`)
108
- }
109
- break
110
- case 'darwin':
111
- localFileExisted = existsSync(join(__dirname, 'rollup.darwin-universal.node'))
112
- try {
113
- if (localFileExisted) {
114
- nativeBinding = require('./rollup.darwin-universal.node')
115
- } else {
116
- nativeBinding = require('@rollup/rollup-darwin-universal')
117
- }
118
- break
119
- } catch {}
120
- switch (arch) {
121
- case 'x64':
122
- localFileExisted = existsSync(join(__dirname, 'rollup.darwin-x64.node'))
123
- try {
124
- if (localFileExisted) {
125
- nativeBinding = require('./rollup.darwin-x64.node')
126
- } else {
127
- nativeBinding = require('@rollup/rollup-darwin-x64')
128
- }
129
- } catch (e) {
130
- loadError = e
131
- }
132
- break
133
- case 'arm64':
134
- localFileExisted = existsSync(
135
- join(__dirname, 'rollup.darwin-arm64.node')
136
- )
137
- try {
138
- if (localFileExisted) {
139
- nativeBinding = require('./rollup.darwin-arm64.node')
140
- } else {
141
- nativeBinding = require('@rollup/rollup-darwin-arm64')
142
- }
143
- } catch (e) {
144
- loadError = e
145
- }
146
- break
147
- default:
148
- throw new Error(`Unsupported architecture on macOS: ${arch}`)
149
- }
150
- break
151
- case 'freebsd':
152
- if (arch !== 'x64') {
153
- throw new Error(`Unsupported architecture on FreeBSD: ${arch}`)
154
- }
155
- localFileExisted = existsSync(join(__dirname, 'rollup.freebsd-x64.node'))
156
- try {
157
- if (localFileExisted) {
158
- nativeBinding = require('./rollup.freebsd-x64.node')
159
- } else {
160
- nativeBinding = require('@rollup/rollup-freebsd-x64')
161
- }
162
- } catch (e) {
163
- loadError = e
164
- }
165
- break
166
- case 'linux':
167
- switch (arch) {
168
- case 'x64':
169
- if (isMusl()) {
170
- localFileExisted = existsSync(
171
- join(__dirname, 'rollup.linux-x64-musl.node')
172
- )
173
- try {
174
- if (localFileExisted) {
175
- nativeBinding = require('./rollup.linux-x64-musl.node')
176
- } else {
177
- nativeBinding = require('@rollup/rollup-linux-x64-musl')
178
- }
179
- } catch (e) {
180
- loadError = e
181
- }
182
- } else {
183
- localFileExisted = existsSync(
184
- join(__dirname, 'rollup.linux-x64-gnu.node')
185
- )
186
- try {
187
- if (localFileExisted) {
188
- nativeBinding = require('./rollup.linux-x64-gnu.node')
189
- } else {
190
- nativeBinding = require('@rollup/rollup-linux-x64-gnu')
191
- }
192
- } catch (e) {
193
- loadError = e
194
- }
195
- }
196
- break
197
- case 'arm64':
198
- if (isMusl()) {
199
- localFileExisted = existsSync(
200
- join(__dirname, 'rollup.linux-arm64-musl.node')
201
- )
202
- try {
203
- if (localFileExisted) {
204
- nativeBinding = require('./rollup.linux-arm64-musl.node')
205
- } else {
206
- nativeBinding = require('@rollup/rollup-linux-arm64-musl')
207
- }
208
- } catch (e) {
209
- loadError = e
210
- }
211
- } else {
212
- localFileExisted = existsSync(
213
- join(__dirname, 'rollup.linux-arm64-gnu.node')
214
- )
215
- try {
216
- if (localFileExisted) {
217
- nativeBinding = require('./rollup.linux-arm64-gnu.node')
218
- } else {
219
- nativeBinding = require('@rollup/rollup-linux-arm64-gnu')
220
- }
221
- } catch (e) {
222
- loadError = e
223
- }
224
- }
225
- break
226
- case 'arm':
227
- localFileExisted = existsSync(
228
- join(__dirname, 'rollup.linux-arm-gnueabihf.node')
229
- )
230
- try {
231
- if (localFileExisted) {
232
- nativeBinding = require('./rollup.linux-arm-gnueabihf.node')
233
- } else {
234
- nativeBinding = require('@rollup/rollup-linux-arm-gnueabihf')
235
- }
236
- } catch (e) {
237
- loadError = e
238
- }
239
- break
240
- default:
241
- throw new Error(`Unsupported architecture on Linux: ${arch}`)
242
- }
243
- break
244
- default:
245
- throw new Error(`Unsupported OS: ${platform}, architecture: ${arch}`)
246
- }
247
-
248
- if (!nativeBinding) {
249
- if (loadError) {
250
- throw loadError
251
- }
252
- throw new Error(`Failed to load native binding`)
253
- }
254
-
255
- const { parse } = nativeBinding
256
-
257
- module.exports.parse = parse