@parcel/rust 2.12.1-dev.3275 → 2.12.1-dev.3335
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 +89 -12
- package/index.js +6 -4
- package/index.js.flow +53 -22
- package/package.json +2 -2
- package/parcel-node-bindings.darwin-arm64.node +0 -0
- package/parcel-node-bindings.darwin-x64.node +0 -0
- package/parcel-node-bindings.linux-arm-gnueabihf.node +0 -0
- package/parcel-node-bindings.linux-arm64-gnu.node +0 -0
- package/parcel-node-bindings.linux-arm64-musl.node +0 -0
- package/parcel-node-bindings.linux-x64-gnu.node +0 -0
- package/parcel-node-bindings.linux-x64-musl.node +0 -0
- package/parcel-node-bindings.win32-x64-msvc.node +0 -0
    
        package/index.d.ts
    CHANGED
    
    | @@ -7,27 +7,50 @@ export interface JsMacroError { | |
| 7 7 | 
             
              kind: number
         | 
| 8 8 | 
             
              message: string
         | 
| 9 9 | 
             
            }
         | 
| 10 | 
            -
            export function initSentry(): void
         | 
| 11 | 
            -
            export function closeSentry(): void
         | 
| 12 10 | 
             
            export function findAncestorFile(filenames: Array<string>, from: string, root: string): string | null
         | 
| 13 11 | 
             
            export function findFirstFile(names: Array<string>): string | null
         | 
| 14 12 | 
             
            export function findNodeModule(module: string, from: string): string | null
         | 
| 15 13 | 
             
            export function hashString(s: string): string
         | 
| 16 14 | 
             
            export function hashBuffer(buf: Buffer): string
         | 
| 17 15 | 
             
            export function optimizeImage(kind: string, buf: Buffer): Buffer
         | 
| 16 | 
            +
            export function initializeMonitoring(): void
         | 
| 17 | 
            +
            export function closeMonitoring(): void
         | 
| 18 18 | 
             
            export interface ParcelNapiBuildOptions {
         | 
| 19 | 
            -
              
         | 
| 19 | 
            +
              registerWorker: (...args: any[]) => any
         | 
| 20 20 | 
             
            }
         | 
| 21 21 | 
             
            export interface ParcelNapiBuildResult {
         | 
| 22 22 |  | 
| 23 23 | 
             
            }
         | 
| 24 24 | 
             
            export interface ParcelNapiOptions {
         | 
| 25 | 
            -
              threads?: number
         | 
| 26 | 
            -
              nodeWorkers?: number
         | 
| 27 25 | 
             
              fs?: object
         | 
| 28 | 
            -
               | 
| 26 | 
            +
              nodeWorkers?: number
         | 
| 27 | 
            +
              options: object
         | 
| 28 | 
            +
              packageManager?: object
         | 
| 29 | 
            +
              threads?: number
         | 
| 29 30 | 
             
            }
         | 
| 30 | 
            -
             | 
| 31 | 
            +
            /**
         | 
| 32 | 
            +
             * This function is run in the Nodejs worker context upon initialization
         | 
| 33 | 
            +
             * to notify the main thread that a Nodejs worker thread has started
         | 
| 34 | 
            +
             *
         | 
| 35 | 
            +
             * A Rust channel is transferred to the worker via JavaScript `worker.postMessage`.
         | 
| 36 | 
            +
             * The worker then calls `register_worker`, supplying it with an object containing
         | 
| 37 | 
            +
             * callbacks.
         | 
| 38 | 
            +
             *
         | 
| 39 | 
            +
             * The callbacks are later called from the main thread to send work to the worker.
         | 
| 40 | 
            +
             *
         | 
| 41 | 
            +
             * |-------------| --- Init channel ----> |-------------------|
         | 
| 42 | 
            +
             * | Main Thread |                        | Worker Thread (n) |
         | 
| 43 | 
            +
             * |-------------| <-- Worker wrapper --- |-------------------|
         | 
| 44 | 
            +
             *
         | 
| 45 | 
            +
             *                 **Later During Build**
         | 
| 46 | 
            +
             *
         | 
| 47 | 
            +
             *                 -- Resolver.resolve -->
         | 
| 48 | 
            +
             *                 <- DependencyResult ---
         | 
| 49 | 
            +
             *
         | 
| 50 | 
            +
             *                 -- Transf.transform -->
         | 
| 51 | 
            +
             *                 <--- Array<Asset> -----
         | 
| 52 | 
            +
             */
         | 
| 53 | 
            +
            export function registerWorker(channel: JsTransferable, worker: object): void
         | 
| 31 54 | 
             
            export interface JsFileSystemOptions {
         | 
| 32 55 | 
             
              canonicalize: (...args: any[]) => any
         | 
| 33 56 | 
             
              read: (...args: any[]) => any
         | 
| @@ -76,6 +99,55 @@ export interface JsInvalidations { | |
| 76 99 | 
             
              invalidateOnFileCreate: Array<FilePathCreateInvalidation | FileNameCreateInvalidation | GlobCreateInvalidation>
         | 
| 77 100 | 
             
              invalidateOnStartup: boolean
         | 
| 78 101 | 
             
            }
         | 
| 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 | 
            +
            export function testingRunParcelJsTransformerPlugin(targetPath: string): unknown
         | 
| 79 151 | 
             
            export function transform(opts: object): unknown
         | 
| 80 152 | 
             
            export function transformAsync(opts: object): object
         | 
| 81 153 | 
             
            export class Hash {
         | 
| @@ -86,12 +158,9 @@ export class Hash { | |
| 86 158 | 
             
            }
         | 
| 87 159 | 
             
            export class ParcelNapi {
         | 
| 88 160 | 
             
              nodeWorkerCount: number
         | 
| 89 | 
            -
              constructor( | 
| 161 | 
            +
              constructor(napiOptions: ParcelNapiOptions)
         | 
| 90 162 | 
             
              build(options: ParcelNapiBuildOptions): object
         | 
| 91 | 
            -
               | 
| 92 | 
            -
              testingTempFsIsFile(path: string): Promise<boolean>
         | 
| 93 | 
            -
              testingTempFsIsDir(path: string): Promise<boolean>
         | 
| 94 | 
            -
              testingRpcPing(): Promise<void>
         | 
| 163 | 
            +
              buildAssetGraph(options: ParcelNapiBuildOptions): object
         | 
| 95 164 | 
             
            }
         | 
| 96 165 | 
             
            export class Resolver {
         | 
| 97 166 | 
             
              constructor(projectRoot: string, options: FileSystem)
         | 
| @@ -101,3 +170,11 @@ export class Resolver { | |
| 101 170 | 
             
              getInvalidations(path: string): JsInvalidations
         | 
| 102 171 | 
             
              getInvalidations(path: string): JsInvalidations
         | 
| 103 172 | 
             
            }
         | 
| 173 | 
            +
            export class ResolverOld {
         | 
| 174 | 
            +
              constructor(projectRoot: string, options: FileSystemOld)
         | 
| 175 | 
            +
              resolve(options: ResolveOptionsOld): ResolveResultOld
         | 
| 176 | 
            +
              resolveAsync(): object
         | 
| 177 | 
            +
              resolveAsync(options: ResolveOptionsOld): object
         | 
| 178 | 
            +
              getInvalidations(path: string): JsInvalidationsOld
         | 
| 179 | 
            +
              getInvalidations(path: string): JsInvalidationsOld
         | 
| 180 | 
            +
            }
         | 
    
        package/index.js
    CHANGED
    
    | @@ -310,10 +310,8 @@ if (!nativeBinding) { | |
| 310 310 | 
             
              throw new Error(`Failed to load native binding`)
         | 
| 311 311 | 
             
            }
         | 
| 312 312 |  | 
| 313 | 
            -
            const {  | 
| 313 | 
            +
            const { findAncestorFile, findFirstFile, findNodeModule, hashString, hashBuffer, Hash, optimizeImage, initializeMonitoring, closeMonitoring, ParcelNapi, registerWorker, Resolver, ResolverOld, testingRunParcelJsTransformerPlugin, transform, transformAsync } = nativeBinding
         | 
| 314 314 |  | 
| 315 | 
            -
            module.exports.initSentry = initSentry
         | 
| 316 | 
            -
            module.exports.closeSentry = closeSentry
         | 
| 317 315 | 
             
            module.exports.findAncestorFile = findAncestorFile
         | 
| 318 316 | 
             
            module.exports.findFirstFile = findFirstFile
         | 
| 319 317 | 
             
            module.exports.findNodeModule = findNodeModule
         | 
| @@ -321,8 +319,12 @@ module.exports.hashString = hashString | |
| 321 319 | 
             
            module.exports.hashBuffer = hashBuffer
         | 
| 322 320 | 
             
            module.exports.Hash = Hash
         | 
| 323 321 | 
             
            module.exports.optimizeImage = optimizeImage
         | 
| 322 | 
            +
            module.exports.initializeMonitoring = initializeMonitoring
         | 
| 323 | 
            +
            module.exports.closeMonitoring = closeMonitoring
         | 
| 324 324 | 
             
            module.exports.ParcelNapi = ParcelNapi
         | 
| 325 | 
            -
            module.exports. | 
| 325 | 
            +
            module.exports.registerWorker = registerWorker
         | 
| 326 326 | 
             
            module.exports.Resolver = Resolver
         | 
| 327 | 
            +
            module.exports.ResolverOld = ResolverOld
         | 
| 328 | 
            +
            module.exports.testingRunParcelJsTransformerPlugin = testingRunParcelJsTransformerPlugin
         | 
| 327 329 | 
             
            module.exports.transform = transform
         | 
| 328 330 | 
             
            module.exports.transformAsync = transformAsync
         | 
    
        package/index.js.flow
    CHANGED
    
    | @@ -1,8 +1,16 @@ | |
| 1 1 | 
             
            // @flow
         | 
| 2 | 
            -
            import type { | 
| 2 | 
            +
            import type {
         | 
| 3 | 
            +
              Encoding,
         | 
| 4 | 
            +
              FileCreateInvalidation,
         | 
| 5 | 
            +
              FilePath,
         | 
| 6 | 
            +
              InitialParcelOptions,
         | 
| 7 | 
            +
              PackageManager,
         | 
| 8 | 
            +
            } from '@parcel/types';
         | 
| 3 9 |  | 
| 4 10 | 
             
            declare export var init: void | (() => void);
         | 
| 5 11 |  | 
| 12 | 
            +
            export type Transferable = {||};
         | 
| 13 | 
            +
             | 
| 6 14 | 
             
            export type ProjectPath = any;
         | 
| 7 15 | 
             
            export interface ConfigRequest {
         | 
| 8 16 | 
             
              id: string;
         | 
| @@ -16,18 +24,42 @@ export interface ConfigRequest { | |
| 16 24 | 
             
            }
         | 
| 17 25 | 
             
            export interface RequestOptions {}
         | 
| 18 26 |  | 
| 19 | 
            -
            export  | 
| 20 | 
            -
             | 
| 21 | 
            -
             | 
| 22 | 
            -
               | 
| 23 | 
            -
               | 
| 24 | 
            -
               | 
| 27 | 
            +
            export interface FileSystem {
         | 
| 28 | 
            +
              canonicalize(path: FilePath): FilePath;
         | 
| 29 | 
            +
              cwd(): FilePath;
         | 
| 30 | 
            +
              isDir(path: FilePath): boolean;
         | 
| 31 | 
            +
              isFile(path: FilePath): boolean;
         | 
| 32 | 
            +
              readFile(path: FilePath, encoding?: Encoding): string;
         | 
| 25 33 | 
             
            }
         | 
| 26 34 |  | 
| 35 | 
            +
            export type ParcelNapiOptions = {|
         | 
| 36 | 
            +
              fs?: FileSystem,
         | 
| 37 | 
            +
              nodeWorkers?: number,
         | 
| 38 | 
            +
              options: {|
         | 
| 39 | 
            +
                corePath?: string,
         | 
| 40 | 
            +
                // TODO Use Omit when available in flow >0.210.0
         | 
| 41 | 
            +
                ...$Diff<
         | 
| 42 | 
            +
                  InitialParcelOptions,
         | 
| 43 | 
            +
                  {|
         | 
| 44 | 
            +
                    inputFS: InitialParcelOptions['inputFS'],
         | 
| 45 | 
            +
                    outputFS: InitialParcelOptions['outputFS'],
         | 
| 46 | 
            +
                    packageManager: InitialParcelOptions['packageManager'],
         | 
| 47 | 
            +
                  |},
         | 
| 48 | 
            +
                >,
         | 
| 49 | 
            +
              |},
         | 
| 50 | 
            +
              packageManager?: PackageManager,
         | 
| 51 | 
            +
              threads?: number,
         | 
| 52 | 
            +
            |};
         | 
| 53 | 
            +
             | 
| 54 | 
            +
            export type ParcelBuildOptions = {|
         | 
| 55 | 
            +
              registerWorker: (channel: Transferable) => void | Promise<void>,
         | 
| 56 | 
            +
            |};
         | 
| 57 | 
            +
             | 
| 27 58 | 
             
            declare export class ParcelNapi {
         | 
| 28 | 
            -
              nodeWorkerCount: number | 
| 59 | 
            +
              nodeWorkerCount: number;
         | 
| 29 60 | 
             
              constructor(options: ParcelNapiOptions): ParcelNapi;
         | 
| 30 | 
            -
              build(options:  | 
| 61 | 
            +
              build(options: ParcelBuildOptions): Promise<void>;
         | 
| 62 | 
            +
              buildAssetGraph(options: ParcelBuildOptions): Promise<any>;
         | 
| 31 63 | 
             
              static defaultThreadCount(): number;
         | 
| 32 64 | 
             
              testingTempFsReadToString(path: string): string;
         | 
| 33 65 | 
             
              testingTempFsIsDir(path: string): boolean;
         | 
| @@ -35,10 +67,13 @@ declare export class ParcelNapi { | |
| 35 67 | 
             
              testingRpcPing(): void;
         | 
| 36 68 | 
             
            }
         | 
| 37 69 |  | 
| 38 | 
            -
            declare export function  | 
| 70 | 
            +
            declare export function registerWorker(
         | 
| 71 | 
            +
              channel: Transferable,
         | 
| 72 | 
            +
              worker: any,
         | 
| 73 | 
            +
            ): void;
         | 
| 39 74 |  | 
| 40 | 
            -
            declare export function  | 
| 41 | 
            -
            declare export function  | 
| 75 | 
            +
            declare export function initializeMonitoring(): void;
         | 
| 76 | 
            +
            declare export function closeMonitoring(): void;
         | 
| 42 77 | 
             
            declare export function napiRunConfigRequest(
         | 
| 43 78 | 
             
              configRequest: ConfigRequest,
         | 
| 44 79 | 
             
              api: any,
         | 
| @@ -64,16 +99,6 @@ export interface JsFileSystemOptions { | |
| 64 99 | 
             
              isDir: string => boolean;
         | 
| 65 100 | 
             
              includeNodeModules?: boolean | Array<string> | {|[string]: boolean|};
         | 
| 66 101 | 
             
            }
         | 
| 67 | 
            -
            export interface FileSystem {
         | 
| 68 | 
            -
              fs?: JsFileSystemOptions;
         | 
| 69 | 
            -
              includeNodeModules?: boolean | Array<string> | {|[string]: boolean|};
         | 
| 70 | 
            -
              conditions?: number;
         | 
| 71 | 
            -
              moduleDirResolver?: (...args: any[]) => any;
         | 
| 72 | 
            -
              mode: number;
         | 
| 73 | 
            -
              entries?: number;
         | 
| 74 | 
            -
              extensions?: Array<string>;
         | 
| 75 | 
            -
              packageExports: boolean;
         | 
| 76 | 
            -
            }
         | 
| 77 102 | 
             
            export interface ResolveOptions {
         | 
| 78 103 | 
             
              filename: string;
         | 
| 79 104 | 
             
              specifierType: string;
         | 
| @@ -123,3 +148,9 @@ declare export class Resolver { | |
| 123 148 | 
             
              resolveAsync(options: ResolveOptions): Promise<ResolveResult>;
         | 
| 124 149 | 
             
              getInvalidations(path: string): JsInvalidations;
         | 
| 125 150 | 
             
            }
         | 
| 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;
         | 
| 156 | 
            +
            }
         | 
    
        package/package.json
    CHANGED
    
    | @@ -1,6 +1,6 @@ | |
| 1 1 | 
             
            {
         | 
| 2 2 | 
             
              "name": "@parcel/rust",
         | 
| 3 | 
            -
              "version": "2.12.1-dev. | 
| 3 | 
            +
              "version": "2.12.1-dev.3335+c6bc8e411",
         | 
| 4 4 | 
             
              "license": "MIT",
         | 
| 5 5 | 
             
              "publishConfig": {
         | 
| 6 6 | 
             
                "access": "public"
         | 
| @@ -40,5 +40,5 @@ | |
| 40 40 | 
             
                "wasm:build": "cargo build -p parcel-node-bindings --target wasm32-unknown-unknown && cp ../../../target/wasm32-unknown-unknown/debug/parcel_node_bindings.wasm .",
         | 
| 41 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"
         | 
| 42 42 | 
             
              },
         | 
| 43 | 
            -
              "gitHead": " | 
| 43 | 
            +
              "gitHead": "c6bc8e41105247c437089ec3cb91e53f12ac5519"
         | 
| 44 44 | 
             
            }
         | 
| Binary file | 
| Binary file | 
| Binary file | 
| Binary file | 
| Binary file | 
| Binary file | 
| Binary file | 
| Binary file |