jsshaker 0.1.0 → 0.2.0

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/cli.js CHANGED
@@ -1,51 +1,56 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  const { parseArgs } = require("node:util");
4
- const { shakeSingleModule } = require("./index.js");
4
+ const { shakeFsModule } = require("./index.js");
5
5
  const { writeFile, mkdir } = require("node:fs/promises");
6
6
  const { join, dirname } = require("node:path");
7
7
 
8
- const { values, positionals } = parseArgs({
9
- options: {
10
- preset: {
11
- type: "string",
12
- short: "p",
8
+ (async () => {
9
+ const { values, positionals } = parseArgs({
10
+ options: {
11
+ preset: {
12
+ type: "string",
13
+ short: "p",
14
+ },
15
+ minify: {
16
+ type: "boolean",
17
+ short: "m",
18
+ },
19
+ outdir: {
20
+ type: "string",
21
+ short: "o",
22
+ },
13
23
  },
14
- minify: {
15
- type: "boolean",
16
- short: "m",
17
- },
18
- outdir: {
19
- type: "string",
20
- short: "o",
21
- },
22
- },
23
- allowPositionals: true,
24
- strict: false,
25
- });
26
-
27
- if (positionals.length !== 1) {
28
- throw new Error("Must provide exactly one entry js file path.");
29
- }
24
+ allowPositionals: true,
25
+ strict: false,
26
+ });
30
27
 
31
- const result = shakeSingleModule(
32
- positionals[0],
33
- {
34
- preset: values.preset,
35
- minify: values.minify,
28
+ if (positionals.length !== 1) {
29
+ throw new Error("Must provide exactly one entry js file path.");
36
30
  }
37
- );
38
31
 
39
- for (const message of result.diagnostics) {
40
- console.warn(message);
41
- }
32
+ const result = shakeFsModule(
33
+ positionals[0],
34
+ {
35
+ preset: values.preset,
36
+ minify: values.minify,
37
+ }
38
+ );
39
+
40
+ for (const message of result.diagnostics) {
41
+ console.warn(message);
42
+ }
42
43
 
43
- for (let [path, content] of Object.entries(result.output)) {
44
- if (values.outdir) {
45
- path = join(values.outdir, path);
44
+ for (let [path, { code }] of Object.entries(result.output)) {
45
+ if (values.outdir) {
46
+ path = join(values.outdir, path);
47
+ }
48
+ const dir = dirname(path);
49
+ await mkdir(dir, { recursive: true });
50
+ console.log('Writing', path);
51
+ await writeFile(path, code);
46
52
  }
47
- const dir = dirname(path);
48
- mkdir(dir, { recursive: true });
49
- console.log(path);
50
- writeFile(path, content);
51
- }
53
+ })().catch((err) => {
54
+ console.error(err);
55
+ process.exit(1);
56
+ });
package/index.d.ts CHANGED
@@ -1,7 +1,12 @@
1
1
  /* auto-generated by NAPI-RS */
2
2
  /* eslint-disable */
3
+ export interface Chunk {
4
+ code: string
5
+ sourceMapJson?: string
6
+ }
7
+
3
8
  export interface MultiModuleResult {
4
- output: Record<string, string>
9
+ output: Record<string, Chunk>
5
10
  diagnostics: Array<string>
6
11
  }
7
12
 
@@ -10,13 +15,16 @@ export interface Options {
10
15
  minify?: boolean
11
16
  alwaysInlineLiteral?: boolean
12
17
  jsx?: 'react'
18
+ sourceMap?: boolean
13
19
  }
14
20
 
15
- export declare function shakeMultiModule(entryPath: string, options: Options): MultiModuleResult
21
+ export declare function shakeFsModule(entryPath: string, options: Options): MultiModuleResult
22
+
23
+ export declare function shakeMultiModule(sources: Record<string, string>, entry: string, options: Options): MultiModuleResult
16
24
 
17
25
  export declare function shakeSingleModule(sourceText: string, options: Options): SingleModuleResult
18
26
 
19
27
  export interface SingleModuleResult {
20
- output: string
28
+ output: Chunk
21
29
  diagnostics: Array<string>
22
30
  }
package/index.js CHANGED
@@ -80,8 +80,8 @@ function requireNative() {
80
80
  try {
81
81
  const binding = require('@jsshaker/binding-android-arm64')
82
82
  const bindingPackageVersion = require('@jsshaker/binding-android-arm64/package.json').version
83
- if (bindingPackageVersion !== '0.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
84
- throw new Error(`Native binding package version mismatch, expected 0.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
83
+ if (bindingPackageVersion !== '0.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
84
+ throw new Error(`Native binding package version mismatch, expected 0.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
85
85
  }
86
86
  return binding
87
87
  } catch (e) {
@@ -96,8 +96,8 @@ function requireNative() {
96
96
  try {
97
97
  const binding = require('@jsshaker/binding-android-arm-eabi')
98
98
  const bindingPackageVersion = require('@jsshaker/binding-android-arm-eabi/package.json').version
99
- if (bindingPackageVersion !== '0.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
100
- throw new Error(`Native binding package version mismatch, expected 0.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
99
+ if (bindingPackageVersion !== '0.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
100
+ throw new Error(`Native binding package version mismatch, expected 0.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
101
101
  }
102
102
  return binding
103
103
  } catch (e) {
@@ -116,8 +116,8 @@ function requireNative() {
116
116
  try {
117
117
  const binding = require('@jsshaker/binding-win32-x64-msvc')
118
118
  const bindingPackageVersion = require('@jsshaker/binding-win32-x64-msvc/package.json').version
119
- if (bindingPackageVersion !== '0.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
120
- throw new Error(`Native binding package version mismatch, expected 0.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
119
+ if (bindingPackageVersion !== '0.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
120
+ throw new Error(`Native binding package version mismatch, expected 0.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
121
121
  }
122
122
  return binding
123
123
  } catch (e) {
@@ -132,8 +132,8 @@ function requireNative() {
132
132
  try {
133
133
  const binding = require('@jsshaker/binding-win32-ia32-msvc')
134
134
  const bindingPackageVersion = require('@jsshaker/binding-win32-ia32-msvc/package.json').version
135
- if (bindingPackageVersion !== '0.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
136
- throw new Error(`Native binding package version mismatch, expected 0.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
135
+ if (bindingPackageVersion !== '0.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
136
+ throw new Error(`Native binding package version mismatch, expected 0.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
137
137
  }
138
138
  return binding
139
139
  } catch (e) {
@@ -148,8 +148,8 @@ function requireNative() {
148
148
  try {
149
149
  const binding = require('@jsshaker/binding-win32-arm64-msvc')
150
150
  const bindingPackageVersion = require('@jsshaker/binding-win32-arm64-msvc/package.json').version
151
- if (bindingPackageVersion !== '0.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
152
- throw new Error(`Native binding package version mismatch, expected 0.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
151
+ if (bindingPackageVersion !== '0.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
152
+ throw new Error(`Native binding package version mismatch, expected 0.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
153
153
  }
154
154
  return binding
155
155
  } catch (e) {
@@ -167,8 +167,8 @@ function requireNative() {
167
167
  try {
168
168
  const binding = require('@jsshaker/binding-darwin-universal')
169
169
  const bindingPackageVersion = require('@jsshaker/binding-darwin-universal/package.json').version
170
- if (bindingPackageVersion !== '0.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
171
- throw new Error(`Native binding package version mismatch, expected 0.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
170
+ if (bindingPackageVersion !== '0.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
171
+ throw new Error(`Native binding package version mismatch, expected 0.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
172
172
  }
173
173
  return binding
174
174
  } catch (e) {
@@ -183,8 +183,8 @@ function requireNative() {
183
183
  try {
184
184
  const binding = require('@jsshaker/binding-darwin-x64')
185
185
  const bindingPackageVersion = require('@jsshaker/binding-darwin-x64/package.json').version
186
- if (bindingPackageVersion !== '0.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
187
- throw new Error(`Native binding package version mismatch, expected 0.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
186
+ if (bindingPackageVersion !== '0.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
187
+ throw new Error(`Native binding package version mismatch, expected 0.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
188
188
  }
189
189
  return binding
190
190
  } catch (e) {
@@ -199,8 +199,8 @@ function requireNative() {
199
199
  try {
200
200
  const binding = require('@jsshaker/binding-darwin-arm64')
201
201
  const bindingPackageVersion = require('@jsshaker/binding-darwin-arm64/package.json').version
202
- if (bindingPackageVersion !== '0.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
203
- throw new Error(`Native binding package version mismatch, expected 0.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
202
+ if (bindingPackageVersion !== '0.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
203
+ throw new Error(`Native binding package version mismatch, expected 0.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
204
204
  }
205
205
  return binding
206
206
  } catch (e) {
@@ -219,8 +219,8 @@ function requireNative() {
219
219
  try {
220
220
  const binding = require('@jsshaker/binding-freebsd-x64')
221
221
  const bindingPackageVersion = require('@jsshaker/binding-freebsd-x64/package.json').version
222
- if (bindingPackageVersion !== '0.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
223
- throw new Error(`Native binding package version mismatch, expected 0.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
222
+ if (bindingPackageVersion !== '0.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
223
+ throw new Error(`Native binding package version mismatch, expected 0.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
224
224
  }
225
225
  return binding
226
226
  } catch (e) {
@@ -235,8 +235,8 @@ function requireNative() {
235
235
  try {
236
236
  const binding = require('@jsshaker/binding-freebsd-arm64')
237
237
  const bindingPackageVersion = require('@jsshaker/binding-freebsd-arm64/package.json').version
238
- if (bindingPackageVersion !== '0.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
239
- throw new Error(`Native binding package version mismatch, expected 0.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
238
+ if (bindingPackageVersion !== '0.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
239
+ throw new Error(`Native binding package version mismatch, expected 0.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
240
240
  }
241
241
  return binding
242
242
  } catch (e) {
@@ -256,8 +256,8 @@ function requireNative() {
256
256
  try {
257
257
  const binding = require('@jsshaker/binding-linux-x64-musl')
258
258
  const bindingPackageVersion = require('@jsshaker/binding-linux-x64-musl/package.json').version
259
- if (bindingPackageVersion !== '0.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
260
- throw new Error(`Native binding package version mismatch, expected 0.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
259
+ if (bindingPackageVersion !== '0.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
260
+ throw new Error(`Native binding package version mismatch, expected 0.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
261
261
  }
262
262
  return binding
263
263
  } catch (e) {
@@ -272,8 +272,8 @@ function requireNative() {
272
272
  try {
273
273
  const binding = require('@jsshaker/binding-linux-x64-gnu')
274
274
  const bindingPackageVersion = require('@jsshaker/binding-linux-x64-gnu/package.json').version
275
- if (bindingPackageVersion !== '0.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
276
- throw new Error(`Native binding package version mismatch, expected 0.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
275
+ if (bindingPackageVersion !== '0.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
276
+ throw new Error(`Native binding package version mismatch, expected 0.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
277
277
  }
278
278
  return binding
279
279
  } catch (e) {
@@ -290,8 +290,8 @@ function requireNative() {
290
290
  try {
291
291
  const binding = require('@jsshaker/binding-linux-arm64-musl')
292
292
  const bindingPackageVersion = require('@jsshaker/binding-linux-arm64-musl/package.json').version
293
- if (bindingPackageVersion !== '0.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
294
- throw new Error(`Native binding package version mismatch, expected 0.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
293
+ if (bindingPackageVersion !== '0.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
294
+ throw new Error(`Native binding package version mismatch, expected 0.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
295
295
  }
296
296
  return binding
297
297
  } catch (e) {
@@ -306,8 +306,8 @@ function requireNative() {
306
306
  try {
307
307
  const binding = require('@jsshaker/binding-linux-arm64-gnu')
308
308
  const bindingPackageVersion = require('@jsshaker/binding-linux-arm64-gnu/package.json').version
309
- if (bindingPackageVersion !== '0.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
310
- throw new Error(`Native binding package version mismatch, expected 0.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
309
+ if (bindingPackageVersion !== '0.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
310
+ throw new Error(`Native binding package version mismatch, expected 0.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
311
311
  }
312
312
  return binding
313
313
  } catch (e) {
@@ -324,8 +324,8 @@ function requireNative() {
324
324
  try {
325
325
  const binding = require('@jsshaker/binding-linux-arm-musleabihf')
326
326
  const bindingPackageVersion = require('@jsshaker/binding-linux-arm-musleabihf/package.json').version
327
- if (bindingPackageVersion !== '0.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
328
- throw new Error(`Native binding package version mismatch, expected 0.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
327
+ if (bindingPackageVersion !== '0.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
328
+ throw new Error(`Native binding package version mismatch, expected 0.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
329
329
  }
330
330
  return binding
331
331
  } catch (e) {
@@ -340,8 +340,8 @@ function requireNative() {
340
340
  try {
341
341
  const binding = require('@jsshaker/binding-linux-arm-gnueabihf')
342
342
  const bindingPackageVersion = require('@jsshaker/binding-linux-arm-gnueabihf/package.json').version
343
- if (bindingPackageVersion !== '0.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
344
- throw new Error(`Native binding package version mismatch, expected 0.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
343
+ if (bindingPackageVersion !== '0.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
344
+ throw new Error(`Native binding package version mismatch, expected 0.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
345
345
  }
346
346
  return binding
347
347
  } catch (e) {
@@ -358,8 +358,8 @@ function requireNative() {
358
358
  try {
359
359
  const binding = require('@jsshaker/binding-linux-riscv64-musl')
360
360
  const bindingPackageVersion = require('@jsshaker/binding-linux-riscv64-musl/package.json').version
361
- if (bindingPackageVersion !== '0.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
362
- throw new Error(`Native binding package version mismatch, expected 0.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
361
+ if (bindingPackageVersion !== '0.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
362
+ throw new Error(`Native binding package version mismatch, expected 0.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
363
363
  }
364
364
  return binding
365
365
  } catch (e) {
@@ -374,8 +374,8 @@ function requireNative() {
374
374
  try {
375
375
  const binding = require('@jsshaker/binding-linux-riscv64-gnu')
376
376
  const bindingPackageVersion = require('@jsshaker/binding-linux-riscv64-gnu/package.json').version
377
- if (bindingPackageVersion !== '0.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
378
- throw new Error(`Native binding package version mismatch, expected 0.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
377
+ if (bindingPackageVersion !== '0.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
378
+ throw new Error(`Native binding package version mismatch, expected 0.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
379
379
  }
380
380
  return binding
381
381
  } catch (e) {
@@ -391,8 +391,8 @@ function requireNative() {
391
391
  try {
392
392
  const binding = require('@jsshaker/binding-linux-ppc64-gnu')
393
393
  const bindingPackageVersion = require('@jsshaker/binding-linux-ppc64-gnu/package.json').version
394
- if (bindingPackageVersion !== '0.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
395
- throw new Error(`Native binding package version mismatch, expected 0.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
394
+ if (bindingPackageVersion !== '0.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
395
+ throw new Error(`Native binding package version mismatch, expected 0.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
396
396
  }
397
397
  return binding
398
398
  } catch (e) {
@@ -407,8 +407,8 @@ function requireNative() {
407
407
  try {
408
408
  const binding = require('@jsshaker/binding-linux-s390x-gnu')
409
409
  const bindingPackageVersion = require('@jsshaker/binding-linux-s390x-gnu/package.json').version
410
- if (bindingPackageVersion !== '0.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
411
- throw new Error(`Native binding package version mismatch, expected 0.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
410
+ if (bindingPackageVersion !== '0.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
411
+ throw new Error(`Native binding package version mismatch, expected 0.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
412
412
  }
413
413
  return binding
414
414
  } catch (e) {
@@ -427,8 +427,8 @@ function requireNative() {
427
427
  try {
428
428
  const binding = require('@jsshaker/binding-openharmony-arm64')
429
429
  const bindingPackageVersion = require('@jsshaker/binding-openharmony-arm64/package.json').version
430
- if (bindingPackageVersion !== '0.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
431
- throw new Error(`Native binding package version mismatch, expected 0.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
430
+ if (bindingPackageVersion !== '0.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
431
+ throw new Error(`Native binding package version mismatch, expected 0.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
432
432
  }
433
433
  return binding
434
434
  } catch (e) {
@@ -443,8 +443,8 @@ function requireNative() {
443
443
  try {
444
444
  const binding = require('@jsshaker/binding-openharmony-x64')
445
445
  const bindingPackageVersion = require('@jsshaker/binding-openharmony-x64/package.json').version
446
- if (bindingPackageVersion !== '0.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
447
- throw new Error(`Native binding package version mismatch, expected 0.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
446
+ if (bindingPackageVersion !== '0.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
447
+ throw new Error(`Native binding package version mismatch, expected 0.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
448
448
  }
449
449
  return binding
450
450
  } catch (e) {
@@ -459,8 +459,8 @@ function requireNative() {
459
459
  try {
460
460
  const binding = require('@jsshaker/binding-openharmony-arm')
461
461
  const bindingPackageVersion = require('@jsshaker/binding-openharmony-arm/package.json').version
462
- if (bindingPackageVersion !== '0.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
463
- throw new Error(`Native binding package version mismatch, expected 0.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
462
+ if (bindingPackageVersion !== '0.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
463
+ throw new Error(`Native binding package version mismatch, expected 0.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
464
464
  }
465
465
  return binding
466
466
  } catch (e) {
@@ -508,5 +508,6 @@ if (!nativeBinding) {
508
508
  }
509
509
 
510
510
  module.exports = nativeBinding
511
+ module.exports.shakeFsModule = nativeBinding.shakeFsModule
511
512
  module.exports.shakeMultiModule = nativeBinding.shakeMultiModule
512
513
  module.exports.shakeSingleModule = nativeBinding.shakeSingleModule
Binary file
Binary file
Binary file
package/jsshaker.wasi.cjs CHANGED
@@ -108,5 +108,6 @@ const { instance: __napiInstance, module: __wasiModule, napiModule: __napiModule
108
108
  },
109
109
  })
110
110
  module.exports = __napiModule.exports
111
+ module.exports.shakeFsModule = __napiModule.exports.shakeFsModule
111
112
  module.exports.shakeMultiModule = __napiModule.exports.shakeMultiModule
112
113
  module.exports.shakeSingleModule = __napiModule.exports.shakeSingleModule
Binary file
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jsshaker",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "type": "commonjs",
5
5
  "main": "index.js",
6
6
  "browser": "browser.js",
@@ -49,11 +49,11 @@
49
49
  "ohash": "^2.0.11"
50
50
  },
51
51
  "optionalDependencies": {
52
- "@jsshaker/binding-linux-x64-gnu": "0.1.0",
53
- "@jsshaker/binding-win32-x64-msvc": "0.1.0",
54
- "@jsshaker/binding-darwin-x64": "0.1.0",
55
- "@jsshaker/binding-darwin-arm64": "0.1.0",
56
- "@jsshaker/binding-wasm32-wasi": "0.1.0"
52
+ "@jsshaker/binding-linux-x64-gnu": "0.2.0",
53
+ "@jsshaker/binding-win32-x64-msvc": "0.2.0",
54
+ "@jsshaker/binding-darwin-x64": "0.2.0",
55
+ "@jsshaker/binding-darwin-arm64": "0.2.0",
56
+ "@jsshaker/binding-wasm32-wasi": "0.2.0"
57
57
  },
58
58
  "scripts": {
59
59
  "artifacts": "napi artifacts",