@parcel/rust 2.12.1-dev.3268 → 2.12.1-dev.3303

Sign up to get free protection for your applications and to get access to all the features.
package/index.d.ts CHANGED
@@ -7,25 +7,62 @@ export interface JsMacroError {
7
7
  kind: number
8
8
  message: string
9
9
  }
10
- export interface SerializedParcelDb {
11
- id: bigint
12
- }
10
+ export function initSentry(): void
11
+ export function closeSentry(): void
13
12
  export function findAncestorFile(filenames: Array<string>, from: string, root: string): string | null
14
13
  export function findFirstFile(names: Array<string>): string | null
15
14
  export function findNodeModule(module: string, from: string): string | null
16
15
  export function hashString(s: string): string
17
16
  export function hashBuffer(buf: Buffer): string
18
17
  export function optimizeImage(kind: string, buf: Buffer): Buffer
18
+ /**
19
+ * JavaScript provided options to configure the `tracing_subscriber` rust logs into a file or the
20
+ * console.
21
+ */
22
+ export interface ParcelTracingOptions {
23
+ /** Enable tracing */
24
+ enabled: boolean
25
+ /**
26
+ * If set to some, will trace to a file with the given options, otherwise the console will be
27
+ * used.
28
+ */
29
+ outputFileOptions?: ParcelTracingOutputFileOptions
30
+ }
31
+ /**
32
+ * Output file configuration.
33
+ * Tracing log files will be rotated hourly on the provided directory.
34
+ */
35
+ export interface ParcelTracingOutputFileOptions {
36
+ /** The directory where the log files will be written. */
37
+ directory: string
38
+ /** A prefix for the log file names. */
39
+ prefix: string
40
+ /** The maximum number of rotated files to keep. */
41
+ maxFiles: number
42
+ }
43
+ export interface ParcelNapiBuildOptions {
44
+
45
+ }
46
+ export interface ParcelNapiBuildResult {
47
+
48
+ }
49
+ export interface ParcelNapiOptions {
50
+ threads?: number
51
+ nodeWorkers?: number
52
+ fs?: object
53
+ tracingOptions?: ParcelTracingOptions
54
+ }
55
+ export function registerWorker(worker: object): void
19
56
  export interface JsFileSystemOptions {
20
57
  canonicalize: (...args: any[]) => any
21
58
  read: (...args: any[]) => any
22
59
  isFile: (...args: any[]) => any
23
60
  isDir: (...args: any[]) => any
24
- includeNodeModules?: boolean | Array<string> | Record<string, boolean>
61
+ includeNodeModules?: NapiSideEffectsVariants
25
62
  }
26
63
  export interface FileSystem {
27
64
  fs?: JsFileSystemOptions
28
- includeNodeModules?: boolean | Array<string> | Record<string, boolean>
65
+ includeNodeModules?: NapiSideEffectsVariants
29
66
  conditions?: number
30
67
  moduleDirResolver?: (...args: any[]) => any
31
68
  mode: number
@@ -64,32 +101,23 @@ export interface JsInvalidations {
64
101
  invalidateOnFileCreate: Array<FilePathCreateInvalidation | FileNameCreateInvalidation | GlobCreateInvalidation>
65
102
  invalidateOnStartup: boolean
66
103
  }
67
- export function transform(db: ParcelDb, opts: object): unknown
68
- export function transformAsync(db: ParcelDb, opts: object): object
69
- export type JsParcelDb = ParcelDb
70
- export class ParcelDb {
71
- constructor(options: object)
72
- serialize(): SerializedParcelDb
73
- static deserializeNative(value: SerializedParcelDb): JsParcelDb
74
- getPage(page: number): Buffer
75
- alloc(typeId: number): number
76
- dealloc(typeId: number, addr: number): void
77
- readString(addr: number): string
78
- getStringId(s: string): number
79
- extendVec(typeId: number, addr: number, count: number): void
80
- createEnvironment(addr: number): number
81
- createTarget(addr: number): number
82
- write(filename: string): void
83
- toBuffer(): Buffer
84
- static _read(filename: string, options: object): JsParcelDb
85
- static _fromBuffer(buf: Buffer, options: object): JsParcelDb
86
- }
104
+ export function testingRunParcelJsTransformerPlugin(targetPath: string): unknown
105
+ export function transform(opts: object): unknown
106
+ export function transformAsync(opts: object): object
87
107
  export class Hash {
88
108
  constructor()
89
109
  writeString(s: string): void
90
110
  writeBuffer(buf: Buffer): void
91
111
  finish(): string
92
112
  }
113
+ export class ParcelNapi {
114
+ nodeWorkerCount: number
115
+ constructor(options: ParcelNapiOptions)
116
+ build(options: ParcelNapiBuildOptions): object
117
+ testingTempFsReadToString(path: string): Promise<string>
118
+ testingTempFsIsFile(path: string): Promise<boolean>
119
+ testingTempFsIsDir(path: string): Promise<boolean>
120
+ }
93
121
  export class Resolver {
94
122
  constructor(projectRoot: string, options: FileSystem)
95
123
  resolve(options: ResolveOptions): ResolveResult
package/index.js CHANGED
@@ -224,17 +224,32 @@ switch (platform) {
224
224
  }
225
225
  break
226
226
  case 'arm':
227
- localFileExisted = existsSync(
228
- join(__dirname, 'parcel-node-bindings.linux-arm-gnueabihf.node')
229
- )
230
- try {
231
- if (localFileExisted) {
232
- nativeBinding = require('./parcel-node-bindings.linux-arm-gnueabihf.node')
233
- } else {
234
- nativeBinding = require('@parcel/rust-linux-arm-gnueabihf')
227
+ if (isMusl()) {
228
+ localFileExisted = existsSync(
229
+ join(__dirname, 'parcel-node-bindings.linux-arm-musleabihf.node')
230
+ )
231
+ try {
232
+ if (localFileExisted) {
233
+ nativeBinding = require('./parcel-node-bindings.linux-arm-musleabihf.node')
234
+ } else {
235
+ nativeBinding = require('@parcel/rust-linux-arm-musleabihf')
236
+ }
237
+ } catch (e) {
238
+ loadError = e
239
+ }
240
+ } else {
241
+ localFileExisted = existsSync(
242
+ join(__dirname, 'parcel-node-bindings.linux-arm-gnueabihf.node')
243
+ )
244
+ try {
245
+ if (localFileExisted) {
246
+ nativeBinding = require('./parcel-node-bindings.linux-arm-gnueabihf.node')
247
+ } else {
248
+ nativeBinding = require('@parcel/rust-linux-arm-gnueabihf')
249
+ }
250
+ } catch (e) {
251
+ loadError = e
235
252
  }
236
- } catch (e) {
237
- loadError = e
238
253
  }
239
254
  break
240
255
  case 'riscv64':
@@ -295,9 +310,10 @@ if (!nativeBinding) {
295
310
  throw new Error(`Failed to load native binding`)
296
311
  }
297
312
 
298
- const { ParcelDb, findAncestorFile, findFirstFile, findNodeModule, hashString, hashBuffer, Hash, optimizeImage, Resolver, transform, transformAsync } = nativeBinding
313
+ const { initSentry, closeSentry, findAncestorFile, findFirstFile, findNodeModule, hashString, hashBuffer, Hash, optimizeImage, ParcelNapi, registerWorker, Resolver, testingRunParcelJsTransformerPlugin, transform, transformAsync } = nativeBinding
299
314
 
300
- module.exports.ParcelDb = ParcelDb
315
+ module.exports.initSentry = initSentry
316
+ module.exports.closeSentry = closeSentry
301
317
  module.exports.findAncestorFile = findAncestorFile
302
318
  module.exports.findFirstFile = findFirstFile
303
319
  module.exports.findNodeModule = findNodeModule
@@ -305,6 +321,9 @@ module.exports.hashString = hashString
305
321
  module.exports.hashBuffer = hashBuffer
306
322
  module.exports.Hash = Hash
307
323
  module.exports.optimizeImage = optimizeImage
324
+ module.exports.ParcelNapi = ParcelNapi
325
+ module.exports.registerWorker = registerWorker
308
326
  module.exports.Resolver = Resolver
327
+ module.exports.testingRunParcelJsTransformerPlugin = testingRunParcelJsTransformerPlugin
309
328
  module.exports.transform = transform
310
329
  module.exports.transformAsync = transformAsync
package/index.js.flow CHANGED
@@ -1,20 +1,60 @@
1
1
  // @flow
2
- import type {FileCreateInvalidation} from '@parcel/types';
3
- import type {EnvironmentAddr, TargetAddr} from './src/db';
4
-
5
- export type {
6
- EnvironmentAddr,
7
- TargetAddr,
8
- };
2
+ import type {FileCreateInvalidation, FileSystem as ParcelFileSystem} from '@parcel/types';
9
3
 
10
4
  declare export var init: void | (() => void);
11
5
 
12
- declare export function findAncestorFile(filenames: Array<string>, from: string, root: string): string | null
13
- declare export function findFirstFile(names: Array<string>): string | null
14
- declare export function findNodeModule(module: string, from: string): string | null
15
- declare export function hashString(s: string): string
16
- declare export function hashBuffer(buf: Buffer): string
17
- declare export function optimizeImage(kind: string, buf: Buffer): Buffer
6
+ export type ProjectPath = any;
7
+ export interface ConfigRequest {
8
+ id: string;
9
+ invalidateOnFileChange: Array<ProjectPath>;
10
+ invalidateOnConfigKeyChange: Array<any>;
11
+ invalidateOnFileCreate: Array<any>;
12
+ invalidateOnEnvChange: Array<string>;
13
+ invalidateOnOptionChange: Array<string>;
14
+ invalidateOnStartup: boolean;
15
+ invalidateOnBuild: boolean;
16
+ }
17
+ export interface RequestOptions {}
18
+
19
+ export interface ParcelNapiOptions {
20
+ threads?: number;
21
+ nodeWorkers?: number;
22
+ fs?: ParcelFileSystem;
23
+ }
24
+
25
+ declare export class ParcelNapi {
26
+ nodeWorkerCount: number,
27
+ constructor(options: ParcelNapiOptions): ParcelNapi;
28
+ build(options: {||}): Promise<void>;
29
+ static defaultThreadCount(): number;
30
+ testingTempFsReadToString(path: string): string;
31
+ testingTempFsIsDir(path: string): boolean;
32
+ testingTempFsIsFile(path: string): boolean;
33
+ testingRpcPing(): void;
34
+ }
35
+
36
+ declare export function registerWorker(worker: any): void
37
+
38
+ declare export function initSentry(): void;
39
+ declare export function closeSentry(): void;
40
+ declare export function napiRunConfigRequest(
41
+ configRequest: ConfigRequest,
42
+ api: any,
43
+ options: any,
44
+ ): void;
45
+ declare export function findAncestorFile(
46
+ filenames: Array<string>,
47
+ from: string,
48
+ root: string,
49
+ ): string | null;
50
+ declare export function findFirstFile(names: Array<string>): string | null;
51
+ declare export function findNodeModule(
52
+ module: string,
53
+ from: string,
54
+ ): string | null;
55
+ declare export function hashString(s: string): string;
56
+ declare export function hashBuffer(buf: Buffer): string;
57
+ declare export function optimizeImage(kind: string, buf: Buffer): Buffer;
18
58
  export interface JsFileSystemOptions {
19
59
  canonicalize: string => string;
20
60
  read: string => Buffer;
@@ -23,14 +63,14 @@ export interface JsFileSystemOptions {
23
63
  includeNodeModules?: boolean | Array<string> | {|[string]: boolean|};
24
64
  }
25
65
  export interface FileSystem {
26
- fs?: JsFileSystemOptions,
66
+ fs?: JsFileSystemOptions;
27
67
  includeNodeModules?: boolean | Array<string> | {|[string]: boolean|};
28
- conditions?: number,
29
- moduleDirResolver?: (...args: any[]) => any,
30
- mode: number,
31
- entries?: number,
32
- extensions?: Array<string>,
33
- packageExports: boolean
68
+ conditions?: number;
69
+ moduleDirResolver?: (...args: any[]) => any;
70
+ mode: number;
71
+ entries?: number;
72
+ extensions?: Array<string>;
73
+ packageExports: boolean;
34
74
  }
35
75
  export interface ResolveOptions {
36
76
  filename: string;
@@ -59,46 +99,13 @@ export interface JsInvalidations {
59
99
  invalidateOnFileCreate: Array<FileCreateInvalidation>;
60
100
  invalidateOnStartup: boolean;
61
101
  }
62
- declare export function transform(db: ParcelDb, opts: any): any;
63
- declare export function transformAsync(db: ParcelDb, opts: any): Promise<any>;
102
+ declare export function transform(opts: any): any;
103
+ declare export function transformAsync(opts: any): Promise<any>;
64
104
  declare export class Hash {
65
105
  writeString(s: string): void;
66
106
  writeBuffer(b: Buffer): void;
67
107
  finish(): string;
68
108
  }
69
- // $FlowFixMe
70
- type TmpBigInt = bigint;
71
- export type SerializedParcelDb = {|
72
- id: TmpBigInt
73
- |};
74
- type Options = {|
75
- mode: string,
76
- env: {[string]: string | void},
77
- log_level: string,
78
- project_root: string
79
- |};
80
- declare export class ParcelDb {
81
- constructor(options: Options): ParcelDb;
82
- serialize(): SerializedParcelDb;
83
- static create(options: Options): ParcelDb;
84
- static read(filename: string, options: Options): ParcelDb;
85
- static fromBuffer(buf: Buffer, options: Options): ParcelDb;
86
- static deserialize(value: SerializedParcelDb): ParcelDb;
87
- write(filename: string): void;
88
- toBuffer(): Buffer;
89
- getPage(page: number): Buffer;
90
- alloc(typeId: number): number;
91
- dealloc(typeId: number, addr: number): void;
92
- readString(addr: number): string;
93
- getStringId(s: string): number;
94
- extendVec(typeId: number, addr: number, count: number): void;
95
- createEnvironment(addr: EnvironmentAddr): EnvironmentAddr;
96
- createTarget(addr: TargetAddr): TargetAddr;
97
-
98
- starSymbol: number;
99
- defaultSymbol: number;
100
- [symbol]: any;
101
- }
102
109
  export interface ResolverOptions {
103
110
  fs?: JsFileSystemOptions;
104
111
  includeNodeModules?: boolean | Array<string> | {|[string]: boolean|};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@parcel/rust",
3
- "version": "2.12.1-dev.3268+10d19ff8a",
3
+ "version": "2.12.1-dev.3303+3edb0d741",
4
4
  "license": "MIT",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -13,21 +13,19 @@
13
13
  "type": "git",
14
14
  "url": "https://github.com/parcel-bundler/parcel.git"
15
15
  },
16
- "main": "lib/index.js",
16
+ "main": "index.js",
17
17
  "browser": "browser.js",
18
- "source": "src/index.js",
19
18
  "napi": {
20
19
  "name": "parcel-node-bindings"
21
20
  },
22
21
  "engines": {
23
- "node": ">= 12.0.0"
22
+ "node": ">= 16.0.0"
24
23
  },
25
24
  "files": [
26
25
  "browser.js",
27
26
  "index.d.ts",
28
27
  "index.js",
29
28
  "index.js.flow",
30
- "lib",
31
29
  "*.node",
32
30
  "*.wasm"
33
31
  ],
@@ -36,11 +34,11 @@
36
34
  "napi-wasm": "^1.0.1"
37
35
  },
38
36
  "scripts": {
39
- "build": "napi build --platform --cargo-cwd ../../../crates/node-bindings && yarn build-db",
40
- "build-release": "napi build --platform --release --cargo-cwd ../../../crates/node-bindings && yarn build-db",
41
- "build-db": "cargo run -p parcel-db && prettier --write src/db.js",
37
+ "build": "napi build --platform --cargo-cwd ../../../crates/node-bindings",
38
+ "build-canary": "napi build --platform --profile canary --features canary --cargo-cwd ../../../crates/node-bindings",
39
+ "build-release": "napi build --platform --release --cargo-cwd ../../../crates/node-bindings",
42
40
  "wasm:build": "cargo build -p parcel-node-bindings --target wasm32-unknown-unknown && cp ../../../target/wasm32-unknown-unknown/debug/parcel_node_bindings.wasm .",
43
41
  "wasm:build-release": "CARGO_PROFILE_RELEASE_LTO=true cargo build -p parcel-node-bindings --target wasm32-unknown-unknown --release && wasm-opt --strip-debug -O ../../../target/wasm32-unknown-unknown/release/parcel_node_bindings.wasm -o parcel_node_bindings.wasm"
44
42
  },
45
- "gitHead": "10d19ff8a34dd8f479847aadf9865be48a8fad84"
43
+ "gitHead": "3edb0d7419831e49cfa7ea8c52b4f7127a16ae52"
46
44
  }