rollup 4.0.0-3 → 4.0.0-5

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-3
4
- Fri, 04 Aug 2023 08:16:31 GMT - commit d9deb724f026a6f3e429509fce2d920e75d6a1ae
3
+ Rollup.js v4.0.0-5
4
+ Sun, 20 Aug 2023 06:56:10 GMT - commit 6284e58c1be160b656b9f2b44e8e2b1e5a93f9df
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.cjs');
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-3
4
- Fri, 04 Aug 2023 08:16:31 GMT - commit d9deb724f026a6f3e429509fce2d920e75d6a1ae
3
+ Rollup.js v4.0.0-5
4
+ Sun, 20 Aug 2023 06:56:10 GMT - commit 6284e58c1be160b656b9f2b44e8e2b1e5a93f9df
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-3
4
- Fri, 04 Aug 2023 08:16:31 GMT - commit d9deb724f026a6f3e429509fce2d920e75d6a1ae
3
+ Rollup.js v4.0.0-5
4
+ Sun, 20 Aug 2023 06:56:10 GMT - commit 6284e58c1be160b656b9f2b44e8e2b1e5a93f9df
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.cjs');
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-3",
3
+ "version": "4.0.0-5",
4
4
  "description": "Next-generation ES module bundler",
5
5
  "main": "dist/rollup.js",
6
6
  "module": "dist/es/rollup.js",
@@ -31,9 +31,11 @@
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
- "build:napi": "napi build --platform --dts native.d.ts --js native.js --cargo-cwd rust -p bindings_napi --cargo-name bindings_napi",
36
+ "build:napi": "napi build --platform --dts native.d.ts --js native.cjs --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",
37
39
  "update:napi": "npm run build:napi && npm run build:copy-native",
38
40
  "build:js": "rollup --config rollup.config.ts --configPlugin typescript",
39
41
  "update:js": "npm run build:js && npm run build:copy-native",
@@ -43,10 +45,11 @@
43
45
  "build:bootstrap": "shx mv dist dist-build && node dist-build/bin/rollup --config rollup.config.ts --configPlugin typescript && shx rm -rf dist-build",
44
46
  "build:docs": "vitepress build docs",
45
47
  "preview:docs": "vitepress preview docs",
46
- "ci:artifacts": "napi artifacts",
48
+ "ci:copy-wasm-node": "node scripts/copy-wasm-node.js",
49
+ "ci:artifacts": "npm run ci:copy-wasm-node && napi artifacts",
47
50
  "ci:lint": "concurrently -c red,green,blue 'npm:lint:js:nofix' 'npm:lint:markdown:nofix' 'npm:lint:rust:nofix'",
48
51
  "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'",
52
+ "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
53
  "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
54
  "lint": "concurrently -c red,green,blue 'npm:lint:js' 'npm:lint:markdown' 'npm:lint:rust'",
52
55
  "lint:js": "eslint . --fix --cache",
@@ -93,27 +96,27 @@
93
96
  "homepage": "https://rollupjs.org/",
94
97
  "optionalDependencies": {
95
98
  "fsevents": "~2.3.2",
96
- "@rollup/rollup-darwin-arm64": "4.0.0-3",
97
- "@rollup/rollup-android-arm64": "4.0.0-3",
98
- "@rollup/rollup-win32-arm64-msvc": "4.0.0-3",
99
- "@rollup/rollup-linux-arm64-gnu": "4.0.0-3",
100
- "@rollup/rollup-android-arm-eabi": "4.0.0-3",
101
- "@rollup/rollup-linux-arm-gnueabihf": "4.0.0-3",
102
- "@rollup/rollup-win32-ia32-msvc": "4.0.0-3",
103
- "@rollup/rollup-darwin-x64": "4.0.0-3",
104
- "@rollup/rollup-win32-x64-msvc": "4.0.0-3",
105
- "@rollup/rollup-linux-x64-gnu": "4.0.0-3",
106
- "@rollup/rollup-linux-x64-musl": "4.0.0-3"
99
+ "@rollup/rollup-darwin-arm64": "4.0.0-5",
100
+ "@rollup/rollup-android-arm64": "4.0.0-5",
101
+ "@rollup/rollup-win32-arm64-msvc": "4.0.0-5",
102
+ "@rollup/rollup-linux-arm64-gnu": "4.0.0-5",
103
+ "@rollup/rollup-android-arm-eabi": "4.0.0-5",
104
+ "@rollup/rollup-linux-arm-gnueabihf": "4.0.0-5",
105
+ "@rollup/rollup-win32-ia32-msvc": "4.0.0-5",
106
+ "@rollup/rollup-darwin-x64": "4.0.0-5",
107
+ "@rollup/rollup-win32-x64-msvc": "4.0.0-5",
108
+ "@rollup/rollup-linux-x64-gnu": "4.0.0-5",
109
+ "@rollup/rollup-linux-x64-musl": "4.0.0-5"
107
110
  },
108
111
  "devDependencies": {
109
112
  "@codemirror/commands": "^6.2.4",
110
113
  "@codemirror/lang-javascript": "^6.1.9",
111
114
  "@codemirror/language": "^6.8.0",
112
- "@codemirror/search": "^6.5.0",
115
+ "@codemirror/search": "^6.5.1",
113
116
  "@codemirror/state": "^6.2.1",
114
- "@codemirror/view": "^6.14.1",
117
+ "@codemirror/view": "^6.16.0",
115
118
  "@jridgewell/sourcemap-codec": "^1.4.15",
116
- "@mermaid-js/mermaid-cli": "^10.2.4",
119
+ "@mermaid-js/mermaid-cli": "^10.3.0",
117
120
  "@napi-rs/cli": "^2.16.2",
118
121
  "@rollup/plugin-alias": "^5.0.0",
119
122
  "@rollup/plugin-buble": "^1.0.2",
@@ -123,13 +126,14 @@
123
126
  "@rollup/plugin-replace": "^5.0.2",
124
127
  "@rollup/plugin-terser": "^0.4.3",
125
128
  "@rollup/plugin-typescript": "^11.1.2",
129
+ "@rollup/plugin-wasm": "^6.1.3",
126
130
  "@rollup/pluginutils": "^5.0.2",
127
131
  "@types/estree": "1.0.1",
128
132
  "@types/mocha": "^10.0.1",
129
- "@types/node": "~14.18.54",
133
+ "@types/node": "~18.17.5",
130
134
  "@types/yargs-parser": "^21.0.0",
131
- "@typescript-eslint/eslint-plugin": "^6.2.0",
132
- "@typescript-eslint/parser": "^6.2.0",
135
+ "@typescript-eslint/eslint-plugin": "^6.3.0",
136
+ "@typescript-eslint/parser": "^6.3.0",
133
137
  "@vue/eslint-config-prettier": "^8.0.0",
134
138
  "@vue/eslint-config-typescript": "^11.0.3",
135
139
  "acorn": "^8.10.0",
@@ -141,50 +145,51 @@
141
145
  "chokidar": "^3.5.3",
142
146
  "colorette": "^2.0.20",
143
147
  "concurrently": "^8.2.0",
144
- "core-js": "^3.31.1",
148
+ "core-js": "^3.32.0",
145
149
  "date-time": "^4.0.0",
146
150
  "es5-shim": "^4.6.7",
147
151
  "es6-shim": "^0.35.8",
148
- "eslint": "^8.45.0",
149
- "eslint-config-prettier": "^8.8.0",
150
- "eslint-plugin-import": "^2.27.5",
152
+ "eslint": "^8.46.0",
153
+ "eslint-config-prettier": "^9.0.0",
154
+ "eslint-plugin-import": "^2.28.0",
151
155
  "eslint-plugin-prettier": "^5.0.0",
152
- "eslint-plugin-unicorn": "^48.0.0",
153
- "eslint-plugin-vue": "^9.15.1",
156
+ "eslint-plugin-unicorn": "^48.0.1",
157
+ "eslint-plugin-vue": "^9.17.0",
154
158
  "fixturify": "^3.0.0",
155
159
  "flru": "^1.0.2",
156
160
  "fs-extra": "^11.1.1",
157
161
  "github-api": "^3.4.0",
158
162
  "hash.js": "^1.1.7",
159
163
  "husky": "^8.0.3",
160
- "inquirer": "^9.2.8",
164
+ "inquirer": "^9.2.10",
161
165
  "is-reference": "^3.0.1",
162
166
  "lint-staged": "^13.2.3",
163
167
  "locate-character": "^3.0.0",
164
- "magic-string": "^0.30.1",
168
+ "magic-string": "^0.30.2",
165
169
  "mocha": "^10.2.0",
166
170
  "nyc": "^15.1.0",
167
- "pinia": "^2.1.4",
168
- "prettier": "^3.0.0",
171
+ "pinia": "^2.1.6",
172
+ "prettier": "^3.0.1",
169
173
  "pretty-bytes": "^6.1.1",
170
174
  "pretty-ms": "^8.0.0",
171
175
  "requirejs": "^2.3.6",
172
- "rollup": "^3.26.3",
176
+ "rollup": "^3.28.0",
173
177
  "rollup-plugin-license": "^3.0.1",
174
178
  "rollup-plugin-string": "^3.0.0",
175
179
  "rollup-plugin-thatworks": "^1.0.4",
176
180
  "semver": "^7.5.4",
177
181
  "shx": "^0.3.4",
178
- "signal-exit": "^4.0.2",
182
+ "signal-exit": "^4.1.0",
179
183
  "source-map": "^0.7.4",
180
184
  "source-map-support": "^0.5.21",
181
185
  "systemjs": "^6.14.1",
182
186
  "terser": "^5.19.2",
183
187
  "tslib": "^2.6.1",
184
188
  "typescript": "^5.1.6",
185
- "vite": "^4.4.7",
186
- "vitepress": "^1.0.0-beta.6",
189
+ "vite": "^4.4.9",
190
+ "vitepress": "^1.0.0-beta.7",
187
191
  "vue": "^3.3.4",
192
+ "wasm-pack": "^0.12.1",
188
193
  "weak-napi": "^2.0.2",
189
194
  "yargs-parser": "^21.1.1"
190
195
  },
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