@rspack/binding 1.4.11 → 1.5.0-beta.0
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/binding.js +2 -1
- package/napi-binding.d.ts +250 -3
- package/package.json +14 -12
package/binding.js
CHANGED
|
@@ -385,7 +385,8 @@ if (!nativeBinding) {
|
|
|
385
385
|
throw new Error(
|
|
386
386
|
`Cannot find native binding. ` +
|
|
387
387
|
`npm has a bug related to optional dependencies (https://github.com/npm/cli/issues/4828). ` +
|
|
388
|
-
'Please try `npm i` again after removing both package-lock.json and node_modules directory.'
|
|
388
|
+
'Please try `npm i` again after removing both package-lock.json and node_modules directory.' +
|
|
389
|
+
`\n\n${loadErrors.map((e) => e.message).join('\n')}`,
|
|
389
390
|
{ cause: loadErrors }
|
|
390
391
|
)
|
|
391
392
|
}
|
package/napi-binding.d.ts
CHANGED
|
@@ -328,6 +328,7 @@ export declare class JsCompiler {
|
|
|
328
328
|
/** Rebuild with the given option passed to the constructor */
|
|
329
329
|
rebuild(changed_files: string[], removed_files: string[], callback: (err: null | Error) => void): void
|
|
330
330
|
close(): Promise<void>
|
|
331
|
+
getVirtualFileStore(): VirtualFileStore | null
|
|
331
332
|
}
|
|
332
333
|
|
|
333
334
|
export declare class JsContextModuleFactoryAfterResolveData {
|
|
@@ -406,11 +407,10 @@ export declare class JsModuleGraph {
|
|
|
406
407
|
export declare class JsResolver {
|
|
407
408
|
resolveSync(path: string, request: string): string | undefined
|
|
408
409
|
resolve(path: string, request: string, callback: (err: null | Error, req?: string) => void): void
|
|
409
|
-
withOptions(raw?: RawResolveOptionsWithDependencyType | undefined | null): JsResolver
|
|
410
410
|
}
|
|
411
411
|
|
|
412
412
|
export declare class JsResolverFactory {
|
|
413
|
-
constructor(pnp: boolean)
|
|
413
|
+
constructor(pnp: boolean, jsResolveOptions: RawResolveOptions, jsLoaderResolveOptions: RawResolveOptions)
|
|
414
414
|
get(type: string, options?: RawResolveOptionsWithDependencyType): JsResolver
|
|
415
415
|
}
|
|
416
416
|
|
|
@@ -444,6 +444,7 @@ export declare class ModuleGraphConnection {
|
|
|
444
444
|
export declare class NativeWatcher {
|
|
445
445
|
constructor(options: NativeWatcherOptions)
|
|
446
446
|
watch(files: [Array<string>, Array<string>], directories: [Array<string>, Array<string>], missing: [Array<string>, Array<string>], callback: (err: Error | null, result: NativeWatchResult) => void, callbackUndelayed: (path: string) => void): void
|
|
447
|
+
triggerEvent(kind: 'change' | 'remove' | 'create', path: string): void
|
|
447
448
|
/**
|
|
448
449
|
* # Safety
|
|
449
450
|
*
|
|
@@ -471,10 +472,31 @@ export declare class ReadonlyResourceData {
|
|
|
471
472
|
get descriptionFilePath(): string
|
|
472
473
|
}
|
|
473
474
|
|
|
475
|
+
export declare class ResolverFactory {
|
|
476
|
+
constructor(options?: NapiResolveOptions | undefined | null)
|
|
477
|
+
static default(): ResolverFactory
|
|
478
|
+
/** Clone the resolver using the same underlying cache. */
|
|
479
|
+
cloneWithOptions(options: NapiResolveOptions): ResolverFactory
|
|
480
|
+
/** Clear the underlying cache. */
|
|
481
|
+
clearCache(): void
|
|
482
|
+
/** Synchronously resolve `specifier` at an absolute path to a `directory`. */
|
|
483
|
+
sync(directory: string, request: string): ResolveResult
|
|
484
|
+
/** Asynchronously resolve `specifier` at an absolute path to a `directory`. */
|
|
485
|
+
async(directory: string, request: string): Promise<ResolveResult>
|
|
486
|
+
}
|
|
487
|
+
|
|
474
488
|
export declare class Sources {
|
|
475
489
|
_get(sourceType: string): JsCompatSourceOwned | null
|
|
476
490
|
}
|
|
477
491
|
|
|
492
|
+
export declare class VirtualFileStore {
|
|
493
|
+
writeVirtualFileSync(path: string, content: string): void
|
|
494
|
+
batchWriteVirtualFilesSync(files: Array<JsVirtualFile>): void
|
|
495
|
+
}
|
|
496
|
+
export type JsVirtualFileStore = VirtualFileStore
|
|
497
|
+
|
|
498
|
+
export declare function async(path: string, request: string): Promise<ResolveResult>
|
|
499
|
+
|
|
478
500
|
export interface BuiltinPlugin {
|
|
479
501
|
name: BuiltinPluginName | CustomPluginName
|
|
480
502
|
options: unknown
|
|
@@ -583,6 +605,12 @@ export interface CssChunkingPluginOptions {
|
|
|
583
605
|
exclude?: RegExp
|
|
584
606
|
}
|
|
585
607
|
|
|
608
|
+
export declare enum EnforceExtension {
|
|
609
|
+
Auto = 0,
|
|
610
|
+
Enabled = 1,
|
|
611
|
+
Disabled = 2
|
|
612
|
+
}
|
|
613
|
+
|
|
586
614
|
/**
|
|
587
615
|
* Expected version of @rspack/core to the current binding version
|
|
588
616
|
* @internal
|
|
@@ -1459,6 +1487,11 @@ export interface JsTap {
|
|
|
1459
1487
|
stage: number
|
|
1460
1488
|
}
|
|
1461
1489
|
|
|
1490
|
+
export interface JsVirtualFile {
|
|
1491
|
+
path: string
|
|
1492
|
+
content: string
|
|
1493
|
+
}
|
|
1494
|
+
|
|
1462
1495
|
export interface KnownAssetInfo {
|
|
1463
1496
|
/** if the asset can be long term cached forever (contains a hash) */
|
|
1464
1497
|
immutable?: boolean
|
|
@@ -1500,6 +1533,178 @@ export declare function minify(source: string, options: string): Promise<Transfo
|
|
|
1500
1533
|
|
|
1501
1534
|
export declare function minifySync(source: string, options: string): TransformOutput
|
|
1502
1535
|
|
|
1536
|
+
/**
|
|
1537
|
+
* Module Resolution Options
|
|
1538
|
+
*
|
|
1539
|
+
* Options are directly ported from [enhanced-resolve](https://github.com/webpack/enhanced-resolve#resolver-options).
|
|
1540
|
+
*
|
|
1541
|
+
* See [rspack resolve](https://rspack.rs/config/resolve) for information and examples
|
|
1542
|
+
*/
|
|
1543
|
+
export interface NapiResolveOptions {
|
|
1544
|
+
/**
|
|
1545
|
+
* Path to TypeScript configuration file.
|
|
1546
|
+
*
|
|
1547
|
+
* Default `None`
|
|
1548
|
+
*/
|
|
1549
|
+
tsconfig?: TsconfigOptions
|
|
1550
|
+
/**
|
|
1551
|
+
* Alias for [ResolveOptions::alias] and [ResolveOptions::fallback].
|
|
1552
|
+
*
|
|
1553
|
+
* For the second value of the tuple, `None -> AliasValue::Ignore`, Some(String) ->
|
|
1554
|
+
* AliasValue::Path(String)`
|
|
1555
|
+
* Create aliases to import or require certain modules more easily.
|
|
1556
|
+
* A trailing $ can also be added to the given object's keys to signify an exact match.
|
|
1557
|
+
*/
|
|
1558
|
+
alias?: Record<string, Array<string | undefined | null>>
|
|
1559
|
+
/**
|
|
1560
|
+
* A list of alias fields in description files.
|
|
1561
|
+
* Specify a field, such as `browser`, to be parsed according to [this specification](https://github.com/defunctzombie/package-browser-field-spec).
|
|
1562
|
+
* Can be a path to json object such as `["path", "to", "exports"]`.
|
|
1563
|
+
*
|
|
1564
|
+
* Default `[]`
|
|
1565
|
+
*/
|
|
1566
|
+
aliasFields?: (string | string[])[]
|
|
1567
|
+
/**
|
|
1568
|
+
* Condition names for exports field which defines entry points of a package.
|
|
1569
|
+
* The key order in the exports field is significant. During condition matching, earlier entries have higher priority and take precedence over later entries.
|
|
1570
|
+
*
|
|
1571
|
+
* Default `[]`
|
|
1572
|
+
*/
|
|
1573
|
+
conditionNames?: Array<string>
|
|
1574
|
+
/**
|
|
1575
|
+
* The JSON files to use for descriptions. (There was once a `bower.json`.)
|
|
1576
|
+
*
|
|
1577
|
+
* Default `["package.json"]`
|
|
1578
|
+
*/
|
|
1579
|
+
descriptionFiles?: Array<string>
|
|
1580
|
+
/**
|
|
1581
|
+
* If true, it will not allow extension-less files.
|
|
1582
|
+
* So by default `require('./foo')` works if `./foo` has a `.js` extension,
|
|
1583
|
+
* but with this enabled only `require('./foo.js')` will work.
|
|
1584
|
+
*
|
|
1585
|
+
* Default to `true` when [ResolveOptions::extensions] contains an empty string.
|
|
1586
|
+
* Use `Some(false)` to disable the behavior.
|
|
1587
|
+
* See <https://github.com/webpack/enhanced-resolve/pull/285>
|
|
1588
|
+
*
|
|
1589
|
+
* Default None, which is the same as `Some(false)` when the above empty rule is not applied.
|
|
1590
|
+
*/
|
|
1591
|
+
enforceExtension?: EnforceExtension
|
|
1592
|
+
/**
|
|
1593
|
+
* A list of exports fields in description files.
|
|
1594
|
+
* Can be a path to json object such as `["path", "to", "exports"]`.
|
|
1595
|
+
*
|
|
1596
|
+
* Default `[["exports"]]`.
|
|
1597
|
+
*/
|
|
1598
|
+
exportsFields?: (string | string[])[]
|
|
1599
|
+
/**
|
|
1600
|
+
* Fields from `package.json` which are used to provide the internal requests of a package
|
|
1601
|
+
* (requests starting with # are considered internal).
|
|
1602
|
+
*
|
|
1603
|
+
* Can be a path to a JSON object such as `["path", "to", "imports"]`.
|
|
1604
|
+
*
|
|
1605
|
+
* Default `[["imports"]]`.
|
|
1606
|
+
*/
|
|
1607
|
+
importsFields?: (string | string[])[]
|
|
1608
|
+
/**
|
|
1609
|
+
* An object which maps extension to extension aliases.
|
|
1610
|
+
*
|
|
1611
|
+
* Default `{}`
|
|
1612
|
+
*/
|
|
1613
|
+
extensionAlias?: Record<string, Array<string>>
|
|
1614
|
+
/**
|
|
1615
|
+
* Attempt to resolve these extensions in order.
|
|
1616
|
+
* If multiple files share the same name but have different extensions,
|
|
1617
|
+
* will resolve the one with the extension listed first in the array and skip the rest.
|
|
1618
|
+
*
|
|
1619
|
+
* Default `[".js", ".json", ".node"]`
|
|
1620
|
+
*/
|
|
1621
|
+
extensions?: Array<string>
|
|
1622
|
+
/**
|
|
1623
|
+
* Redirect module requests when normal resolving fails.
|
|
1624
|
+
*
|
|
1625
|
+
* Default `[]`
|
|
1626
|
+
*/
|
|
1627
|
+
fallback?: Record<string, Array<string | undefined | null>>
|
|
1628
|
+
/**
|
|
1629
|
+
* Request passed to resolve is already fully specified and extensions or main files are not resolved for it (they are still resolved for internal requests).
|
|
1630
|
+
*
|
|
1631
|
+
* See also rspack configuration [resolve.fullySpecified](https://rspack.rs/config/resolve#resolvefullyspecified)
|
|
1632
|
+
*
|
|
1633
|
+
* Default `false`
|
|
1634
|
+
*/
|
|
1635
|
+
fullySpecified?: boolean
|
|
1636
|
+
/**
|
|
1637
|
+
* A list of main fields in description files
|
|
1638
|
+
*
|
|
1639
|
+
* Default `["main"]`.
|
|
1640
|
+
*/
|
|
1641
|
+
mainFields?: string | string[]
|
|
1642
|
+
/**
|
|
1643
|
+
* The filename to be used while resolving directories.
|
|
1644
|
+
*
|
|
1645
|
+
* Default `["index"]`
|
|
1646
|
+
*/
|
|
1647
|
+
mainFiles?: Array<string>
|
|
1648
|
+
/**
|
|
1649
|
+
* A list of directories to resolve modules from, can be absolute path or folder name.
|
|
1650
|
+
*
|
|
1651
|
+
* Default `["node_modules"]`
|
|
1652
|
+
*/
|
|
1653
|
+
modules?: string | string[]
|
|
1654
|
+
/**
|
|
1655
|
+
* Resolve to a context instead of a file.
|
|
1656
|
+
*
|
|
1657
|
+
* Default `false`
|
|
1658
|
+
*/
|
|
1659
|
+
resolveToContext?: boolean
|
|
1660
|
+
/**
|
|
1661
|
+
* Prefer to resolve module requests as relative requests instead of using modules from node_modules directories.
|
|
1662
|
+
*
|
|
1663
|
+
* Default `false`
|
|
1664
|
+
*/
|
|
1665
|
+
preferRelative?: boolean
|
|
1666
|
+
/**
|
|
1667
|
+
* Prefer to resolve server-relative urls as absolute paths before falling back to resolve in ResolveOptions::roots.
|
|
1668
|
+
*
|
|
1669
|
+
* Default `false`
|
|
1670
|
+
*/
|
|
1671
|
+
preferAbsolute?: boolean
|
|
1672
|
+
/**
|
|
1673
|
+
* A list of resolve restrictions to restrict the paths that a request can be resolved on.
|
|
1674
|
+
*
|
|
1675
|
+
* Default `[]`
|
|
1676
|
+
*/
|
|
1677
|
+
restrictions?: Array<Restriction>
|
|
1678
|
+
/**
|
|
1679
|
+
* A list of directories where requests of server-relative URLs (starting with '/') are resolved.
|
|
1680
|
+
* On non-Windows systems these requests are resolved as an absolute path first.
|
|
1681
|
+
*
|
|
1682
|
+
* Default `[]`
|
|
1683
|
+
*/
|
|
1684
|
+
roots?: Array<string>
|
|
1685
|
+
/**
|
|
1686
|
+
* Whether to resolve symlinks to their symlinked location.
|
|
1687
|
+
* When enabled, symlinked resources are resolved to their real path, not their symlinked location.
|
|
1688
|
+
* Note that this may cause module resolution to fail when using tools that symlink packages (like npm link).
|
|
1689
|
+
*
|
|
1690
|
+
* Default `true`
|
|
1691
|
+
*/
|
|
1692
|
+
symlinks?: boolean
|
|
1693
|
+
/**
|
|
1694
|
+
* Whether to parse [module.builtinModules](https://nodejs.org/api/module.html#modulebuiltinmodules) or not.
|
|
1695
|
+
* For example, "zlib" will throw [crate::ResolveError::Builtin] when set to true.
|
|
1696
|
+
*
|
|
1697
|
+
* Default `false`
|
|
1698
|
+
*/
|
|
1699
|
+
builtinModules?: boolean
|
|
1700
|
+
/**
|
|
1701
|
+
* Whether to enable yarn Plug'n'Play
|
|
1702
|
+
*
|
|
1703
|
+
* Default `false`
|
|
1704
|
+
*/
|
|
1705
|
+
enablePnp?: boolean
|
|
1706
|
+
}
|
|
1707
|
+
|
|
1503
1708
|
export interface NativeWatcherOptions {
|
|
1504
1709
|
followSymlinks?: boolean
|
|
1505
1710
|
pollInterval?: number
|
|
@@ -1919,6 +2124,7 @@ useInputFileSystem?: false | Array<RegExp>
|
|
|
1919
2124
|
inlineConst: boolean
|
|
1920
2125
|
inlineEnum: boolean
|
|
1921
2126
|
typeReexportsPresence: boolean
|
|
2127
|
+
lazyBarrel: boolean
|
|
1922
2128
|
}
|
|
1923
2129
|
|
|
1924
2130
|
export interface RawExperimentSnapshotOptions {
|
|
@@ -2342,6 +2548,7 @@ export interface RawOptions {
|
|
|
2342
2548
|
amd?: string
|
|
2343
2549
|
bail: boolean
|
|
2344
2550
|
__references: Record<string, any>
|
|
2551
|
+
__virtual_files?: Array<JsVirtualFile>
|
|
2345
2552
|
}
|
|
2346
2553
|
|
|
2347
2554
|
export interface RawOutputOptions {
|
|
@@ -2483,7 +2690,7 @@ export interface RawResolveOptionsWithDependencyType {
|
|
|
2483
2690
|
aliasFields?: Array<string>
|
|
2484
2691
|
restrictions?: (string | RegExp)[]
|
|
2485
2692
|
roots?: Array<string>
|
|
2486
|
-
|
|
2693
|
+
dependencyType?: string
|
|
2487
2694
|
resolveToContext?: boolean
|
|
2488
2695
|
pnp?: boolean
|
|
2489
2696
|
}
|
|
@@ -2753,6 +2960,22 @@ export interface RegisterJsTaps {
|
|
|
2753
2960
|
registerRsdoctorPluginAssetsTaps: (stages: Array<number>) => Array<{ function: ((arg: JsRsdoctorAssetPatch) => Promise<boolean | undefined>); stage: number; }>
|
|
2754
2961
|
}
|
|
2755
2962
|
|
|
2963
|
+
export interface ResolveResult {
|
|
2964
|
+
path?: string
|
|
2965
|
+
error?: string
|
|
2966
|
+
/** "type" field in the package.json file */
|
|
2967
|
+
moduleType?: string
|
|
2968
|
+
}
|
|
2969
|
+
|
|
2970
|
+
/**
|
|
2971
|
+
* Alias Value for [ResolveOptions::alias] and [ResolveOptions::fallback].
|
|
2972
|
+
* Use struct because napi don't support structured union now
|
|
2973
|
+
*/
|
|
2974
|
+
export interface Restriction {
|
|
2975
|
+
path?: string
|
|
2976
|
+
regex?: string
|
|
2977
|
+
}
|
|
2978
|
+
|
|
2756
2979
|
export interface SourceMapDevToolPluginOptions {
|
|
2757
2980
|
append?: (false | null) | string | Function
|
|
2758
2981
|
columns?: boolean
|
|
@@ -2776,6 +2999,8 @@ export interface SourcePosition {
|
|
|
2776
2999
|
column?: number
|
|
2777
3000
|
}
|
|
2778
3001
|
|
|
3002
|
+
export declare function sync(path: string, request: string): ResolveResult
|
|
3003
|
+
|
|
2779
3004
|
export declare function syncTraceEvent(events: Array<RawTraceEvent>): void
|
|
2780
3005
|
|
|
2781
3006
|
export interface SyntheticDependencyLocation {
|
|
@@ -2813,3 +3038,25 @@ export interface TransformOutput {
|
|
|
2813
3038
|
}
|
|
2814
3039
|
|
|
2815
3040
|
export declare function transformSync(source: string, options: string): TransformOutput
|
|
3041
|
+
|
|
3042
|
+
/**
|
|
3043
|
+
* Tsconfig Options
|
|
3044
|
+
*
|
|
3045
|
+
* Derived from [tsconfig-paths-webpack-plugin](https://github.com/dividab/tsconfig-paths-webpack-plugin#options)
|
|
3046
|
+
*/
|
|
3047
|
+
export interface TsconfigOptions {
|
|
3048
|
+
/**
|
|
3049
|
+
* Allows you to specify where to find the TypeScript configuration file.
|
|
3050
|
+
* You may provide
|
|
3051
|
+
* * a relative path to the configuration file. It will be resolved relative to cwd.
|
|
3052
|
+
* * an absolute path to the configuration file.
|
|
3053
|
+
*/
|
|
3054
|
+
configFile: string
|
|
3055
|
+
/**
|
|
3056
|
+
* Support for Typescript Project References.
|
|
3057
|
+
*
|
|
3058
|
+
* * `'auto'`: use the `references` field from tsconfig of `config_file`.
|
|
3059
|
+
* * `string[]`: manually provided relative or absolute path.
|
|
3060
|
+
*/
|
|
3061
|
+
references?: 'auto' | string[]
|
|
3062
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rspack/binding",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.0-beta.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Node binding for rspack",
|
|
6
6
|
"main": "binding.js",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"@napi-rs/cli": "3.0.4",
|
|
22
22
|
"@napi-rs/wasm-runtime": "^1.0.1",
|
|
23
23
|
"emnapi": "^1.4.5",
|
|
24
|
-
"typescript": "^5.
|
|
24
|
+
"typescript": "^5.9.2"
|
|
25
25
|
},
|
|
26
26
|
"napi": {
|
|
27
27
|
"binaryName": "rspack",
|
|
@@ -50,16 +50,16 @@
|
|
|
50
50
|
}
|
|
51
51
|
},
|
|
52
52
|
"optionalDependencies": {
|
|
53
|
-
"@rspack/binding-darwin-arm64": "1.
|
|
54
|
-
"@rspack/binding-win32-arm64-msvc": "1.
|
|
55
|
-
"@rspack/binding-linux-arm64-musl": "1.
|
|
56
|
-
"@rspack/binding-linux-arm64-gnu": "1.
|
|
57
|
-
"@rspack/binding-win32-ia32-msvc": "1.
|
|
58
|
-
"@rspack/binding-darwin-x64": "1.
|
|
59
|
-
"@rspack/binding-wasm32-wasi": "1.
|
|
60
|
-
"@rspack/binding-
|
|
61
|
-
"@rspack/binding-linux-x64-
|
|
62
|
-
"@rspack/binding-
|
|
53
|
+
"@rspack/binding-darwin-arm64": "1.5.0-beta.0",
|
|
54
|
+
"@rspack/binding-win32-arm64-msvc": "1.5.0-beta.0",
|
|
55
|
+
"@rspack/binding-linux-arm64-musl": "1.5.0-beta.0",
|
|
56
|
+
"@rspack/binding-linux-arm64-gnu": "1.5.0-beta.0",
|
|
57
|
+
"@rspack/binding-win32-ia32-msvc": "1.5.0-beta.0",
|
|
58
|
+
"@rspack/binding-darwin-x64": "1.5.0-beta.0",
|
|
59
|
+
"@rspack/binding-wasm32-wasi": "1.5.0-beta.0",
|
|
60
|
+
"@rspack/binding-win32-x64-msvc": "1.5.0-beta.0",
|
|
61
|
+
"@rspack/binding-linux-x64-musl": "1.5.0-beta.0",
|
|
62
|
+
"@rspack/binding-linux-x64-gnu": "1.5.0-beta.0"
|
|
63
63
|
},
|
|
64
64
|
"scripts": {
|
|
65
65
|
"build:dev": "node scripts/build.js",
|
|
@@ -69,6 +69,8 @@
|
|
|
69
69
|
"build:release": "node scripts/build.js --profile release",
|
|
70
70
|
"build:dev:wasm": "DISABLE_PLUGIN=1 RUST_TARGET=wasm32-wasip1-threads node scripts/build.js",
|
|
71
71
|
"build:release:wasm": "DISABLE_PLUGIN=1 RUST_TARGET=wasm32-wasip1-threads node scripts/build.js --profile release-wasi",
|
|
72
|
+
"build:dev:browser": "DISABLE_PLUGIN=1 RUST_TARGET=wasm32-wasip1-threads BROWSER=1 node scripts/build.js",
|
|
73
|
+
"build:release:browser": "DISABLE_PLUGIN=1 RUST_TARGET=wasm32-wasip1-threads BROWSER=1 node scripts/build.js --profile release-wasi",
|
|
72
74
|
"move-binding": "node scripts/move-binding",
|
|
73
75
|
"test": "tsc -p tsconfig.type-test.json"
|
|
74
76
|
}
|