@atlaspack/rust 2.13.2-canary.3657 → 2.13.2-canary.3658

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/index.d.ts CHANGED
@@ -38,43 +38,20 @@ export declare function hashString(s: string): string
38
38
  export declare function hashBuffer(buf: Buffer): string
39
39
  export declare function optimizeImage(kind: string, buf: Buffer): Buffer
40
40
  export declare function createAssetId(params: unknown): string
41
- export interface AtlaspackNapiBuildOptions {
42
- registerWorker: (...args: any[]) => any
43
- }
44
41
  export interface AtlaspackNapiOptions {
45
42
  fs?: object
46
- nodeWorkers?: number
47
43
  options: object
48
44
  packageManager?: object
49
45
  threads?: number
46
+ napiWorkerPool: object
50
47
  }
51
48
  export declare function createDependencyId(params: unknown): string
52
49
  export declare function createEnvironmentId(params: unknown): string
50
+ export declare function getAvailableThreads(): number
53
51
  export declare function initializeMonitoring(): void
54
52
  export declare function closeMonitoring(): void
55
- /**
56
- * This function is run in the Nodejs worker context upon initialization
57
- * to notify the main thread that a Nodejs worker thread has started
58
- *
59
- * A Rust channel is transferred to the worker via JavaScript `worker.postMessage`.
60
- * The worker then calls `register_worker`, supplying it with an object containing
61
- * callbacks.
62
- *
63
- * The callbacks are later called from the main thread to send work to the worker.
64
- *
65
- * |-------------| --- Init channel ----> |-------------------|
66
- * | Main Thread | | Worker Thread (n) |
67
- * |-------------| <-- Worker wrapper --- |-------------------|
68
- *
69
- * **Later During Build**
70
- *
71
- * -- Resolver.resolve -->
72
- * <- DependencyResult ---
73
- *
74
- * -- Transf.transform -->
75
- * <--- Array<Asset> -----
76
- */
77
- export declare function registerWorker(channel: JsTransferable, worker: object): void
53
+ /** Called on the worker thread to create a reference to the NodeJs worker */
54
+ export declare function newNodejsWorker(worker: object): JsTransferable
78
55
  export interface InlineRequiresOptimizerInput {
79
56
  code: string
80
57
  sourceMaps: boolean
@@ -180,9 +157,8 @@ export class AtlaspackTracer {
180
157
  exit(id: SpanId): void
181
158
  }
182
159
  export class AtlaspackNapi {
183
- nodeWorkerCount: number
184
160
  static create(napiOptions: AtlaspackNapiOptions, lmdb: LMDB): AtlaspackNapi
185
- buildAssetGraph(options: AtlaspackNapiBuildOptions): object
161
+ buildAssetGraph(): object
186
162
  respondToFsEvents(options: object): object
187
163
  }
188
164
  export class Resolver {
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 { initTracingSubscriber, Lmdb, findAncestorFile, findFirstFile, findNodeModule, hashString, hashBuffer, Hash, optimizeImage, AtlaspackTracer, createAssetId, AtlaspackNapi, createDependencyId, createEnvironmentId, initializeMonitoring, closeMonitoring, registerWorker, runInlineRequiresOptimizer, Resolver, transform, transformAsync, getVcsStateSnapshot, getEventsSince } = nativeBinding
313
+ const { initTracingSubscriber, Lmdb, findAncestorFile, findFirstFile, findNodeModule, hashString, hashBuffer, Hash, optimizeImage, AtlaspackTracer, createAssetId, AtlaspackNapi, createDependencyId, createEnvironmentId, getAvailableThreads, initializeMonitoring, closeMonitoring, newNodejsWorker, runInlineRequiresOptimizer, Resolver, transform, transformAsync, getVcsStateSnapshot, getEventsSince } = nativeBinding
314
314
 
315
315
  module.exports.initTracingSubscriber = initTracingSubscriber
316
316
  module.exports.Lmdb = Lmdb
@@ -326,9 +326,10 @@ module.exports.createAssetId = createAssetId
326
326
  module.exports.AtlaspackNapi = AtlaspackNapi
327
327
  module.exports.createDependencyId = createDependencyId
328
328
  module.exports.createEnvironmentId = createEnvironmentId
329
+ module.exports.getAvailableThreads = getAvailableThreads
329
330
  module.exports.initializeMonitoring = initializeMonitoring
330
331
  module.exports.closeMonitoring = closeMonitoring
331
- module.exports.registerWorker = registerWorker
332
+ module.exports.newNodejsWorker = newNodejsWorker
332
333
  module.exports.runInlineRequiresOptimizer = runInlineRequiresOptimizer
333
334
  module.exports.Resolver = Resolver
334
335
  module.exports.transform = transform
package/index.js.flow CHANGED
@@ -49,6 +49,7 @@ export interface FileSystem {
49
49
  export type AtlaspackNapiOptions = {|
50
50
  fs?: FileSystem,
51
51
  nodeWorkers?: number,
52
+ napiWorkerPool: any,
52
53
  options: {|
53
54
  featureFlags?: { [string]: string | boolean },
54
55
  corePath?: string,
@@ -66,15 +67,10 @@ export type AtlaspackNapiOptions = {|
66
67
  threads?: number,
67
68
  |};
68
69
 
69
- export type AtlaspackBuildOptions = {|
70
- registerWorker: (channel: Transferable) => void | Promise<void>,
71
- |};
72
-
73
70
  declare export class AtlaspackNapi {
74
71
  static create(options: AtlaspackNapiOptions, lmdb: mixed): AtlaspackNapi;
75
72
  nodeWorkerCount: number;
76
- build(options: AtlaspackBuildOptions): Promise<void>;
77
- buildAssetGraph(options: AtlaspackBuildOptions): Promise<any>;
73
+ buildAssetGraph(): Promise<any>;
78
74
  respondToFsEvents(events: WatchEvents): boolean;
79
75
  static defaultThreadCount(): number;
80
76
  testingTempFsReadToString(path: string): string;
@@ -83,11 +79,17 @@ declare export class AtlaspackNapi {
83
79
  testingRpcPing(): void;
84
80
  }
85
81
 
82
+ declare export function getAvailableThreads(): number;
83
+
86
84
  declare export function registerWorker(
87
85
  channel: Transferable,
88
86
  worker: any,
89
87
  ): void;
90
88
 
89
+ declare export function newNodejsWorker(
90
+ delegate: any,
91
+ ): Transferable;
92
+
91
93
  declare export function initializeMonitoring(): void;
92
94
  declare export function closeMonitoring(): void;
93
95
  declare export function napiRunConfigRequest(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaspack/rust",
3
- "version": "2.13.2-canary.3657+93732232c",
3
+ "version": "2.13.2-canary.3658+4812d0f74",
4
4
  "license": "(MIT OR Apache-2.0)",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -37,5 +37,5 @@
37
37
  "wasm:build": "cargo build -p atlaspack-node-bindings --target wasm32-unknown-unknown && cp ../../../target/wasm32-unknown-unknown/debug/atlaspack_node_bindings.wasm .",
38
38
  "wasm:build-release": "CARGO_PROFILE_RELEASE_LTO=true cargo build -p atlaspack-node-bindings --target wasm32-unknown-unknown --release && wasm-opt --strip-debug -O ../../../target/wasm32-unknown-unknown/release/atlaspack_node_bindings.wasm -o atlaspack_node_bindings.wasm"
39
39
  },
40
- "gitHead": "93732232c38c42c9357356bdfd8325cd0bc2536d"
40
+ "gitHead": "4812d0f7400af0f8416f1b7175ecb87700860a68"
41
41
  }