@parcel/rust 2.12.1-canary.3344 → 2.12.1-canary.3350

Sign up to get free protection for your applications and to get access to all the features.
package/index.d.ts CHANGED
@@ -13,44 +13,6 @@ export function findNodeModule(module: string, from: string): string | null
13
13
  export function hashString(s: string): string
14
14
  export function hashBuffer(buf: Buffer): string
15
15
  export function optimizeImage(kind: string, buf: Buffer): Buffer
16
- export function initializeMonitoring(): void
17
- export function closeMonitoring(): void
18
- export interface ParcelNapiBuildOptions {
19
- registerWorker: (...args: any[]) => any
20
- }
21
- export interface ParcelNapiBuildResult {
22
-
23
- }
24
- export interface ParcelNapiOptions {
25
- fs?: object
26
- nodeWorkers?: number
27
- options: object
28
- packageManager?: object
29
- threads?: number
30
- }
31
- /**
32
- * This function is run in the Nodejs worker context upon initialization
33
- * to notify the main thread that a Nodejs worker thread has started
34
- *
35
- * A Rust channel is transferred to the worker via JavaScript `worker.postMessage`.
36
- * The worker then calls `register_worker`, supplying it with an object containing
37
- * callbacks.
38
- *
39
- * The callbacks are later called from the main thread to send work to the worker.
40
- *
41
- * |-------------| --- Init channel ----> |-------------------|
42
- * | Main Thread | | Worker Thread (n) |
43
- * |-------------| <-- Worker wrapper --- |-------------------|
44
- *
45
- * **Later During Build**
46
- *
47
- * -- Resolver.resolve -->
48
- * <- DependencyResult ---
49
- *
50
- * -- Transf.transform -->
51
- * <--- Array<Asset> -----
52
- */
53
- export function registerWorker(channel: JsTransferable, worker: object): void
54
16
  export interface JsFileSystemOptions {
55
17
  canonicalize: (...args: any[]) => any
56
18
  read: (...args: any[]) => any
@@ -99,54 +61,6 @@ export interface JsInvalidations {
99
61
  invalidateOnFileCreate: Array<FilePathCreateInvalidation | FileNameCreateInvalidation | GlobCreateInvalidation>
100
62
  invalidateOnStartup: boolean
101
63
  }
102
- export interface JsFileSystemOptionsOld {
103
- canonicalize: (...args: any[]) => any
104
- read: (...args: any[]) => any
105
- isFile: (...args: any[]) => any
106
- isDir: (...args: any[]) => any
107
- includeNodeModules?: NapiSideEffectsVariants
108
- }
109
- export interface FileSystemOld {
110
- fs?: JsFileSystemOptionsOld
111
- includeNodeModules?: NapiSideEffectsVariants
112
- conditions?: number
113
- moduleDirResolver?: (...args: any[]) => any
114
- mode: number
115
- entries?: number
116
- extensions?: Array<string>
117
- packageExports: boolean
118
- typescript?: boolean
119
- }
120
- export interface ResolveOptionsOld {
121
- filename: string
122
- specifierType: string
123
- parent: string
124
- packageConditions?: Array<string>
125
- }
126
- export interface FilePathCreateInvalidationOld {
127
- filePath: string
128
- }
129
- export interface FileNameCreateInvalidationOld {
130
- fileName: string
131
- aboveFilePath: string
132
- }
133
- export interface GlobCreateInvalidationOld {
134
- glob: string
135
- }
136
- export interface ResolveResultOld {
137
- resolution: unknown
138
- invalidateOnFileChange: Array<string>
139
- invalidateOnFileCreate: Array<FilePathCreateInvalidationOld | FileNameCreateInvalidationOld | GlobCreateInvalidationOld>
140
- query?: string
141
- sideEffects: boolean
142
- error: unknown
143
- moduleType: number
144
- }
145
- export interface JsInvalidationsOld {
146
- invalidateOnFileChange: Array<string>
147
- invalidateOnFileCreate: Array<FilePathCreateInvalidationOld | FileNameCreateInvalidationOld | GlobCreateInvalidationOld>
148
- invalidateOnStartup: boolean
149
- }
150
64
  export function transform(opts: object): unknown
151
65
  export function transformAsync(opts: object): object
152
66
  export class Hash {
@@ -155,12 +69,6 @@ export class Hash {
155
69
  writeBuffer(buf: Buffer): void
156
70
  finish(): string
157
71
  }
158
- export class ParcelNapi {
159
- nodeWorkerCount: number
160
- constructor(napiOptions: ParcelNapiOptions)
161
- build(options: ParcelNapiBuildOptions): object
162
- buildAssetGraph(options: ParcelNapiBuildOptions): object
163
- }
164
72
  export class Resolver {
165
73
  constructor(projectRoot: string, options: FileSystem)
166
74
  resolve(options: ResolveOptions): ResolveResult
@@ -169,11 +77,3 @@ export class Resolver {
169
77
  getInvalidations(path: string): JsInvalidations
170
78
  getInvalidations(path: string): JsInvalidations
171
79
  }
172
- export class ResolverOld {
173
- constructor(projectRoot: string, options: FileSystemOld)
174
- resolve(options: ResolveOptionsOld): ResolveResultOld
175
- resolveAsync(): object
176
- resolveAsync(options: ResolveOptionsOld): object
177
- getInvalidations(path: string): JsInvalidationsOld
178
- getInvalidations(path: string): JsInvalidationsOld
179
- }
package/index.js CHANGED
@@ -310,7 +310,7 @@ if (!nativeBinding) {
310
310
  throw new Error(`Failed to load native binding`)
311
311
  }
312
312
 
313
- const { findAncestorFile, findFirstFile, findNodeModule, hashString, hashBuffer, Hash, optimizeImage, initializeMonitoring, closeMonitoring, ParcelNapi, registerWorker, Resolver, ResolverOld, transform, transformAsync } = nativeBinding
313
+ const { findAncestorFile, findFirstFile, findNodeModule, hashString, hashBuffer, Hash, optimizeImage, Resolver, transform, transformAsync } = nativeBinding
314
314
 
315
315
  module.exports.findAncestorFile = findAncestorFile
316
316
  module.exports.findFirstFile = findFirstFile
@@ -319,11 +319,6 @@ module.exports.hashString = hashString
319
319
  module.exports.hashBuffer = hashBuffer
320
320
  module.exports.Hash = Hash
321
321
  module.exports.optimizeImage = optimizeImage
322
- module.exports.initializeMonitoring = initializeMonitoring
323
- module.exports.closeMonitoring = closeMonitoring
324
- module.exports.ParcelNapi = ParcelNapi
325
- module.exports.registerWorker = registerWorker
326
322
  module.exports.Resolver = Resolver
327
- module.exports.ResolverOld = ResolverOld
328
323
  module.exports.transform = transform
329
324
  module.exports.transformAsync = transformAsync
package/index.js.flow CHANGED
@@ -1,84 +1,8 @@
1
1
  // @flow
2
- import type {
3
- Encoding,
4
- FileCreateInvalidation,
5
- FilePath,
6
- InitialParcelOptions,
7
- PackageManager,
8
- } from '@parcel/types';
2
+ import type {FileCreateInvalidation} from '@parcel/types';
9
3
 
10
4
  declare export var init: void | (() => void);
11
5
 
12
- export type Transferable = {||};
13
-
14
- export type ProjectPath = any;
15
- export interface ConfigRequest {
16
- id: string;
17
- invalidateOnFileChange: Array<ProjectPath>;
18
- invalidateOnConfigKeyChange: Array<any>;
19
- invalidateOnFileCreate: Array<any>;
20
- invalidateOnEnvChange: Array<string>;
21
- invalidateOnOptionChange: Array<string>;
22
- invalidateOnStartup: boolean;
23
- invalidateOnBuild: boolean;
24
- }
25
- export interface RequestOptions {}
26
-
27
- export interface FileSystem {
28
- canonicalize(path: FilePath): FilePath;
29
- cwd(): FilePath;
30
- isDir(path: FilePath): boolean;
31
- isFile(path: FilePath): boolean;
32
- readFile(path: FilePath, encoding?: Encoding): string;
33
- }
34
-
35
- export type ParcelNapiOptions = {|
36
- fs?: FileSystem,
37
- nodeWorkers?: number,
38
- options: {|
39
- corePath?: string,
40
- // TODO Use Omit when available in flow >0.210.0
41
- ...$Diff<
42
- InitialParcelOptions,
43
- {|
44
- inputFS: InitialParcelOptions['inputFS'],
45
- outputFS: InitialParcelOptions['outputFS'],
46
- packageManager: InitialParcelOptions['packageManager'],
47
- |},
48
- >,
49
- |},
50
- packageManager?: PackageManager,
51
- threads?: number,
52
- |};
53
-
54
- export type ParcelBuildOptions = {|
55
- registerWorker: (channel: Transferable) => void | Promise<void>,
56
- |};
57
-
58
- declare export class ParcelNapi {
59
- nodeWorkerCount: number;
60
- constructor(options: ParcelNapiOptions): ParcelNapi;
61
- build(options: ParcelBuildOptions): Promise<void>;
62
- buildAssetGraph(options: ParcelBuildOptions): Promise<any>;
63
- static defaultThreadCount(): number;
64
- testingTempFsReadToString(path: string): string;
65
- testingTempFsIsDir(path: string): boolean;
66
- testingTempFsIsFile(path: string): boolean;
67
- testingRpcPing(): void;
68
- }
69
-
70
- declare export function registerWorker(
71
- channel: Transferable,
72
- worker: any,
73
- ): void;
74
-
75
- declare export function initializeMonitoring(): void;
76
- declare export function closeMonitoring(): void;
77
- declare export function napiRunConfigRequest(
78
- configRequest: ConfigRequest,
79
- api: any,
80
- options: any,
81
- ): void;
82
6
  declare export function findAncestorFile(
83
7
  filenames: Array<string>,
84
8
  from: string,
@@ -99,6 +23,16 @@ export interface JsFileSystemOptions {
99
23
  isDir: string => boolean;
100
24
  includeNodeModules?: boolean | Array<string> | {|[string]: boolean|};
101
25
  }
26
+ export interface FileSystem {
27
+ fs?: JsFileSystemOptions,
28
+ includeNodeModules?: boolean | Array<string> | {|[string]: boolean|};
29
+ conditions?: number,
30
+ moduleDirResolver?: (...args: any[]) => any,
31
+ mode: number,
32
+ entries?: number,
33
+ extensions?: Array<string>,
34
+ packageExports: boolean
35
+ }
102
36
  export interface ResolveOptions {
103
37
  filename: string;
104
38
  specifierType: string;
@@ -148,9 +82,3 @@ declare export class Resolver {
148
82
  resolveAsync(options: ResolveOptions): Promise<ResolveResult>;
149
83
  getInvalidations(path: string): JsInvalidations;
150
84
  }
151
- declare export class ResolverOld {
152
- constructor(projectRoot: string, options: ResolverOptions): Resolver;
153
- resolve(options: ResolveOptions): ResolveResult;
154
- resolveAsync(options: ResolveOptions): Promise<ResolveResult>;
155
- getInvalidations(path: string): JsInvalidations;
156
- }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@parcel/rust",
3
- "version": "2.12.1-canary.3344+722893134",
3
+ "version": "2.12.1-canary.3350+5ecb1316c",
4
4
  "license": "MIT",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -31,14 +31,14 @@
31
31
  ],
32
32
  "devDependencies": {
33
33
  "@napi-rs/cli": "^2.15.2",
34
- "napi-wasm": "^1.0.1"
34
+ "napi-wasm": "^1.1.2"
35
35
  },
36
36
  "scripts": {
37
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",
38
+ "build-canary": "napi build --platform --profile canary --cargo-cwd ../../../crates/node-bindings",
39
39
  "build-release": "napi build --platform --release --cargo-cwd ../../../crates/node-bindings",
40
40
  "wasm:build": "cargo build -p parcel-node-bindings --target wasm32-unknown-unknown && cp ../../../target/wasm32-unknown-unknown/debug/parcel_node_bindings.wasm .",
41
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"
42
42
  },
43
- "gitHead": "7228931349c8b797105bcd79016c4c304b6e0f86"
43
+ "gitHead": "5ecb1316c23d22b89bd3e2fbb44137761cecfc70"
44
44
  }