@parcel/rust 2.12.1-dev.3238 → 2.12.1-dev.3260

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,9 +7,8 @@ export interface JsMacroError {
7
7
  kind: number
8
8
  message: string
9
9
  }
10
- export interface SerializedParcelDb {
11
- id: bigint
12
- }
10
+ export function initSentry(): void
11
+ export function closeSentry(): void
13
12
  export function findAncestorFile(filenames: Array<string>, from: string, root: string): string | null
14
13
  export function findFirstFile(names: Array<string>): string | null
15
14
  export function findNodeModule(module: string, from: string): string | null
@@ -21,11 +20,11 @@ export interface JsFileSystemOptions {
21
20
  read: (...args: any[]) => any
22
21
  isFile: (...args: any[]) => any
23
22
  isDir: (...args: any[]) => any
24
- includeNodeModules?: boolean | Array<string> | Record<string, boolean>
23
+ includeNodeModules?: NapiSideEffectsVariants
25
24
  }
26
25
  export interface FileSystem {
27
26
  fs?: JsFileSystemOptions
28
- includeNodeModules?: boolean | Array<string> | Record<string, boolean>
27
+ includeNodeModules?: NapiSideEffectsVariants
29
28
  conditions?: number
30
29
  moduleDirResolver?: (...args: any[]) => any
31
30
  mode: number
@@ -64,32 +63,20 @@ export interface JsInvalidations {
64
63
  invalidateOnFileCreate: Array<FilePathCreateInvalidation | FileNameCreateInvalidation | GlobCreateInvalidation>
65
64
  invalidateOnStartup: boolean
66
65
  }
67
- export function transform(db: ParcelDb, opts: object): unknown
68
- export function transformAsync(db: ParcelDb, opts: object): object
69
- export type JsParcelDb = ParcelDb
70
- export class ParcelDb {
71
- constructor(options: object)
72
- serialize(): SerializedParcelDb
73
- static deserializeNative(value: SerializedParcelDb): JsParcelDb
74
- getPage(page: number): Buffer
75
- alloc(typeId: number): number
76
- dealloc(typeId: number, addr: number): void
77
- readString(addr: number): string
78
- getStringId(s: string): number
79
- extendVec(typeId: number, addr: number, count: number): void
80
- createEnvironment(addr: number): number
81
- createTarget(addr: number): number
82
- write(filename: string): void
83
- toBuffer(): Buffer
84
- static _read(filename: string, options: object): JsParcelDb
85
- static _fromBuffer(buf: Buffer, options: object): JsParcelDb
86
- }
66
+ export function transform(opts: object): unknown
67
+ export function transformAsync(opts: object): object
87
68
  export class Hash {
88
69
  constructor()
89
70
  writeString(s: string): void
90
71
  writeBuffer(buf: Buffer): void
91
72
  finish(): string
92
73
  }
74
+ export class ParcelNapi {
75
+ constructor(options: object)
76
+ testingTempFsReadToString(path: string): Promise<string>
77
+ testingTempFsIsFile(path: string): Promise<boolean>
78
+ testingTempFsIsDir(path: string): Promise<boolean>
79
+ }
93
80
  export class Resolver {
94
81
  constructor(projectRoot: string, options: FileSystem)
95
82
  resolve(options: ResolveOptions): ResolveResult
package/index.js CHANGED
@@ -295,9 +295,10 @@ if (!nativeBinding) {
295
295
  throw new Error(`Failed to load native binding`)
296
296
  }
297
297
 
298
- const { ParcelDb, findAncestorFile, findFirstFile, findNodeModule, hashString, hashBuffer, Hash, optimizeImage, Resolver, transform, transformAsync } = nativeBinding
298
+ const { initSentry, closeSentry, findAncestorFile, findFirstFile, findNodeModule, hashString, hashBuffer, Hash, optimizeImage, ParcelNapi, Resolver, transform, transformAsync } = nativeBinding
299
299
 
300
- module.exports.ParcelDb = ParcelDb
300
+ module.exports.initSentry = initSentry
301
+ module.exports.closeSentry = closeSentry
301
302
  module.exports.findAncestorFile = findAncestorFile
302
303
  module.exports.findFirstFile = findFirstFile
303
304
  module.exports.findNodeModule = findNodeModule
@@ -305,6 +306,7 @@ module.exports.hashString = hashString
305
306
  module.exports.hashBuffer = hashBuffer
306
307
  module.exports.Hash = Hash
307
308
  module.exports.optimizeImage = optimizeImage
309
+ module.exports.ParcelNapi = ParcelNapi
308
310
  module.exports.Resolver = Resolver
309
311
  module.exports.transform = transform
310
312
  module.exports.transformAsync = transformAsync
package/index.js.flow CHANGED
@@ -1,15 +1,52 @@
1
1
  // @flow
2
2
  import type {FileCreateInvalidation} from '@parcel/types';
3
- import type {EnvironmentAddr, TargetAddr} from './src/db';
4
3
 
5
4
  declare export var init: void | (() => void);
6
5
 
7
- declare export function findAncestorFile(filenames: Array<string>, from: string, root: string): string | null
8
- declare export function findFirstFile(names: Array<string>): string | null
9
- declare export function findNodeModule(module: string, from: string): string | null
10
- declare export function hashString(s: string): string
11
- declare export function hashBuffer(buf: Buffer): string
12
- declare export function optimizeImage(kind: string, buf: Buffer): Buffer
6
+ export type ProjectPath = any;
7
+ export interface ConfigRequest {
8
+ id: string;
9
+ invalidateOnFileChange: Array<ProjectPath>;
10
+ invalidateOnConfigKeyChange: Array<any>;
11
+ invalidateOnFileCreate: Array<any>;
12
+ invalidateOnEnvChange: Array<string>;
13
+ invalidateOnOptionChange: Array<string>;
14
+ invalidateOnStartup: boolean;
15
+ invalidateOnBuild: boolean;
16
+ }
17
+ export interface RequestOptions {}
18
+
19
+ export interface ParcelNapiOptions {
20
+ fs?: any;
21
+ }
22
+
23
+ declare export class ParcelNapi {
24
+ constructor(options: ParcelNapiOptions): ParcelNapi;
25
+ testingTempFsReadToString(path: string): string;
26
+ testingTempFsIsDir(path: string): boolean;
27
+ testingTempFsIsFile(path: string): boolean;
28
+ }
29
+
30
+ declare export function initSentry(): void;
31
+ declare export function closeSentry(): void;
32
+ declare export function napiRunConfigRequest(
33
+ configRequest: ConfigRequest,
34
+ api: any,
35
+ options: any,
36
+ ): void;
37
+ declare export function findAncestorFile(
38
+ filenames: Array<string>,
39
+ from: string,
40
+ root: string,
41
+ ): string | null;
42
+ declare export function findFirstFile(names: Array<string>): string | null;
43
+ declare export function findNodeModule(
44
+ module: string,
45
+ from: string,
46
+ ): string | null;
47
+ declare export function hashString(s: string): string;
48
+ declare export function hashBuffer(buf: Buffer): string;
49
+ declare export function optimizeImage(kind: string, buf: Buffer): Buffer;
13
50
  export interface JsFileSystemOptions {
14
51
  canonicalize: string => string;
15
52
  read: string => Buffer;
@@ -18,14 +55,14 @@ export interface JsFileSystemOptions {
18
55
  includeNodeModules?: boolean | Array<string> | {|[string]: boolean|};
19
56
  }
20
57
  export interface FileSystem {
21
- fs?: JsFileSystemOptions,
58
+ fs?: JsFileSystemOptions;
22
59
  includeNodeModules?: boolean | Array<string> | {|[string]: boolean|};
23
- conditions?: number,
24
- moduleDirResolver?: (...args: any[]) => any,
25
- mode: number,
26
- entries?: number,
27
- extensions?: Array<string>,
28
- packageExports: boolean
60
+ conditions?: number;
61
+ moduleDirResolver?: (...args: any[]) => any;
62
+ mode: number;
63
+ entries?: number;
64
+ extensions?: Array<string>;
65
+ packageExports: boolean;
29
66
  }
30
67
  export interface ResolveOptions {
31
68
  filename: string;
@@ -54,46 +91,13 @@ export interface JsInvalidations {
54
91
  invalidateOnFileCreate: Array<FileCreateInvalidation>;
55
92
  invalidateOnStartup: boolean;
56
93
  }
57
- declare export function transform(db: ParcelDb, opts: any): any;
58
- declare export function transformAsync(db: ParcelDb, opts: any): Promise<any>;
94
+ declare export function transform(opts: any): any;
95
+ declare export function transformAsync(opts: any): Promise<any>;
59
96
  declare export class Hash {
60
97
  writeString(s: string): void;
61
98
  writeBuffer(b: Buffer): void;
62
99
  finish(): string;
63
100
  }
64
- // $FlowFixMe
65
- type TmpBigInt = bigint;
66
- export type SerializedParcelDb = {|
67
- id: TmpBigInt
68
- |};
69
- type Options = {|
70
- mode: string,
71
- env: {[string]: string | void},
72
- log_level: string,
73
- project_root: string
74
- |};
75
- declare export class ParcelDb {
76
- constructor(options: Options): ParcelDb;
77
- serialize(): SerializedParcelDb;
78
- static create(options: Options): ParcelDb;
79
- static read(filename: string, options: Options): ParcelDb;
80
- static fromBuffer(buf: Buffer, options: Options): ParcelDb;
81
- static deserialize(value: SerializedParcelDb): ParcelDb;
82
- write(filename: string): void;
83
- toBuffer(): Buffer;
84
- getPage(page: number): Buffer;
85
- alloc(typeId: number): number;
86
- dealloc(typeId: number, addr: number): void;
87
- readString(addr: number): string;
88
- getStringId(s: string): number;
89
- extendVec(typeId: number, addr: number, count: number): void;
90
- createEnvironment(addr: EnvironmentAddr): EnvironmentAddr;
91
- createTarget(addr: TargetAddr): TargetAddr;
92
-
93
- starSymbol: number;
94
- defaultSymbol: number;
95
- [symbol]: any;
96
- }
97
101
  export interface ResolverOptions {
98
102
  fs?: JsFileSystemOptions;
99
103
  includeNodeModules?: boolean | Array<string> | {|[string]: boolean|};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@parcel/rust",
3
- "version": "2.12.1-dev.3238+7f6b4dbbc",
3
+ "version": "2.12.1-dev.3260+339350eb3",
4
4
  "license": "MIT",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -13,14 +13,13 @@
13
13
  "type": "git",
14
14
  "url": "https://github.com/parcel-bundler/parcel.git"
15
15
  },
16
- "main": "lib/index.js",
16
+ "main": "index.js",
17
17
  "browser": "browser.js",
18
- "source": "src/index.js",
19
18
  "napi": {
20
19
  "name": "parcel-node-bindings"
21
20
  },
22
21
  "engines": {
23
- "node": ">= 12.0.0"
22
+ "node": ">= 16.0.0"
24
23
  },
25
24
  "files": [
26
25
  "browser.js",
@@ -35,11 +34,11 @@
35
34
  "napi-wasm": "^1.0.1"
36
35
  },
37
36
  "scripts": {
38
- "build": "napi build --platform --cargo-cwd ../../../crates/node-bindings && yarn build-db",
39
- "build-release": "napi build --platform --release --cargo-cwd ../../../crates/node-bindings && yarn build-db",
40
- "build-db": "cargo run -p parcel-db && prettier --write src/db.js",
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",
39
+ "build-release": "napi build --platform --release --cargo-cwd ../../../crates/node-bindings",
41
40
  "wasm:build": "cargo build -p parcel-node-bindings --target wasm32-unknown-unknown && cp ../../../target/wasm32-unknown-unknown/debug/parcel_node_bindings.wasm .",
42
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"
43
42
  },
44
- "gitHead": "7f6b4dbbc56a203e0fce8794856c03598c4f6708"
43
+ "gitHead": "339350eb31fd33849cb1efe5fd7ad2cb096319f0"
45
44
  }
package/lib/index.js DELETED
@@ -1,27 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- var _index = require("../index");
7
- Object.keys(_index).forEach(function (key) {
8
- if (key === "default" || key === "__esModule") return;
9
- if (key in exports && exports[key] === _index[key]) return;
10
- Object.defineProperty(exports, key, {
11
- enumerable: true,
12
- get: function () {
13
- return _index[key];
14
- }
15
- });
16
- });
17
- var _db = require("./db");
18
- Object.keys(_db).forEach(function (key) {
19
- if (key === "default" || key === "__esModule") return;
20
- if (key in exports && exports[key] === _db[key]) return;
21
- Object.defineProperty(exports, key, {
22
- enumerable: true,
23
- get: function () {
24
- return _db[key];
25
- }
26
- });
27
- });