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

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
@@ -7,12 +7,37 @@ export interface JsMacroError {
7
7
  kind: number
8
8
  message: string
9
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 function initTracingSubscriber(): void
30
+ export interface Entry {
31
+ key: string
32
+ value: Buffer
33
+ }
10
34
  export function findAncestorFile(filenames: Array<string>, from: string, root: string): string | null
11
35
  export function findFirstFile(names: Array<string>): string | null
12
36
  export function findNodeModule(module: string, from: string): string | null
13
37
  export function hashString(s: string): string
14
38
  export function hashBuffer(buf: Buffer): string
15
39
  export function optimizeImage(kind: string, buf: Buffer): Buffer
40
+ export function createAssetId(params: unknown): string
16
41
  export interface AtlaspackNapiBuildOptions {
17
42
  registerWorker: (...args: any[]) => any
18
43
  }
@@ -26,6 +51,8 @@ export interface AtlaspackNapiOptions {
26
51
  packageManager?: object
27
52
  threads?: number
28
53
  }
54
+ export function createDependencyId(params: unknown): string
55
+ export function createEnvironmentId(params: unknown): string
29
56
  export function initializeMonitoring(): void
30
57
  export function closeMonitoring(): void
31
58
  /**
@@ -51,6 +78,17 @@ export function closeMonitoring(): void
51
78
  * <--- Array<Asset> -----
52
79
  */
53
80
  export function registerWorker(channel: JsTransferable, worker: object): void
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 function runInlineRequiresOptimizer(input: InlineRequiresOptimizerInput): InlineRequiresOptimizerResult
91
+ export function replaceHashReferences(input: Buffer, hashRefToNameHash: Record<string, string>): Buffer
54
92
  export interface JsFileSystemOptions {
55
93
  canonicalize: (...args: any[]) => any
56
94
  read: (...args: any[]) => any
@@ -99,56 +137,35 @@ export interface JsInvalidations {
99
137
  invalidateOnFileCreate: Array<FilePathCreateInvalidation | FileNameCreateInvalidation | GlobCreateInvalidation>
100
138
  invalidateOnStartup: boolean
101
139
  }
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
140
  export function transform(opts: object): unknown
151
141
  export function transformAsync(opts: object): object
142
+ export type LMDB = Lmdb
143
+ export class Lmdb {
144
+ constructor(options: LmdbOptions)
145
+ get(key: string): Promise<Buffer | null | undefined>
146
+ getSync(key: string): Buffer | null
147
+ getManySync(keys: Array<string>): Array<Buffer | undefined | null>
148
+ putMany(entries: Array<Entry>): Promise<void>
149
+ put(key: string, data: Buffer): Promise<void>
150
+ putNoConfirm(key: string, data: Buffer): void
151
+ startReadTransaction(): void
152
+ commitReadTransaction(): void
153
+ startWriteTransaction(): Promise<void>
154
+ commitWriteTransaction(): Promise<void>
155
+ close(): void
156
+ constructor(options: LMDBOptions)
157
+ get(key: string): Promise<Buffer | null | undefined>
158
+ getSync(key: string): Buffer | null
159
+ getManySync(keys: Array<string>): Array<Buffer | undefined | null>
160
+ putMany(entries: Array<Entry>): Promise<void>
161
+ put(key: string, data: Buffer): Promise<void>
162
+ putNoConfirm(key: string, data: Buffer): void
163
+ startReadTransaction(): void
164
+ commitReadTransaction(): void
165
+ startWriteTransaction(): Promise<void>
166
+ commitWriteTransaction(): Promise<void>
167
+ close(): void
168
+ }
152
169
  export class Hash {
153
170
  constructor()
154
171
  writeString(s: string): void
@@ -158,7 +175,6 @@ export class Hash {
158
175
  export class AtlaspackNapi {
159
176
  nodeWorkerCount: number
160
177
  constructor(napiOptions: AtlaspackNapiOptions)
161
- build(options: AtlaspackNapiBuildOptions): object
162
178
  buildAssetGraph(options: AtlaspackNapiBuildOptions): object
163
179
  }
164
180
  export class Resolver {
@@ -169,11 +185,3 @@ export class Resolver {
169
185
  getInvalidations(path: string): JsInvalidations
170
186
  getInvalidations(path: string): JsInvalidations
171
187
  }
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,8 +310,10 @@ 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, AtlaspackNapi, initializeMonitoring, closeMonitoring, registerWorker, Resolver, ResolverOld, transform, transformAsync } = nativeBinding
313
+ const { initTracingSubscriber, Lmdb, findAncestorFile, findFirstFile, findNodeModule, hashString, hashBuffer, Hash, optimizeImage, createAssetId, AtlaspackNapi, createDependencyId, createEnvironmentId, initializeMonitoring, closeMonitoring, registerWorker, runInlineRequiresOptimizer, replaceHashReferences, Resolver, transform, transformAsync } = nativeBinding
314
314
 
315
+ module.exports.initTracingSubscriber = initTracingSubscriber
316
+ module.exports.Lmdb = Lmdb
315
317
  module.exports.findAncestorFile = findAncestorFile
316
318
  module.exports.findFirstFile = findFirstFile
317
319
  module.exports.findNodeModule = findNodeModule
@@ -319,11 +321,15 @@ module.exports.hashString = hashString
319
321
  module.exports.hashBuffer = hashBuffer
320
322
  module.exports.Hash = Hash
321
323
  module.exports.optimizeImage = optimizeImage
324
+ module.exports.createAssetId = createAssetId
322
325
  module.exports.AtlaspackNapi = AtlaspackNapi
326
+ module.exports.createDependencyId = createDependencyId
327
+ module.exports.createEnvironmentId = createEnvironmentId
323
328
  module.exports.initializeMonitoring = initializeMonitoring
324
329
  module.exports.closeMonitoring = closeMonitoring
325
330
  module.exports.registerWorker = registerWorker
331
+ module.exports.runInlineRequiresOptimizer = runInlineRequiresOptimizer
332
+ module.exports.replaceHashReferences = replaceHashReferences
326
333
  module.exports.Resolver = Resolver
327
- module.exports.ResolverOld = ResolverOld
328
334
  module.exports.transform = transform
329
335
  module.exports.transformAsync = transformAsync
package/index.js.flow CHANGED
@@ -7,6 +7,8 @@ import type {
7
7
  PackageManager,
8
8
  } from '@atlaspack/types';
9
9
 
10
+ import {decl} from 'postcss';
11
+
10
12
  declare export var init: void | (() => void);
11
13
 
12
14
  export type Transferable = {||};
@@ -148,9 +150,65 @@ declare export class Resolver {
148
150
  resolveAsync(options: ResolveOptions): Promise<ResolveResult>;
149
151
  getInvalidations(path: string): JsInvalidations;
150
152
  }
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;
153
+ export interface LmdbOptions {
154
+ /** The database directory path */
155
+ path: string;
156
+ /**
157
+ * If enabled, the database writer will set the following flags:
158
+ *
159
+ * * MAP_ASYNC - "use asynchronous msync when MDB_WRITEMAP is used"
160
+ * * NO_SYNC - "don't fsync after commit"
161
+ * * NO_META_SYNC - "don't fsync metapage after commit"
162
+ *
163
+ * `MDB_WRITEMAP` is on by default.
164
+ */
165
+ asyncWrites: boolean;
166
+ /**
167
+ * The mmap size, this corresponds to [`mdb_env_set_mapsize`](http://www.lmdb.tech/doc/group__mdb.html#gaa2506ec8dab3d969b0e609cd82e619e5)
168
+ * if this isn't set it'll default to around 10MB.
169
+ */
170
+ mapSize?: number;
171
+ }
172
+
173
+ export interface LmdbEntry {
174
+ key: string;
175
+ value: Buffer;
156
176
  }
177
+
178
+ declare export class Lmdb {
179
+ constructor(options: LmdbOptions): Lmdb;
180
+ get(key: string): Promise<Buffer | null | void>;
181
+ getSync(key: string): Buffer | null;
182
+ getManySync(keys: Array<string>): Array<Buffer | void | null>;
183
+ putMany(entries: Array<LmdbEntry>): Promise<void>;
184
+ put(key: string, data: Buffer): Promise<void>;
185
+ putNoConfirm(key: string, data: Buffer): void;
186
+ startReadTransaction(): void;
187
+ commitReadTransaction(): void;
188
+ startWriteTransaction(): Promise<void>;
189
+ commitWriteTransaction(): Promise<void>;
190
+ close(): void;
191
+ }
192
+
193
+ export interface InlineRequiresOptimizerInput {
194
+ code: string;
195
+ sourceMaps: boolean;
196
+ ignoreModuleIds: Array<string>;
197
+ }
198
+ export interface InlineRequiresOptimizerResult {
199
+ code: string;
200
+ sourceMap?: string;
201
+ }
202
+
203
+ declare export function runInlineRequiresOptimizer(
204
+ input: InlineRequiresOptimizerInput,
205
+ ): InlineRequiresOptimizerResult;
206
+
207
+ declare export function createAssetId(params: mixed): string;
208
+ declare export function createDependencyId(params: mixed): string;
209
+ declare export function createEnvironmentId(params: mixed): string;
210
+
211
+ declare export function replaceHashReferences(
212
+ input: Buffer,
213
+ hashRefToNameHash: {[key: string]: string},
214
+ ): Buffer;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@atlaspack/rust",
3
- "version": "2.12.1-dev.3401+b483af77f",
4
- "license": "MIT",
3
+ "version": "2.12.1-dev.3443+d1170cfc7",
4
+ "license": "(MIT OR Apache-2.0)",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -33,8 +33,9 @@
33
33
  "build": "napi build --platform --cargo-cwd ../../../crates/node-bindings",
34
34
  "build-canary": "napi build --platform --profile canary --features canary --cargo-cwd ../../../crates/node-bindings",
35
35
  "build-release": "napi build --platform --release --cargo-cwd ../../../crates/node-bindings",
36
+ "test": "mocha",
36
37
  "wasm:build": "cargo build -p atlaspack-node-bindings --target wasm32-unknown-unknown && cp ../../../target/wasm32-unknown-unknown/debug/atlaspack_node_bindings.wasm .",
37
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"
38
39
  },
39
- "gitHead": "b483af77f02d1258c8dad156e097b94f83671d8e"
40
+ "gitHead": "d1170cfc79beb290b2a066f472f68f71f7d7cb23"
40
41
  }