@atlaspack/rust 2.12.1-dev.3443 → 2.12.1-dev.3460

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
@@ -88,7 +88,6 @@ export interface InlineRequiresOptimizerResult {
88
88
  sourceMap?: string
89
89
  }
90
90
  export function runInlineRequiresOptimizer(input: InlineRequiresOptimizerInput): InlineRequiresOptimizerResult
91
- export function replaceHashReferences(input: Buffer, hashRefToNameHash: Record<string, string>): Buffer
92
91
  export interface JsFileSystemOptions {
93
92
  canonicalize: (...args: any[]) => any
94
93
  read: (...args: any[]) => any
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, createAssetId, AtlaspackNapi, createDependencyId, createEnvironmentId, initializeMonitoring, closeMonitoring, registerWorker, runInlineRequiresOptimizer, replaceHashReferences, Resolver, transform, transformAsync } = nativeBinding
313
+ const { initTracingSubscriber, Lmdb, findAncestorFile, findFirstFile, findNodeModule, hashString, hashBuffer, Hash, optimizeImage, createAssetId, AtlaspackNapi, createDependencyId, createEnvironmentId, initializeMonitoring, closeMonitoring, registerWorker, runInlineRequiresOptimizer, Resolver, transform, transformAsync } = nativeBinding
314
314
 
315
315
  module.exports.initTracingSubscriber = initTracingSubscriber
316
316
  module.exports.Lmdb = Lmdb
@@ -329,7 +329,6 @@ module.exports.initializeMonitoring = initializeMonitoring
329
329
  module.exports.closeMonitoring = closeMonitoring
330
330
  module.exports.registerWorker = registerWorker
331
331
  module.exports.runInlineRequiresOptimizer = runInlineRequiresOptimizer
332
- module.exports.replaceHashReferences = replaceHashReferences
333
332
  module.exports.Resolver = Resolver
334
333
  module.exports.transform = transform
335
334
  module.exports.transformAsync = transformAsync
package/index.js.flow CHANGED
@@ -7,12 +7,14 @@ import type {
7
7
  PackageManager,
8
8
  } from '@atlaspack/types';
9
9
 
10
- import {decl} from 'postcss';
11
-
12
10
  declare export var init: void | (() => void);
13
11
 
14
12
  export type Transferable = {||};
15
13
 
14
+ export type JsCallable<Args: $ReadOnlyArray<mixed>, Return> = (
15
+ ...Args
16
+ ) => Return | Promise<Return>;
17
+
16
18
  export type ProjectPath = any;
17
19
  export interface ConfigRequest {
18
20
  id: string;
@@ -27,11 +29,12 @@ export interface ConfigRequest {
27
29
  export interface RequestOptions {}
28
30
 
29
31
  export interface FileSystem {
30
- canonicalize(path: FilePath): FilePath;
31
- cwd(): FilePath;
32
- isDir(path: FilePath): boolean;
33
- isFile(path: FilePath): boolean;
34
- readFile(path: FilePath, encoding?: Encoding): string;
32
+ canonicalize: JsCallable<[FilePath], FilePath>;
33
+ createDirectory: JsCallable<[FilePath], Promise<void>>;
34
+ cwd: JsCallable<[], FilePath>;
35
+ isDir: JsCallable<[FilePath], boolean>;
36
+ isFile: JsCallable<[FilePath], boolean>;
37
+ readFile: JsCallable<[FilePath, Encoding], string>;
35
38
  }
36
39
 
37
40
  export type AtlaspackNapiOptions = {|
@@ -94,25 +97,13 @@ declare export function findNodeModule(
94
97
  declare export function hashString(s: string): string;
95
98
  declare export function hashBuffer(buf: Buffer): string;
96
99
  declare export function optimizeImage(kind: string, buf: Buffer): Buffer;
97
- export interface JsFileSystemOptions {
98
- canonicalize: string => string;
99
- read: string => Buffer;
100
- isFile: string => boolean;
101
- isDir: string => boolean;
102
- includeNodeModules?: boolean | Array<string> | {|[string]: boolean|};
103
- }
100
+
104
101
  export interface ResolveOptions {
105
102
  filename: string;
106
103
  specifierType: string;
107
104
  parent: string;
108
105
  packageConditions?: Array<string>;
109
106
  }
110
- export type Resolution =
111
- | {|type: 'Path', value: string|}
112
- | {|type: 'Builtin', value: string|}
113
- | {|type: 'External'|}
114
- | {|type: 'Empty'|}
115
- | {|type: 'Global', value: string|};
116
107
 
117
108
  export interface ResolveResult {
118
109
  resolution: Resolution;
@@ -135,21 +126,159 @@ declare export class Hash {
135
126
  writeBuffer(b: Buffer): void;
136
127
  finish(): string;
137
128
  }
138
- export interface ResolverOptions {
139
- fs?: JsFileSystemOptions;
140
- includeNodeModules?: boolean | Array<string> | {|[string]: boolean|};
141
- conditions?: number;
142
- moduleDirResolver?: (...args: any[]) => any;
143
- mode: number;
144
- entries?: number;
145
- extensions?: Array<string>;
146
- }
129
+
130
+ export type Engines = {|
131
+ atlaspack?: string,
132
+ browsers?: string | string[],
133
+ electron?: string,
134
+ node?: string,
135
+ |};
136
+
137
+ export type Environment = {|
138
+ context: string,
139
+ engines: Engines,
140
+ includeNodeModules: IncludeNodeModules,
141
+ isLibrary: boolean,
142
+ loc?: SourceLocation,
143
+ outputFormat: string,
144
+ shouldScopeHoist: boolean,
145
+ shouldOptimize: boolean,
146
+ sourceMap?: {|
147
+ inline?: boolean,
148
+ inlineSources?: boolean,
149
+ sourceRoot?: string,
150
+ |},
151
+ sourceType: string,
152
+ |};
153
+
154
+ export type SourceLocation = {|
155
+ filePath: string,
156
+ start: {|
157
+ line: number,
158
+ column: number,
159
+ |},
160
+ end: {|
161
+ line: number,
162
+ column: number,
163
+ |},
164
+ |};
165
+
166
+ export type Symbol = {|
167
+ local: string,
168
+ exported: string,
169
+ loc?: SourceLocation,
170
+ isWeak: boolean,
171
+ isEsmExport: boolean,
172
+ selfReferenced: boolean,
173
+ |};
174
+
175
+ export type Target = {|
176
+ distDir: string,
177
+ distEntry?: string,
178
+ env: Environment,
179
+ loc?: SourceLocation,
180
+ name: string,
181
+ publicUrl: string,
182
+ |};
183
+
184
+ export type Dependency = {|
185
+ bundleBehavior?: number,
186
+ env: Environment,
187
+ loc: SourceLocation,
188
+ meta?: any,
189
+ packageConditions: number[],
190
+ pipeline?: string,
191
+ priority: number,
192
+ range?: string,
193
+ resolveFrom?: string,
194
+ sourceAssetId?: string,
195
+ sourcePath?: string,
196
+ specifier: string,
197
+ specifierType: number,
198
+ sourceAssetType?: string,
199
+ symbols?: Symbol[],
200
+ target?: Target,
201
+ isEntry: boolean,
202
+ isOptional: boolean,
203
+ needsStableName: boolean,
204
+ shouldWrap: boolean,
205
+ isEsm: boolean,
206
+ placeholder?: string,
207
+ |};
208
+
209
+ export type RpcAssetResult = {|
210
+ id: string,
211
+ bundleBehavior: ?number,
212
+ filePath: string,
213
+ type: string,
214
+ code: Array<number>,
215
+ meta: any,
216
+ pipeline?: ?string,
217
+ query?: string,
218
+ symbols?: Symbol[],
219
+ uniqueKey?: ?string,
220
+ sideEffects: boolean,
221
+ isBundleSplittable: boolean,
222
+ isSource: boolean,
223
+ |};
224
+
225
+ export type RpcTransformerOpts = {|
226
+ resolveFrom: string,
227
+ specifier: string,
228
+ options: RpcPluginOptions,
229
+ asset: Asset,
230
+ |};
231
+
232
+ export type RpcHmrOptions = {|
233
+ port?: number,
234
+ host?: string,
235
+ |};
236
+
237
+ export type RpcPluginOptions = {|
238
+ hmrOptions?: RpcHmrOptions,
239
+ projectRoot: string,
240
+ |};
241
+
242
+ export type Asset = {|
243
+ id: string,
244
+ bundleBehavior: number,
245
+ env: Environment,
246
+ filePath: string,
247
+ type: string,
248
+ code: Array<number>,
249
+ meta: any,
250
+ pipeline?: string,
251
+ query?: string,
252
+ stats: {|
253
+ size: number,
254
+ time: number,
255
+ |},
256
+ symbols?: Symbol[],
257
+ uniqueKey?: string,
258
+ sideEffects: boolean,
259
+ isBundleSplittable: boolean,
260
+ isSource: boolean,
261
+ hasCjsExports: boolean,
262
+ staticExports: boolean,
263
+ shouldWrap: boolean,
264
+ hasNodeReplacements: boolean,
265
+ isConstantModule: boolean,
266
+ conditions: Array<{|
267
+ key: string,
268
+ ifTruePlaceholder?: string,
269
+ ifFalsePlaceholder?: string,
270
+ |}>,
271
+ configPath?: string,
272
+ configKeyPath?: string,
273
+ |};
274
+
147
275
  declare export class Resolver {
148
276
  constructor(projectRoot: string, options: ResolverOptions): Resolver;
149
277
  resolve(options: ResolveOptions): ResolveResult;
150
278
  resolveAsync(options: ResolveOptions): Promise<ResolveResult>;
151
279
  getInvalidations(path: string): JsInvalidations;
152
280
  }
281
+
153
282
  export interface LmdbOptions {
154
283
  /** The database directory path */
155
284
  path: string;
@@ -208,7 +337,34 @@ declare export function createAssetId(params: mixed): string;
208
337
  declare export function createDependencyId(params: mixed): string;
209
338
  declare export function createEnvironmentId(params: mixed): string;
210
339
 
211
- declare export function replaceHashReferences(
212
- input: Buffer,
213
- hashRefToNameHash: {[key: string]: string},
214
- ): Buffer;
340
+ export interface ResolverOptions {
341
+ fs?: JsFileSystemOptions;
342
+ includeNodeModules?: IncludeNodeModules;
343
+ conditions?: number;
344
+ moduleDirResolver?: (...args: any[]) => any;
345
+ mode: number;
346
+ entries?: number;
347
+ extensions?: Array<string>;
348
+ }
349
+
350
+ export interface JsFileSystemOptions {
351
+ canonicalize: (string) => string;
352
+ read: (string) => Buffer;
353
+ isFile: (string) => boolean;
354
+ isDir: (string) => boolean;
355
+ includeNodeModules?: IncludeNodeModules;
356
+ }
357
+
358
+ // Types below break IDE highlighting, place them at the bottom of the file
359
+
360
+ export type IncludeNodeModules =
361
+ | boolean
362
+ | Array<string>
363
+ | {|[string]: boolean|};
364
+
365
+ export type Resolution =
366
+ | {|type: 'Path', value: string|}
367
+ | {|type: 'Builtin', value: string|}
368
+ | {|type: 'External'|}
369
+ | {|type: 'Empty'|}
370
+ | {|type: 'Global', value: string|};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaspack/rust",
3
- "version": "2.12.1-dev.3443+d1170cfc7",
3
+ "version": "2.12.1-dev.3460+340817991",
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": "d1170cfc79beb290b2a066f472f68f71f7d7cb23"
40
+ "gitHead": "3408179911d6c67e2bdad99e545dd7a0a9a6782c"
41
41
  }