@atlaspack/rust 3.2.1-canary.21 → 3.2.1-canary.210

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
@@ -46,6 +46,14 @@ export declare function atlaspackNapiBuildAssetGraph(atlaspackNapi: AtlaspackNap
46
46
  export declare function atlaspackNapiRespondToFsEvents(atlaspackNapi: AtlaspackNapi, options: object): object
47
47
  export declare function createDependencyId(params: unknown): string
48
48
  export declare function createEnvironmentId(params: unknown): string
49
+ /** Overwrite all environments with a new set of environments */
50
+ export declare function setAllEnvironments(environments: unknown): void
51
+ /** Get an array of all environments */
52
+ export declare function getAllEnvironments(): Array<unknown>
53
+ /** Get environment by ID */
54
+ export declare function getEnvironment(id: string): unknown
55
+ /** Add an environment to the global manager */
56
+ export declare function addEnvironment(environment: unknown): void
49
57
  export declare function getAvailableThreads(): number
50
58
  export declare function initializeMonitoring(): void
51
59
  export declare function closeMonitoring(): void
@@ -61,6 +69,7 @@ export interface InlineRequiresOptimizerResult {
61
69
  sourceMap?: string
62
70
  }
63
71
  export declare function runInlineRequiresOptimizer(input: InlineRequiresOptimizerInput): InlineRequiresOptimizerResult
72
+ /** Runs in the rayon thread pool */
64
73
  export declare function runInlineRequiresOptimizerAsync(input: InlineRequiresOptimizerInput): object
65
74
  export interface JsFileSystemOptions {
66
75
  canonicalize: (...args: any[]) => any
@@ -136,7 +145,6 @@ export class Lmdb {
136
145
  commitReadTransaction(): void
137
146
  startWriteTransaction(): Promise<void>
138
147
  commitWriteTransaction(): Promise<void>
139
- close(): void
140
148
  /** Compact the database to the target path */
141
149
  compact(targetPath: string): void
142
150
  constructor(options: LMDBOptions)
@@ -153,7 +161,6 @@ export class Lmdb {
153
161
  commitReadTransaction(): void
154
162
  startWriteTransaction(): Promise<void>
155
163
  commitWriteTransaction(): Promise<void>
156
- close(): void
157
164
  compact(targetPath: string): void
158
165
  }
159
166
  export class Hash {
Binary file
Binary file
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, atlaspackNapiCreate, atlaspackNapiBuildAssetGraph, atlaspackNapiRespondToFsEvents, createDependencyId, createEnvironmentId, getAvailableThreads, initializeMonitoring, closeMonitoring, newNodejsWorker, runInlineRequiresOptimizer, runInlineRequiresOptimizerAsync, Resolver, performStringReplacements, transform, transformAsync, getVcsStateSnapshot, getEventsSince } = nativeBinding
313
+ const { initTracingSubscriber, Lmdb, findAncestorFile, findFirstFile, findNodeModule, hashString, hashBuffer, Hash, optimizeImage, AtlaspackTracer, createAssetId, atlaspackNapiCreate, atlaspackNapiBuildAssetGraph, atlaspackNapiRespondToFsEvents, createDependencyId, createEnvironmentId, setAllEnvironments, getAllEnvironments, getEnvironment, addEnvironment, getAvailableThreads, initializeMonitoring, closeMonitoring, newNodejsWorker, runInlineRequiresOptimizer, runInlineRequiresOptimizerAsync, Resolver, performStringReplacements, transform, transformAsync, getVcsStateSnapshot, getEventsSince } = nativeBinding
314
314
 
315
315
  module.exports.initTracingSubscriber = initTracingSubscriber
316
316
  module.exports.Lmdb = Lmdb
@@ -328,6 +328,10 @@ module.exports.atlaspackNapiBuildAssetGraph = atlaspackNapiBuildAssetGraph
328
328
  module.exports.atlaspackNapiRespondToFsEvents = atlaspackNapiRespondToFsEvents
329
329
  module.exports.createDependencyId = createDependencyId
330
330
  module.exports.createEnvironmentId = createEnvironmentId
331
+ module.exports.setAllEnvironments = setAllEnvironments
332
+ module.exports.getAllEnvironments = getAllEnvironments
333
+ module.exports.getEnvironment = getEnvironment
334
+ module.exports.addEnvironment = addEnvironment
331
335
  module.exports.getAvailableThreads = getAvailableThreads
332
336
  module.exports.initializeMonitoring = initializeMonitoring
333
337
  module.exports.closeMonitoring = closeMonitoring
Binary file
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaspack/rust",
3
- "version": "3.2.1-canary.21+3a3e8e7be",
3
+ "version": "3.2.1-canary.210+42cd56810",
4
4
  "license": "(MIT OR Apache-2.0)",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -11,6 +11,7 @@
11
11
  },
12
12
  "main": "index.js",
13
13
  "browser": "browser.js",
14
+ "types": "./types.d.ts",
14
15
  "napi": {
15
16
  "name": "atlaspack-node-bindings",
16
17
  "permittedTargets": "*"
@@ -20,7 +21,8 @@
20
21
  },
21
22
  "files": [
22
23
  "browser.js",
23
- "index.d.ts",
24
+ "types.d.ts",
25
+ "*.d.ts",
24
26
  "index.js",
25
27
  "index.js.flow",
26
28
  "*.node",
@@ -31,8 +33,9 @@
31
33
  "napi-wasm": "^1.0.1"
32
34
  },
33
35
  "scripts": {
34
- "test": "mocha"
36
+ "test": "mocha",
37
+ "build:lib": "gulp build --gulpfile ../../../gulpfile.js --cwd ."
35
38
  },
36
39
  "type": "commonjs",
37
- "gitHead": "3a3e8e7be9e2dffd7304436d792f0f595d59665a"
40
+ "gitHead": "42cd568106f1837e85b76a38bf3adaaef8973099"
38
41
  }
package/types.d.ts ADDED
@@ -0,0 +1,251 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+
4
+ export type AtlaspackNapi = any;
5
+ export type JsTransferable = any;
6
+ export type NapiSideEffectsVariants = any;
7
+ export type LMDBOptions = any;
8
+ export type SpanId = any;
9
+
10
+ export interface LmdbOptions {
11
+ /** The database directory path */
12
+ path: string;
13
+ /**
14
+ * If enabled, the database writer will set the following flags:
15
+ *
16
+ * * MAP_ASYNC - "use asynchronous msync when MDB_WRITEMAP is used"
17
+ * * NO_SYNC - "don't fsync after commit"
18
+ * * NO_META_SYNC - "don't fsync metapage after commit"
19
+ *
20
+ * `MDB_WRITEMAP` is on by default.
21
+ */
22
+ asyncWrites: boolean;
23
+ /**
24
+ * The mmap size, this corresponds to [`mdb_env_set_mapsize`](http://www.lmdb.tech/doc/group__mdb.html#gaa2506ec8dab3d969b0e609cd82e619e5)
25
+ * if this isn't set it'll default to around 10MB.
26
+ */
27
+ mapSize?: number;
28
+ }
29
+ export declare function initTracingSubscriber(): void;
30
+ export interface Entry {
31
+ key: string;
32
+ value: Buffer;
33
+ }
34
+ export declare function findAncestorFile(
35
+ filenames: Array<string>,
36
+ from: string,
37
+ root: string,
38
+ ): string | null;
39
+ export declare function findFirstFile(names: Array<string>): string | null;
40
+ export declare function findNodeModule(
41
+ module: string,
42
+ from: string,
43
+ ): string | null;
44
+ export declare function hashString(s: string): string;
45
+ export declare function hashBuffer(buf: Buffer): string;
46
+ export declare function optimizeImage(kind: string, buf: Buffer): Buffer;
47
+ export declare function createAssetId(params: unknown): string;
48
+ export interface AtlaspackNapiOptions {
49
+ fs?: object;
50
+ options: object;
51
+ packageManager?: object;
52
+ threads?: number;
53
+ napiWorkerPool: object;
54
+ }
55
+ export declare function atlaspackNapiCreate(
56
+ napiOptions: AtlaspackNapiOptions,
57
+ lmdb: LMDB,
58
+ ): object;
59
+ export declare function atlaspackNapiBuildAssetGraph(
60
+ atlaspackNapi: AtlaspackNapi,
61
+ ): object;
62
+ export declare function atlaspackNapiRespondToFsEvents(
63
+ atlaspackNapi: AtlaspackNapi,
64
+ options: object,
65
+ ): object;
66
+ export declare function createDependencyId(params: unknown): string;
67
+ export declare function createEnvironmentId(params: unknown): string;
68
+ /** Overwrite all environments with a new set of environments */
69
+ export declare function setAllEnvironments(environments: unknown): void;
70
+ /** Get an array of all environments */
71
+ export declare function getAllEnvironments(): Array<unknown>;
72
+ /** Get environment by ID */
73
+ export declare function getEnvironment(id: string): unknown;
74
+ /** Add an environment to the global manager */
75
+ export declare function addEnvironment(environment: unknown): void;
76
+ export declare function getAvailableThreads(): number;
77
+ export declare function initializeMonitoring(): void;
78
+ export declare function closeMonitoring(): void;
79
+ /** Called on the worker thread to create a reference to the NodeJs worker */
80
+ export declare function newNodejsWorker(worker: object): JsTransferable;
81
+ export interface InlineRequiresOptimizerInput {
82
+ code: string;
83
+ sourceMaps: boolean;
84
+ ignoreModuleIds: Array<string>;
85
+ }
86
+ export interface InlineRequiresOptimizerResult {
87
+ code: string;
88
+ sourceMap?: string;
89
+ }
90
+ export declare function runInlineRequiresOptimizer(
91
+ input: InlineRequiresOptimizerInput,
92
+ ): InlineRequiresOptimizerResult;
93
+ /** Runs in the rayon thread pool */
94
+ export declare function runInlineRequiresOptimizerAsync(
95
+ input: InlineRequiresOptimizerInput,
96
+ ): object;
97
+ export interface JsFileSystemOptions {
98
+ canonicalize: (...args: any[]) => any;
99
+ read: (...args: any[]) => any;
100
+ isFile: (...args: any[]) => any;
101
+ isDir: (...args: any[]) => any;
102
+ includeNodeModules?: NapiSideEffectsVariants;
103
+ }
104
+ export interface FileSystem {
105
+ fs?: JsFileSystemOptions;
106
+ includeNodeModules?: NapiSideEffectsVariants;
107
+ conditions?: number;
108
+ moduleDirResolver?: (...args: any[]) => any;
109
+ mode: number;
110
+ entries?: number;
111
+ extensions?: Array<string>;
112
+ packageExports: boolean;
113
+ typescript?: boolean;
114
+ reduceStringCreation?: boolean;
115
+ }
116
+ export interface ResolveOptions {
117
+ filename: string;
118
+ specifierType: string;
119
+ parent: string;
120
+ packageConditions?: Array<string>;
121
+ }
122
+ export interface FilePathCreateInvalidation {
123
+ filePath: string;
124
+ }
125
+ export interface FileNameCreateInvalidation {
126
+ fileName: string;
127
+ aboveFilePath: string;
128
+ }
129
+ export interface GlobCreateInvalidation {
130
+ glob: string;
131
+ }
132
+ export interface ResolveResult {
133
+ resolution: unknown;
134
+ invalidateOnFileChange: Array<string>;
135
+ invalidateOnFileCreate: Array<
136
+ | FilePathCreateInvalidation
137
+ | FileNameCreateInvalidation
138
+ | GlobCreateInvalidation
139
+ >;
140
+ query?: string;
141
+ sideEffects: boolean;
142
+ error: unknown;
143
+ moduleType: number;
144
+ }
145
+ export interface JsInvalidations {
146
+ invalidateOnFileChange: Array<string>;
147
+ invalidateOnFileCreate: Array<
148
+ | FilePathCreateInvalidation
149
+ | FileNameCreateInvalidation
150
+ | GlobCreateInvalidation
151
+ >;
152
+ invalidateOnStartup: boolean;
153
+ }
154
+ export interface Replacement {
155
+ from: string;
156
+ to: string;
157
+ }
158
+ export declare function performStringReplacements(
159
+ input: string,
160
+ replacements: Array<Replacement>,
161
+ ): string;
162
+ export declare function transform(opts: object): unknown;
163
+ export declare function transformAsync(opts: object): object;
164
+ export declare function getVcsStateSnapshot(
165
+ path: string,
166
+ excludePatterns: Array<string>,
167
+ ): object;
168
+ export declare function getEventsSince(
169
+ repoPath: string,
170
+ vcsStateSnapshot: unknown,
171
+ newRev?: string | undefined | null,
172
+ ): object;
173
+ export type LMDB = Lmdb;
174
+ export class Lmdb {
175
+ constructor(options: LmdbOptions);
176
+ get(key: string): Promise<Buffer | null | undefined>;
177
+ hasSync(key: string): boolean;
178
+ keysSync(skip: number, limit: number): Array<string>;
179
+ getSync(key: string): Buffer | null;
180
+ getManySync(keys: Array<string>): Array<Buffer | undefined | null>;
181
+ putMany(entries: Array<Entry>): Promise<void>;
182
+ put(key: string, data: Buffer): Promise<void>;
183
+ putNoConfirm(key: string, data: Buffer): void;
184
+ delete(key: string): Promise<void>;
185
+ startReadTransaction(): void;
186
+ commitReadTransaction(): void;
187
+ startWriteTransaction(): Promise<void>;
188
+ commitWriteTransaction(): Promise<void>;
189
+ /** Compact the database to the target path */
190
+ compact(targetPath: string): void;
191
+ constructor(options: LMDBOptions);
192
+ get(key: string): Promise<Buffer | null | undefined>;
193
+ hasSync(key: string): boolean;
194
+ keysSync(skip: number, limit: number): Array<string>;
195
+ getSync(key: string): Buffer | null;
196
+ getManySync(keys: Array<string>): Array<Buffer | undefined | null>;
197
+ putMany(entries: Array<Entry>): Promise<void>;
198
+ put(key: string, data: Buffer): Promise<void>;
199
+ delete(key: string): Promise<void>;
200
+ putNoConfirm(key: string, data: Buffer): void;
201
+ startReadTransaction(): void;
202
+ commitReadTransaction(): void;
203
+ startWriteTransaction(): Promise<void>;
204
+ commitWriteTransaction(): Promise<void>;
205
+ compact(targetPath: string): void;
206
+ }
207
+ export class Hash {
208
+ constructor();
209
+ writeString(s: string): void;
210
+ writeBuffer(buf: Buffer): void;
211
+ finish(): string;
212
+ }
213
+ export class AtlaspackTracer {
214
+ constructor();
215
+ enter(label: string): SpanId;
216
+ exit(id: SpanId): void;
217
+ }
218
+ export class Resolver {
219
+ constructor(projectRoot: string, options: FileSystem);
220
+ resolve(options: ResolveOptions): ResolveResult;
221
+ resolveAsync(): object;
222
+ resolveAsync(options: ResolveOptions): object;
223
+ getInvalidations(path: string): JsInvalidations;
224
+ getInvalidations(path: string): JsInvalidations;
225
+ }
226
+
227
+ export interface SourceLocation {
228
+ filePath: string;
229
+ start: {
230
+ line: number;
231
+ column: number;
232
+ line: number;
233
+ column: number;
234
+ };
235
+ end: {
236
+ line: number;
237
+ column: number;
238
+ line: number;
239
+ column: number;
240
+ };
241
+ }
242
+
243
+ export interface Symbol {
244
+ local: string;
245
+ exported: string;
246
+ loc?: SourceLocation;
247
+ isWeak: boolean;
248
+ isEsmExport: boolean;
249
+ isStaticBindingSafe: boolean;
250
+ selfReferenced: boolean;
251
+ }
package/index.js.flow DELETED
@@ -1,439 +0,0 @@
1
- // @flow
2
- import type {
3
- Encoding,
4
- FileCreateInvalidation,
5
- FilePath,
6
- InitialAtlaspackOptions,
7
- PackageManager,
8
- } from '@atlaspack/types';
9
-
10
- // This is defined in browser.js for wasm builds
11
- declare export var init: void | (() => void);
12
-
13
- export type WatchEventType = 'create' | 'update' | 'delete';
14
-
15
- export interface WatchEvent {
16
- path: string;
17
- type: WatchEventType;
18
- }
19
-
20
- export type WatchEvents = Array<WatchEvent>;
21
-
22
- export type Transferable = {||};
23
-
24
- export type JsCallable<Args: $ReadOnlyArray<mixed>, Return> = (
25
- ...Args
26
- ) => Return | Promise<Return>;
27
-
28
- export type ProjectPath = any;
29
- export interface ConfigRequest {
30
- id: string;
31
- invalidateOnFileChange: Array<ProjectPath>;
32
- invalidateOnConfigKeyChange: Array<any>;
33
- invalidateOnFileCreate: Array<any>;
34
- invalidateOnEnvChange: Array<string>;
35
- invalidateOnOptionChange: Array<string>;
36
- invalidateOnStartup: boolean;
37
- invalidateOnBuild: boolean;
38
- }
39
- export interface RequestOptions {}
40
-
41
- export interface FileSystem {
42
- canonicalize: JsCallable<[FilePath], FilePath>;
43
- createDirectory: JsCallable<[FilePath], Promise<void>>;
44
- cwd: JsCallable<[], FilePath>;
45
- isDir: JsCallable<[FilePath], boolean>;
46
- isFile: JsCallable<[FilePath], boolean>;
47
- readFile: JsCallable<[FilePath, Encoding], string>;
48
- }
49
-
50
- export type AtlaspackNapiOptions = {|
51
- fs?: FileSystem,
52
- nodeWorkers?: number,
53
- napiWorkerPool: any,
54
- options: {|
55
- featureFlags?: {[string]: string | boolean},
56
- corePath?: string,
57
- // TODO Use Omit when available in flow >0.210.0
58
- ...$Diff<
59
- InitialAtlaspackOptions,
60
- {|
61
- inputFS: InitialAtlaspackOptions['inputFS'],
62
- outputFS: InitialAtlaspackOptions['outputFS'],
63
- packageManager: InitialAtlaspackOptions['packageManager'],
64
- |},
65
- >,
66
- |},
67
- packageManager?: PackageManager,
68
- threads?: number,
69
- |};
70
-
71
- // AtlaspackNapi
72
- export type AtlaspackNapi = {||};
73
- declare export function atlaspackNapiCreate(
74
- options: AtlaspackNapiOptions,
75
- lmdb: mixed,
76
- ): Promise<AtlaspackNapi>;
77
- declare export function atlaspackNapiBuildAssetGraph(
78
- atlaspack: AtlaspackNapi,
79
- ): Promise<any>;
80
- declare export function atlaspackNapiRespondToFsEvents(
81
- atlaspack: AtlaspackNapi,
82
- events: WatchEvents,
83
- ): boolean;
84
- // AtlaspackNapi
85
-
86
- declare export function getAvailableThreads(): number;
87
-
88
- declare export function newNodejsWorker(delegate: any): Transferable;
89
-
90
- declare export function initializeMonitoring(): void;
91
- declare export function closeMonitoring(): void;
92
- declare export function napiRunConfigRequest(
93
- configRequest: ConfigRequest,
94
- api: any,
95
- options: any,
96
- ): void;
97
- declare export function findAncestorFile(
98
- filenames: Array<string>,
99
- from: string,
100
- root: string,
101
- ): string | null;
102
- declare export function findFirstFile(names: Array<string>): string | null;
103
- declare export function findNodeModule(
104
- module: string,
105
- from: string,
106
- ): string | null;
107
- declare export function hashString(s: string): string;
108
- declare export function hashBuffer(buf: Buffer): string;
109
- declare export function optimizeImage(kind: string, buf: Buffer): Buffer;
110
-
111
- export interface ResolveOptions {
112
- filename: string;
113
- specifierType: string;
114
- parent: string;
115
- packageConditions?: Array<string>;
116
- }
117
-
118
- export interface ResolveResult {
119
- resolution: Resolution;
120
- invalidateOnFileChange: Array<string>;
121
- invalidateOnFileCreate: Array<FileCreateInvalidation>;
122
- query?: string;
123
- sideEffects: boolean;
124
- error: mixed;
125
- moduleType: number;
126
- }
127
- export interface JsInvalidations {
128
- invalidateOnFileChange: Array<string>;
129
- invalidateOnFileCreate: Array<FileCreateInvalidation>;
130
- invalidateOnStartup: boolean;
131
- }
132
- declare export function transform(opts: any): any;
133
- declare export function transformAsync(opts: any): Promise<any>;
134
- declare export class Hash {
135
- writeString(s: string): void;
136
- writeBuffer(b: Buffer): void;
137
- finish(): string;
138
- }
139
-
140
- export type Engines = {|
141
- atlaspack?: string,
142
- browsers?: string | string[],
143
- electron?: string,
144
- node?: string,
145
- |};
146
-
147
- export type Environment = {|
148
- context: string,
149
- engines: Engines,
150
- includeNodeModules: IncludeNodeModules,
151
- isLibrary: boolean,
152
- loc?: SourceLocation,
153
- outputFormat: string,
154
- shouldScopeHoist: boolean,
155
- shouldOptimize: boolean,
156
- sourceMap?: {|
157
- inline?: boolean,
158
- inlineSources?: boolean,
159
- sourceRoot?: string,
160
- |},
161
- sourceType: string,
162
- |};
163
-
164
- export type SourceLocation = {|
165
- filePath: string,
166
- start: {|
167
- line: number,
168
- column: number,
169
- |},
170
- end: {|
171
- line: number,
172
- column: number,
173
- |},
174
- |};
175
-
176
- export type Symbol = {|
177
- local: string,
178
- exported: string,
179
- loc?: SourceLocation,
180
- isWeak: boolean,
181
- isEsmExport: boolean,
182
- selfReferenced: boolean,
183
- |};
184
-
185
- export type Target = {|
186
- distDir: string,
187
- distEntry?: string,
188
- env: Environment,
189
- loc?: SourceLocation,
190
- name: string,
191
- publicUrl: string,
192
- |};
193
-
194
- export type Dependency = {|
195
- bundleBehavior?: number,
196
- env: Environment,
197
- loc: SourceLocation,
198
- meta?: any,
199
- packageConditions: number[],
200
- pipeline?: string,
201
- priority: number,
202
- range?: string,
203
- resolveFrom?: string,
204
- sourceAssetId?: string,
205
- sourcePath?: string,
206
- specifier: string,
207
- specifierType: number,
208
- sourceAssetType?: string,
209
- symbols?: Symbol[],
210
- target?: Target,
211
- isEntry: boolean,
212
- isOptional: boolean,
213
- needsStableName: boolean,
214
- shouldWrap: boolean,
215
- isEsm: boolean,
216
- placeholder?: string,
217
- |};
218
-
219
- export type RpcAssetResult = {|
220
- id: string,
221
- bundleBehavior: ?number,
222
- filePath: string,
223
- type: string,
224
- code: Array<number>,
225
- meta: any,
226
- pipeline?: ?string,
227
- query?: string,
228
- symbols?: Symbol[],
229
- uniqueKey?: ?string,
230
- sideEffects: boolean,
231
- isBundleSplittable: boolean,
232
- isSource: boolean,
233
- |};
234
-
235
- export type RpcTransformerOpts = {|
236
- resolveFrom: string,
237
- specifier: string,
238
- options: RpcPluginOptions,
239
- asset: Asset,
240
- |};
241
-
242
- export type RpcHmrOptions = {|
243
- port?: number,
244
- host?: string,
245
- |};
246
-
247
- export type RpcPluginOptions = {|
248
- hmrOptions?: RpcHmrOptions,
249
- projectRoot: string,
250
- |};
251
-
252
- export type Asset = {|
253
- id: string,
254
- bundleBehavior: number,
255
- env: Environment,
256
- filePath: string,
257
- type: string,
258
- code: Array<number>,
259
- meta: any,
260
- pipeline?: string,
261
- query?: string,
262
- stats: {|
263
- size: number,
264
- time: number,
265
- |},
266
- symbols?: Symbol[],
267
- uniqueKey?: string,
268
- sideEffects: boolean,
269
- isBundleSplittable: boolean,
270
- isSource: boolean,
271
- hasCjsExports: boolean,
272
- staticExports: boolean,
273
- shouldWrap: boolean,
274
- hasNodeReplacements: boolean,
275
- isConstantModule: boolean,
276
- conditions: Array<{|
277
- key: string,
278
- ifTruePlaceholder?: string,
279
- ifFalsePlaceholder?: string,
280
- |}>,
281
- configPath?: string,
282
- configKeyPath?: string,
283
- |};
284
-
285
- declare export class Resolver {
286
- constructor(projectRoot: string, options: ResolverOptions): Resolver;
287
- resolve(options: ResolveOptions): ResolveResult;
288
- resolveAsync(options: ResolveOptions): Promise<ResolveResult>;
289
- getInvalidations(path: string): JsInvalidations;
290
- }
291
-
292
- export interface LmdbOptions {
293
- /** The database directory path */
294
- path: string;
295
- /**
296
- * If enabled, the database writer will set the following flags:
297
- *
298
- * * MAP_ASYNC - "use asynchronous msync when MDB_WRITEMAP is used"
299
- * * NO_SYNC - "don't fsync after commit"
300
- * * NO_META_SYNC - "don't fsync metapage after commit"
301
- *
302
- * `MDB_WRITEMAP` is on by default.
303
- */
304
- asyncWrites: boolean;
305
- /**
306
- * The mmap size, this corresponds to [`mdb_env_set_mapsize`](http://www.lmdb.tech/doc/group__mdb.html#gaa2506ec8dab3d969b0e609cd82e619e5)
307
- * if this isn't set it'll default to around 10MB.
308
- */
309
- mapSize?: number;
310
- }
311
-
312
- export interface LmdbEntry {
313
- key: string;
314
- value: Buffer;
315
- }
316
-
317
- export type StringReplacement = {|
318
- from: string,
319
- to: string,
320
- |};
321
-
322
- declare export function performStringReplacements(
323
- input: string,
324
- replacements: Array<StringReplacement>,
325
- ): string;
326
-
327
- declare export class Lmdb {
328
- constructor(options: LmdbOptions): Lmdb;
329
- get(key: string): Promise<Buffer | null | void>;
330
- keysSync(skip: number, limit: number): Array<string>;
331
- hasSync(key: string): boolean;
332
- getSync(key: string): Buffer | null;
333
- getManySync(keys: Array<string>): Array<Buffer | void | null>;
334
- putMany(entries: Array<LmdbEntry>): Promise<void>;
335
- put(key: string, data: Buffer): Promise<void>;
336
- putNoConfirm(key: string, data: Buffer): void;
337
- startReadTransaction(): void;
338
- commitReadTransaction(): void;
339
- startWriteTransaction(): Promise<void>;
340
- commitWriteTransaction(): Promise<void>;
341
- delete(key: string): Promise<void>;
342
- close(): void;
343
- compact(targetPath: string): void;
344
- }
345
-
346
- export interface InlineRequiresOptimizerInput {
347
- code: string;
348
- sourceMaps: boolean;
349
- ignoreModuleIds: Array<string>;
350
- }
351
- export interface InlineRequiresOptimizerResult {
352
- code: string;
353
- sourceMap?: string;
354
- }
355
-
356
- declare export function runInlineRequiresOptimizer(
357
- input: InlineRequiresOptimizerInput,
358
- ): InlineRequiresOptimizerResult;
359
-
360
- declare export function runInlineRequiresOptimizerAsync(
361
- input: InlineRequiresOptimizerInput,
362
- ): Promise<InlineRequiresOptimizerResult>;
363
-
364
- export interface VCSFile {
365
- path: string;
366
- hash: number;
367
- }
368
-
369
- export interface YarnState {
370
- yarnLockPath: string;
371
- yarnLock: mixed;
372
- yarnState: mixed;
373
- }
374
-
375
- export interface VCSState {
376
- gitHash: string;
377
- // Files that have been modified since the last commit
378
- dirtyFiles: VCSFile[];
379
- yarnStates: YarnState[];
380
- dirtyFilesExecutionTime: number;
381
- yarnStatesExecutionTime: number;
382
- }
383
-
384
- declare export function getVcsStateSnapshot(
385
- path: string,
386
- excludePatterns: Array<string>,
387
- ): Promise<VCSState>;
388
- export interface NodeChangeEvent {
389
- path: string;
390
- changeType: 'update' | 'create' | 'delete';
391
- }
392
-
393
- declare export function getEventsSince(
394
- repoPath: string,
395
- oldRev: string,
396
- newRev?: string | void | null,
397
- ): Promise<Array<NodeChangeEvent>>;
398
-
399
- declare export function createAssetId(params: mixed): string;
400
- declare export function createDependencyId(params: mixed): string;
401
- declare export function createEnvironmentId(params: mixed): string;
402
-
403
- export interface ResolverOptions {
404
- fs?: JsFileSystemOptions;
405
- includeNodeModules?: IncludeNodeModules;
406
- conditions?: number;
407
- moduleDirResolver?: (...args: any[]) => any;
408
- mode: number;
409
- entries?: number;
410
- extensions?: Array<string>;
411
- }
412
-
413
- export interface JsFileSystemOptions {
414
- canonicalize: (string) => string;
415
- read: (string) => Buffer;
416
- isFile: (string) => boolean;
417
- isDir: (string) => boolean;
418
- includeNodeModules?: IncludeNodeModules;
419
- }
420
-
421
- // Types below break IDE highlighting, place them at the bottom of the file
422
-
423
- export type IncludeNodeModules =
424
- | boolean
425
- | Array<string>
426
- | {|[string]: boolean|};
427
-
428
- export type Resolution =
429
- | {|type: 'Path', value: string|}
430
- | {|type: 'Builtin', value: string|}
431
- | {|type: 'External'|}
432
- | {|type: 'Empty'|}
433
- | {|type: 'Global', value: string|};
434
-
435
- declare export class AtlaspackTracer {
436
- constructor(): AtlaspackTracer;
437
- enter(label: string): number;
438
- exit(id: number): void;
439
- }