@parcel/rust 2.12.1-dev.3171 → 2.12.1-dev.3262

Sign up to get free protection for your applications and to get access to all the features.
package/index.d.ts CHANGED
@@ -7,6 +7,9 @@ export interface JsMacroError {
7
7
  kind: number
8
8
  message: string
9
9
  }
10
+ export interface SerializedParcelDb {
11
+ id: bigint
12
+ }
10
13
  export function findAncestorFile(filenames: Array<string>, from: string, root: string): string | null
11
14
  export function findFirstFile(names: Array<string>): string | null
12
15
  export function findNodeModule(module: string, from: string): string | null
@@ -18,11 +21,11 @@ export interface JsFileSystemOptions {
18
21
  read: (...args: any[]) => any
19
22
  isFile: (...args: any[]) => any
20
23
  isDir: (...args: any[]) => any
21
- includeNodeModules?: NapiSideEffectsVariants
24
+ includeNodeModules?: boolean | Array<string> | Record<string, boolean>
22
25
  }
23
26
  export interface FileSystem {
24
27
  fs?: JsFileSystemOptions
25
- includeNodeModules?: NapiSideEffectsVariants
28
+ includeNodeModules?: boolean | Array<string> | Record<string, boolean>
26
29
  conditions?: number
27
30
  moduleDirResolver?: (...args: any[]) => any
28
31
  mode: number
@@ -61,10 +64,26 @@ export interface JsInvalidations {
61
64
  invalidateOnFileCreate: Array<FilePathCreateInvalidation | FileNameCreateInvalidation | GlobCreateInvalidation>
62
65
  invalidateOnStartup: boolean
63
66
  }
64
- export function transform(opts: object): unknown
65
- export function transformAsync(opts: object): object
66
- export function getChangedPackages(packageVersions: object, prevPackageVersions: object): unknown
67
- export function getPackages(yarnLockContents: string): unknown
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
+ }
68
87
  export class Hash {
69
88
  constructor()
70
89
  writeString(s: string): void
package/index.js CHANGED
@@ -295,8 +295,9 @@ if (!nativeBinding) {
295
295
  throw new Error(`Failed to load native binding`)
296
296
  }
297
297
 
298
- const { findAncestorFile, findFirstFile, findNodeModule, hashString, hashBuffer, Hash, optimizeImage, Resolver, transform, transformAsync, getChangedPackages, getPackages } = nativeBinding
298
+ const { ParcelDb, findAncestorFile, findFirstFile, findNodeModule, hashString, hashBuffer, Hash, optimizeImage, Resolver, transform, transformAsync } = nativeBinding
299
299
 
300
+ module.exports.ParcelDb = ParcelDb
300
301
  module.exports.findAncestorFile = findAncestorFile
301
302
  module.exports.findFirstFile = findFirstFile
302
303
  module.exports.findNodeModule = findNodeModule
@@ -307,5 +308,3 @@ module.exports.optimizeImage = optimizeImage
307
308
  module.exports.Resolver = Resolver
308
309
  module.exports.transform = transform
309
310
  module.exports.transformAsync = transformAsync
310
- module.exports.getChangedPackages = getChangedPackages
311
- module.exports.getPackages = getPackages
package/index.js.flow CHANGED
@@ -1,21 +1,20 @@
1
1
  // @flow
2
2
  import type {FileCreateInvalidation} from '@parcel/types';
3
+ import type {EnvironmentAddr, TargetAddr} from './src/db';
4
+
5
+ export type {
6
+ EnvironmentAddr,
7
+ TargetAddr,
8
+ };
3
9
 
4
10
  declare export var init: void | (() => void);
5
11
 
6
- declare export function findAncestorFile(
7
- filenames: Array<string>,
8
- from: string,
9
- root: string,
10
- ): string | null;
11
- declare export function findFirstFile(names: Array<string>): string | null;
12
- declare export function findNodeModule(
13
- module: string,
14
- from: string,
15
- ): string | null;
16
- declare export function hashString(s: string): string;
17
- declare export function hashBuffer(buf: Buffer): string;
18
- declare export function optimizeImage(kind: string, buf: Buffer): Buffer;
12
+ declare export function findAncestorFile(filenames: Array<string>, from: string, root: string): string | null
13
+ declare export function findFirstFile(names: Array<string>): string | null
14
+ declare export function findNodeModule(module: string, from: string): string | null
15
+ declare export function hashString(s: string): string
16
+ declare export function hashBuffer(buf: Buffer): string
17
+ declare export function optimizeImage(kind: string, buf: Buffer): Buffer
19
18
  export interface JsFileSystemOptions {
20
19
  canonicalize: string => string;
21
20
  read: string => Buffer;
@@ -24,14 +23,14 @@ export interface JsFileSystemOptions {
24
23
  includeNodeModules?: boolean | Array<string> | {|[string]: boolean|};
25
24
  }
26
25
  export interface FileSystem {
27
- fs?: JsFileSystemOptions;
26
+ fs?: JsFileSystemOptions,
28
27
  includeNodeModules?: boolean | Array<string> | {|[string]: boolean|};
29
- conditions?: number;
30
- moduleDirResolver?: (...args: any[]) => any;
31
- mode: number;
32
- entries?: number;
33
- extensions?: Array<string>;
34
- packageExports: boolean;
28
+ conditions?: number,
29
+ moduleDirResolver?: (...args: any[]) => any,
30
+ mode: number,
31
+ entries?: number,
32
+ extensions?: Array<string>,
33
+ packageExports: boolean
35
34
  }
36
35
  export interface ResolveOptions {
37
36
  filename: string;
@@ -60,13 +59,46 @@ export interface JsInvalidations {
60
59
  invalidateOnFileCreate: Array<FileCreateInvalidation>;
61
60
  invalidateOnStartup: boolean;
62
61
  }
63
- declare export function transform(opts: any): any;
64
- declare export function transformAsync(opts: any): Promise<any>;
62
+ declare export function transform(db: ParcelDb, opts: any): any;
63
+ declare export function transformAsync(db: ParcelDb, opts: any): Promise<any>;
65
64
  declare export class Hash {
66
65
  writeString(s: string): void;
67
66
  writeBuffer(b: Buffer): void;
68
67
  finish(): string;
69
68
  }
69
+ // $FlowFixMe
70
+ type TmpBigInt = bigint;
71
+ export type SerializedParcelDb = {|
72
+ id: TmpBigInt
73
+ |};
74
+ type Options = {|
75
+ mode: string,
76
+ env: {[string]: string | void},
77
+ log_level: string,
78
+ project_root: string
79
+ |};
80
+ declare export class ParcelDb {
81
+ constructor(options: Options): ParcelDb;
82
+ serialize(): SerializedParcelDb;
83
+ static create(options: Options): ParcelDb;
84
+ static read(filename: string, options: Options): ParcelDb;
85
+ static fromBuffer(buf: Buffer, options: Options): ParcelDb;
86
+ static deserialize(value: SerializedParcelDb): ParcelDb;
87
+ write(filename: string): void;
88
+ toBuffer(): Buffer;
89
+ getPage(page: number): Buffer;
90
+ alloc(typeId: number): number;
91
+ dealloc(typeId: number, addr: number): void;
92
+ readString(addr: number): string;
93
+ getStringId(s: string): number;
94
+ extendVec(typeId: number, addr: number, count: number): void;
95
+ createEnvironment(addr: EnvironmentAddr): EnvironmentAddr;
96
+ createTarget(addr: TargetAddr): TargetAddr;
97
+
98
+ starSymbol: number;
99
+ defaultSymbol: number;
100
+ [symbol]: any;
101
+ }
70
102
  export interface ResolverOptions {
71
103
  fs?: JsFileSystemOptions;
72
104
  includeNodeModules?: boolean | Array<string> | {|[string]: boolean|};
@@ -82,9 +114,3 @@ declare export class Resolver {
82
114
  resolveAsync(options: ResolveOptions): Promise<ResolveResult>;
83
115
  getInvalidations(path: string): JsInvalidations;
84
116
  }
85
- export type PackageVersions = Map<String, Array<String>>;
86
- declare export function getChangedPackages(
87
- packageVersions: PackageVersions,
88
- prevPackageVersions: PackageVersions,
89
- ): Array<string>;
90
- declare export function getPackages(yarnLock: string): PackageVersions;
package/lib/index.js ADDED
@@ -0,0 +1,27 @@
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
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@parcel/rust",
3
- "version": "2.12.1-dev.3171+79b158883",
3
+ "version": "2.12.1-dev.3262+8b1749694",
4
4
  "license": "MIT",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -13,8 +13,9 @@
13
13
  "type": "git",
14
14
  "url": "https://github.com/parcel-bundler/parcel.git"
15
15
  },
16
- "main": "index.js",
16
+ "main": "lib/index.js",
17
17
  "browser": "browser.js",
18
+ "source": "src/index.js",
18
19
  "napi": {
19
20
  "name": "parcel-node-bindings"
20
21
  },
@@ -34,10 +35,11 @@
34
35
  "napi-wasm": "^1.0.1"
35
36
  },
36
37
  "scripts": {
37
- "build": "napi build --platform --cargo-cwd ../../../crates/node-bindings",
38
- "build-release": "napi build --platform --release --cargo-cwd ../../../crates/node-bindings",
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",
39
41
  "wasm:build": "cargo build -p parcel-node-bindings --target wasm32-unknown-unknown && cp ../../../target/wasm32-unknown-unknown/debug/parcel_node_bindings.wasm .",
40
42
  "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"
41
43
  },
42
- "gitHead": "79b158883170daac9cd17bdecfebff163bc99e52"
44
+ "gitHead": "8b1749694c0ef79cefdacad40bb90c869a93993a"
43
45
  }