rolldown 0.12.2 → 0.13.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/dist/cjs/cli.cjs +1552 -584
- package/dist/cjs/experimental-index.cjs +40 -0
- package/dist/cjs/index.cjs +5 -22
- package/dist/cjs/parallel-plugin-worker.cjs +7 -7
- package/dist/cjs/parallel-plugin.cjs +1 -1
- package/dist/esm/cli.mjs +1549 -583
- package/dist/esm/experimental-index.mjs +23 -0
- package/dist/esm/index.mjs +5 -17
- package/dist/esm/parallel-plugin-worker.mjs +6 -6
- package/dist/esm/parallel-plugin.mjs +1 -1
- package/dist/shared/{chunk-1xb6WR3y.cjs → chunk-gQ4GMlVi.cjs} +3 -2
- package/dist/shared/{consola.36c0034f-N8xiTrv3.cjs → consola.36c0034f-eps_ogJv.cjs} +188 -188
- package/dist/shared/{consola.36c0034f-jtHhMkSX.mjs → consola.36c0034f-m5cABVv4.mjs} +187 -187
- package/dist/shared/package-3VR4tEG7.mjs +9 -0
- package/dist/shared/package-OJCNSbf0.cjs +11 -0
- package/dist/shared/plugin-context-data-dIOrw9yH.cjs +1436 -0
- package/dist/shared/plugin-context-data-nhjzqlNd.mjs +1444 -0
- package/dist/shared/{prompt-pjyLzLci.mjs → prompt-9VjtYvi_.mjs} +182 -182
- package/dist/shared/{prompt-1K6oCkIU.cjs → prompt-Ah5G71p-.cjs} +183 -183
- package/dist/shared/rolldown-KvxnG5lF.mjs +1107 -0
- package/dist/shared/rolldown-PHdfa5m8.cjs +1123 -0
- package/dist/shared/rolldown-binding.wasi.cjs +70 -51
- package/dist/types/binding.d.ts +329 -14
- package/dist/types/cli/arguments/alias.d.ts +8 -0
- package/dist/types/cli/arguments/index.d.ts +13 -0
- package/dist/types/cli/arguments/normalize.d.ts +15 -0
- package/dist/types/cli/arguments/schema.d.ts +161 -0
- package/dist/types/cli/arguments/utils.d.ts +6 -0
- package/dist/types/cli/commands/bundle.d.ts +3 -1
- package/dist/types/cli/commands/help.d.ts +1 -0
- package/dist/types/cli/utils.d.ts +1 -1
- package/dist/types/constants/plugin-context.d.ts +7 -0
- package/dist/types/constants/plugin.d.ts +36 -0
- package/dist/types/experimental-index.d.ts +5 -0
- package/dist/types/index.d.ts +8 -8
- package/dist/types/options/input-options.d.ts +139 -27
- package/dist/types/options/normalized-alias-plugin-config.d.ts +10 -0
- package/dist/types/options/normalized-ecma-transform-plugin-config.d.ts +8 -0
- package/dist/types/options/normalized-output-options.d.ts +8 -3
- package/dist/types/options/output-options.d.ts +102 -11
- package/dist/types/options/utils.d.ts +2 -0
- package/dist/types/plugin/bindingify-build-hooks.d.ts +9 -8
- package/dist/types/plugin/bindingify-hook-filter.d.ts +5 -0
- package/dist/types/plugin/bindingify-output-hooks.d.ts +11 -7
- package/dist/types/plugin/bindingify-plugin-hook-meta.d.ts +8 -0
- package/dist/types/plugin/bindingify-plugin.d.ts +2 -1
- package/dist/types/plugin/builtin-plugin.d.ts +75 -7
- package/dist/types/plugin/index.d.ts +68 -28
- package/dist/types/plugin/plugin-context-data.d.ts +6 -0
- package/dist/types/plugin/plugin-context.d.ts +18 -8
- package/dist/types/plugin/plugin-driver.d.ts +2 -2
- package/dist/types/rollup.d.ts +1 -0
- package/dist/types/types/rolldown-output.d.ts +1 -0
- package/dist/types/utils/compose-js-plugins.d.ts +2 -0
- package/dist/types/utils/misc.d.ts +1 -0
- package/dist/types/utils/normalize-hook.d.ts +7 -5
- package/dist/types/utils/plugin/index.d.ts +2 -0
- package/dist/types/utils/type-assert.d.ts +1 -0
- package/package.json +30 -22
- package/dist/shared/rolldown-SCF5NBN_.cjs +0 -49
- package/dist/shared/rolldown-kYz4BvAA.mjs +0 -48
- package/dist/shared/utils_index-_DFpKlu1.mjs +0 -1582
- package/dist/shared/utils_index-xb2NoRNm.cjs +0 -1557
- package/dist/types/cli/constants.d.ts +0 -1
- package/dist/types/utils/ensure-array.d.ts +0 -1
- package/dist/types/utils/index.d.ts +0 -9
- /package/dist/types/plugin/{transfrom-plugin-context.d.ts → transform-plugin-context.d.ts} +0 -0
|
@@ -82,61 +82,79 @@ const { instance: __napiInstance, module: __wasiModule, napiModule: __napiModule
|
|
|
82
82
|
})
|
|
83
83
|
|
|
84
84
|
function __napi_rs_initialize_modules(__napiInstance) {
|
|
85
|
-
__napiInstance.exports['
|
|
86
|
-
__napiInstance.exports['
|
|
87
|
-
__napiInstance.exports['
|
|
88
|
-
__napiInstance.exports['
|
|
89
|
-
__napiInstance.exports['
|
|
90
|
-
__napiInstance.exports['
|
|
91
|
-
__napiInstance.exports['
|
|
92
|
-
__napiInstance.exports['
|
|
85
|
+
__napiInstance.exports['__napi_register__TypeScriptBindingOptions_struct_0']?.()
|
|
86
|
+
__napiInstance.exports['__napi_register__ReactBindingOptions_struct_1']?.()
|
|
87
|
+
__napiInstance.exports['__napi_register__ArrowFunctionsBindingOptions_struct_2']?.()
|
|
88
|
+
__napiInstance.exports['__napi_register__ES2015BindingOptions_struct_3']?.()
|
|
89
|
+
__napiInstance.exports['__napi_register__TransformOptions_struct_4']?.()
|
|
90
|
+
__napiInstance.exports['__napi_register__SourceMap_struct_5']?.()
|
|
91
|
+
__napiInstance.exports['__napi_register__IsolatedDeclarationsResult_struct_6']?.()
|
|
92
|
+
__napiInstance.exports['__napi_register__isolated_declaration_7']?.()
|
|
93
93
|
__napiInstance.exports['__napi_register__TransformResult_struct_8']?.()
|
|
94
94
|
__napiInstance.exports['__napi_register__transform_9']?.()
|
|
95
95
|
__napiInstance.exports['__napi_register__Bundler_struct_0']?.()
|
|
96
96
|
__napiInstance.exports['__napi_register__Bundler_impl_5']?.()
|
|
97
|
-
__napiInstance.exports['
|
|
98
|
-
__napiInstance.exports['
|
|
99
|
-
__napiInstance.exports['
|
|
100
|
-
__napiInstance.exports['
|
|
101
|
-
__napiInstance.exports['
|
|
102
|
-
__napiInstance.exports['
|
|
103
|
-
__napiInstance.exports['
|
|
104
|
-
__napiInstance.exports['
|
|
105
|
-
__napiInstance.exports['
|
|
106
|
-
__napiInstance.exports['
|
|
107
|
-
__napiInstance.exports['
|
|
108
|
-
__napiInstance.exports['
|
|
109
|
-
__napiInstance.exports['
|
|
110
|
-
__napiInstance.exports['
|
|
111
|
-
__napiInstance.exports['
|
|
112
|
-
__napiInstance.exports['
|
|
113
|
-
__napiInstance.exports['
|
|
114
|
-
__napiInstance.exports['
|
|
115
|
-
__napiInstance.exports['
|
|
116
|
-
__napiInstance.exports['
|
|
117
|
-
__napiInstance.exports['
|
|
118
|
-
__napiInstance.exports['
|
|
119
|
-
__napiInstance.exports['
|
|
120
|
-
__napiInstance.exports['
|
|
121
|
-
__napiInstance.exports['
|
|
122
|
-
__napiInstance.exports['
|
|
123
|
-
__napiInstance.exports['
|
|
124
|
-
__napiInstance.exports['
|
|
125
|
-
__napiInstance.exports['
|
|
126
|
-
__napiInstance.exports['
|
|
127
|
-
__napiInstance.exports['
|
|
128
|
-
__napiInstance.exports['
|
|
129
|
-
__napiInstance.exports['
|
|
130
|
-
__napiInstance.exports['
|
|
131
|
-
__napiInstance.exports['
|
|
132
|
-
__napiInstance.exports['
|
|
133
|
-
__napiInstance.exports['
|
|
134
|
-
__napiInstance.exports['
|
|
135
|
-
__napiInstance.exports['
|
|
136
|
-
__napiInstance.exports['
|
|
137
|
-
__napiInstance.exports['
|
|
138
|
-
__napiInstance.exports['
|
|
139
|
-
__napiInstance.exports['
|
|
97
|
+
__napiInstance.exports['__napi_register__BindingInjectImportNamed_struct_6']?.()
|
|
98
|
+
__napiInstance.exports['__napi_register__BindingInjectImportNamespace_struct_7']?.()
|
|
99
|
+
__napiInstance.exports['__napi_register__BindingInputItem_struct_8']?.()
|
|
100
|
+
__napiInstance.exports['__napi_register__BindingResolveOptions_struct_9']?.()
|
|
101
|
+
__napiInstance.exports['__napi_register__BindingTreeshake_struct_10']?.()
|
|
102
|
+
__napiInstance.exports['__napi_register__BindingInputOptions_struct_11']?.()
|
|
103
|
+
__napiInstance.exports['__napi_register__BindingOutputOptions_struct_12']?.()
|
|
104
|
+
__napiInstance.exports['__napi_register__BindingPluginContext_struct_13']?.()
|
|
105
|
+
__napiInstance.exports['__napi_register__BindingPluginContext_impl_19']?.()
|
|
106
|
+
__napiInstance.exports['__napi_register__BindingPluginContextResolvedId_struct_20']?.()
|
|
107
|
+
__napiInstance.exports['__napi_register__BindingPluginOptions_struct_21']?.()
|
|
108
|
+
__napiInstance.exports['__napi_register__BindingPluginWithIndex_struct_22']?.()
|
|
109
|
+
__napiInstance.exports['__napi_register__BindingTransformPluginContext_struct_23']?.()
|
|
110
|
+
__napiInstance.exports['__napi_register__BindingTransformPluginContext_impl_25']?.()
|
|
111
|
+
__napiInstance.exports['__napi_register__BindingAssetSource_struct_26']?.()
|
|
112
|
+
__napiInstance.exports['__napi_register__BindingEmittedAsset_struct_27']?.()
|
|
113
|
+
__napiInstance.exports['__napi_register__BindingGeneralHookFilter_struct_28']?.()
|
|
114
|
+
__napiInstance.exports['__napi_register__BindingTransformHookFilter_struct_29']?.()
|
|
115
|
+
__napiInstance.exports['__napi_register__BindingHookLoadOutput_struct_30']?.()
|
|
116
|
+
__napiInstance.exports['__napi_register__BindingHookRenderChunkOutput_struct_31']?.()
|
|
117
|
+
__napiInstance.exports['__napi_register__BindingHookResolveIdExtraArgs_struct_32']?.()
|
|
118
|
+
__napiInstance.exports['__napi_register__BindingHookResolveIdOutput_struct_33']?.()
|
|
119
|
+
__napiInstance.exports['__napi_register__BindingHookSideEffects_34']?.()
|
|
120
|
+
__napiInstance.exports['__napi_register__BindingHookTransformOutput_struct_35']?.()
|
|
121
|
+
__napiInstance.exports['__napi_register__BindingStringOrRegex_struct_36']?.()
|
|
122
|
+
__napiInstance.exports['__napi_register__BindingPluginContextResolveOptions_struct_37']?.()
|
|
123
|
+
__napiInstance.exports['__napi_register__BindingTransformHookExtraArgs_struct_38']?.()
|
|
124
|
+
__napiInstance.exports['__napi_register__BindingBuiltinPlugin_struct_39']?.()
|
|
125
|
+
__napiInstance.exports['__napi_register__BindingBuiltinPluginName_40']?.()
|
|
126
|
+
__napiInstance.exports['__napi_register__BindingGlobImportPluginConfig_struct_41']?.()
|
|
127
|
+
__napiInstance.exports['__napi_register__BindingManifestPluginConfig_struct_42']?.()
|
|
128
|
+
__napiInstance.exports['__napi_register__BindingModulePreloadPolyfillPluginConfig_struct_43']?.()
|
|
129
|
+
__napiInstance.exports['__napi_register__BindingJsonPluginConfig_struct_44']?.()
|
|
130
|
+
__napiInstance.exports['__napi_register__BindingTransformPluginConfig_struct_45']?.()
|
|
131
|
+
__napiInstance.exports['__napi_register__BindingAliasPluginConfig_struct_46']?.()
|
|
132
|
+
__napiInstance.exports['__napi_register__BindingAliasPluginAlias_struct_47']?.()
|
|
133
|
+
__napiInstance.exports['__napi_register__BindingBuildImportAnalysisPluginConfig_struct_48']?.()
|
|
134
|
+
__napiInstance.exports['__napi_register__BindingReplacePluginConfig_struct_49']?.()
|
|
135
|
+
__napiInstance.exports['__napi_register__BindingPluginOrder_50']?.()
|
|
136
|
+
__napiInstance.exports['__napi_register__BindingPluginHookMeta_struct_51']?.()
|
|
137
|
+
__napiInstance.exports['__napi_register__ParallelJsPluginRegistry_struct_52']?.()
|
|
138
|
+
__napiInstance.exports['__napi_register__ParallelJsPluginRegistry_impl_54']?.()
|
|
139
|
+
__napiInstance.exports['__napi_register__register_plugins_55']?.()
|
|
140
|
+
__napiInstance.exports['__napi_register__BindingLog_struct_56']?.()
|
|
141
|
+
__napiInstance.exports['__napi_register__BindingLogLevel_57']?.()
|
|
142
|
+
__napiInstance.exports['__napi_register__BindingModuleInfo_struct_58']?.()
|
|
143
|
+
__napiInstance.exports['__napi_register__BindingModuleInfo_impl_60']?.()
|
|
144
|
+
__napiInstance.exports['__napi_register__BindingOutputAsset_struct_61']?.()
|
|
145
|
+
__napiInstance.exports['__napi_register__BindingOutputAsset_impl_67']?.()
|
|
146
|
+
__napiInstance.exports['__napi_register__BindingOutputChunk_struct_68']?.()
|
|
147
|
+
__napiInstance.exports['__napi_register__BindingOutputChunk_impl_86']?.()
|
|
148
|
+
__napiInstance.exports['__napi_register__BindingOutputs_struct_87']?.()
|
|
149
|
+
__napiInstance.exports['__napi_register__BindingOutputs_impl_91']?.()
|
|
150
|
+
__napiInstance.exports['__napi_register__FinalBindingOutputs_struct_92']?.()
|
|
151
|
+
__napiInstance.exports['__napi_register__FinalBindingOutputs_impl_95']?.()
|
|
152
|
+
__napiInstance.exports['__napi_register__PreRenderedChunk_struct_96']?.()
|
|
153
|
+
__napiInstance.exports['__napi_register__RenderedChunk_struct_97']?.()
|
|
154
|
+
__napiInstance.exports['__napi_register__BindingRenderedModule_struct_98']?.()
|
|
155
|
+
__napiInstance.exports['__napi_register__AliasItem_struct_99']?.()
|
|
156
|
+
__napiInstance.exports['__napi_register__BindingSourcemap_struct_100']?.()
|
|
157
|
+
__napiInstance.exports['__napi_register__BindingJsonSourcemap_struct_101']?.()
|
|
140
158
|
}
|
|
141
159
|
module.exports.BindingLog = __napiModule.exports.BindingLog
|
|
142
160
|
module.exports.BindingModuleInfo = __napiModule.exports.BindingModuleInfo
|
|
@@ -151,6 +169,7 @@ module.exports.ParallelJsPluginRegistry = __napiModule.exports.ParallelJsPluginR
|
|
|
151
169
|
module.exports.BindingBuiltinPluginName = __napiModule.exports.BindingBuiltinPluginName
|
|
152
170
|
module.exports.BindingHookSideEffects = __napiModule.exports.BindingHookSideEffects
|
|
153
171
|
module.exports.BindingLogLevel = __napiModule.exports.BindingLogLevel
|
|
172
|
+
module.exports.BindingPluginOrder = __napiModule.exports.BindingPluginOrder
|
|
154
173
|
module.exports.isolatedDeclaration = __napiModule.exports.isolatedDeclaration
|
|
155
174
|
module.exports.registerPlugins = __napiModule.exports.registerPlugins
|
|
156
175
|
module.exports.transform = __napiModule.exports.transform
|
package/dist/types/binding.d.ts
CHANGED
|
@@ -18,6 +18,7 @@ export declare class BindingModuleInfo {
|
|
|
18
18
|
|
|
19
19
|
export declare class BindingOutputAsset {
|
|
20
20
|
get fileName(): string
|
|
21
|
+
get originalFileName(): string | null
|
|
21
22
|
get source(): BindingAssetSource
|
|
22
23
|
set source(source: BindingAssetSource)
|
|
23
24
|
get name(): string | null
|
|
@@ -90,33 +91,80 @@ export interface AliasItem {
|
|
|
90
91
|
}
|
|
91
92
|
|
|
92
93
|
export interface ArrowFunctionsBindingOptions {
|
|
94
|
+
/**
|
|
95
|
+
* This option enables the following:
|
|
96
|
+
* * Wrap the generated function in .bind(this) and keeps uses of this inside the function as-is, instead of using a renamed this.
|
|
97
|
+
* * Add a runtime check to ensure the functions are not instantiated.
|
|
98
|
+
* * Add names to arrow functions.
|
|
99
|
+
*
|
|
100
|
+
* @default false
|
|
101
|
+
*/
|
|
93
102
|
spec?: boolean
|
|
94
103
|
}
|
|
95
104
|
|
|
105
|
+
export interface BindingAliasPluginAlias {
|
|
106
|
+
find: BindingStringOrRegex
|
|
107
|
+
replacement: string
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export interface BindingAliasPluginConfig {
|
|
111
|
+
entries: Array<BindingAliasPluginAlias>
|
|
112
|
+
}
|
|
113
|
+
|
|
96
114
|
export interface BindingAssetSource {
|
|
97
115
|
inner: string | Uint8Array
|
|
98
116
|
}
|
|
99
117
|
|
|
118
|
+
export interface BindingBuildImportAnalysisPluginConfig {
|
|
119
|
+
preloadCode: string
|
|
120
|
+
insertPreload: boolean
|
|
121
|
+
optimizeModulePreloadRelativePaths: boolean
|
|
122
|
+
renderBuiltUrl: boolean
|
|
123
|
+
isRelativeBase: boolean
|
|
124
|
+
}
|
|
125
|
+
|
|
100
126
|
export interface BindingBuiltinPlugin {
|
|
101
|
-
|
|
127
|
+
__name: BindingBuiltinPluginName
|
|
102
128
|
options?: unknown
|
|
103
129
|
}
|
|
104
130
|
|
|
105
131
|
export declare enum BindingBuiltinPluginName {
|
|
106
|
-
|
|
107
|
-
|
|
132
|
+
WasmHelperPlugin = 0,
|
|
133
|
+
ImportGlobPlugin = 1,
|
|
134
|
+
DynamicImportVarsPlugin = 2,
|
|
135
|
+
ModulePreloadPolyfillPlugin = 3,
|
|
136
|
+
ManifestPlugin = 4,
|
|
137
|
+
LoadFallbackPlugin = 5,
|
|
138
|
+
TransformPlugin = 6,
|
|
139
|
+
WasmFallbackPlugin = 7,
|
|
140
|
+
AliasPlugin = 8,
|
|
141
|
+
JsonPlugin = 9,
|
|
142
|
+
BuildImportAnalysisPlugin = 10,
|
|
143
|
+
ReplacePlugin = 11
|
|
108
144
|
}
|
|
109
145
|
|
|
110
146
|
export interface BindingEmittedAsset {
|
|
111
147
|
name?: string
|
|
112
148
|
fileName?: string
|
|
149
|
+
originalFileName?: string
|
|
113
150
|
source: BindingAssetSource
|
|
114
151
|
}
|
|
115
152
|
|
|
153
|
+
export interface BindingGeneralHookFilter {
|
|
154
|
+
include?: Array<BindingStringOrRegex>
|
|
155
|
+
exclude?: Array<BindingStringOrRegex>
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
export interface BindingGlobImportPluginConfig {
|
|
159
|
+
root?: string
|
|
160
|
+
restoreQueryExtension?: boolean
|
|
161
|
+
}
|
|
162
|
+
|
|
116
163
|
export interface BindingHookLoadOutput {
|
|
117
164
|
code: string
|
|
118
165
|
sideEffects?: BindingHookSideEffects
|
|
119
166
|
map?: BindingSourcemap
|
|
167
|
+
moduleType?: string
|
|
120
168
|
}
|
|
121
169
|
|
|
122
170
|
export interface BindingHookRenderChunkOutput {
|
|
@@ -124,7 +172,8 @@ export interface BindingHookRenderChunkOutput {
|
|
|
124
172
|
map?: BindingSourcemap
|
|
125
173
|
}
|
|
126
174
|
|
|
127
|
-
export interface
|
|
175
|
+
export interface BindingHookResolveIdExtraArgs {
|
|
176
|
+
custom?: number
|
|
128
177
|
isEntry: boolean
|
|
129
178
|
kind: 'import' | 'dynamic-import' | 'require-call'
|
|
130
179
|
}
|
|
@@ -145,6 +194,20 @@ export interface BindingHookTransformOutput {
|
|
|
145
194
|
code?: string
|
|
146
195
|
sideEffects?: BindingHookSideEffects
|
|
147
196
|
map?: BindingSourcemap
|
|
197
|
+
moduleType?: string
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
export interface BindingInjectImportNamed {
|
|
201
|
+
tagNamed: true
|
|
202
|
+
imported: string
|
|
203
|
+
alias?: string
|
|
204
|
+
from: string
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
export interface BindingInjectImportNamespace {
|
|
208
|
+
tagNamespace: true
|
|
209
|
+
alias: string
|
|
210
|
+
from: string
|
|
148
211
|
}
|
|
149
212
|
|
|
150
213
|
export interface BindingInputItem {
|
|
@@ -164,6 +227,13 @@ export interface BindingInputOptions {
|
|
|
164
227
|
cwd: string
|
|
165
228
|
treeshake?: BindingTreeshake
|
|
166
229
|
moduleTypes?: Record<string, string>
|
|
230
|
+
define?: Array<[string, string]>
|
|
231
|
+
inject?: Array<BindingInjectImportNamed | BindingInjectImportNamespace>
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
export interface BindingJsonPluginConfig {
|
|
235
|
+
stringify?: boolean
|
|
236
|
+
isBuild?: boolean
|
|
167
237
|
}
|
|
168
238
|
|
|
169
239
|
export interface BindingJsonSourcemap {
|
|
@@ -182,16 +252,32 @@ export declare enum BindingLogLevel {
|
|
|
182
252
|
Debug = 3
|
|
183
253
|
}
|
|
184
254
|
|
|
255
|
+
export interface BindingManifestPluginConfig {
|
|
256
|
+
root: string
|
|
257
|
+
outPath: string
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
export interface BindingModulePreloadPolyfillPluginConfig {
|
|
261
|
+
skip?: boolean
|
|
262
|
+
}
|
|
263
|
+
|
|
185
264
|
export interface BindingOutputOptions {
|
|
186
265
|
name?: string
|
|
187
|
-
entryFileNames?: string
|
|
188
|
-
chunkFileNames?: string
|
|
266
|
+
entryFileNames?: string | ((chunk: PreRenderedChunk) => string)
|
|
267
|
+
chunkFileNames?: string | ((chunk: PreRenderedChunk) => string)
|
|
189
268
|
assetFileNames?: string
|
|
190
269
|
banner?: (chunk: RenderedChunk) => MaybePromise<VoidNullable<string>>
|
|
191
270
|
dir?: string
|
|
271
|
+
esModule?: boolean | 'if-default-prop'
|
|
192
272
|
exports?: 'default' | 'named' | 'none' | 'auto'
|
|
273
|
+
extend?: boolean
|
|
274
|
+
externalLiveBindings?: boolean
|
|
193
275
|
footer?: (chunk: RenderedChunk) => MaybePromise<VoidNullable<string>>
|
|
194
276
|
format?: 'es' | 'cjs' | 'iife'
|
|
277
|
+
globals?: Record<string, string>
|
|
278
|
+
inlineDynamicImports?: boolean
|
|
279
|
+
intro?: (chunk: RenderedChunk) => MaybePromise<VoidNullable<string>>
|
|
280
|
+
outro?: (chunk: RenderedChunk) => MaybePromise<VoidNullable<string>>
|
|
195
281
|
plugins: (BindingBuiltinPlugin | BindingPluginOptions | undefined)[]
|
|
196
282
|
sourcemap?: 'file' | 'inline' | 'hidden'
|
|
197
283
|
sourcemapIgnoreList?: (source: string, sourcemapPath: string) => boolean
|
|
@@ -206,24 +292,58 @@ export interface BindingPluginContextResolvedId {
|
|
|
206
292
|
|
|
207
293
|
export interface BindingPluginContextResolveOptions {
|
|
208
294
|
importKind?: 'import' | 'dynamic-import' | 'require-call'
|
|
295
|
+
skipSelf?: boolean
|
|
296
|
+
custom?: number
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
export interface BindingPluginHookMeta {
|
|
300
|
+
order?: BindingPluginOrder
|
|
209
301
|
}
|
|
210
302
|
|
|
211
303
|
export interface BindingPluginOptions {
|
|
212
304
|
name: string
|
|
213
305
|
buildStart?: (ctx: BindingPluginContext) => MaybePromise<VoidNullable>
|
|
214
|
-
|
|
306
|
+
buildStartMeta?: BindingPluginHookMeta
|
|
307
|
+
resolveId?: (ctx: BindingPluginContext, specifier: string, importer: Nullable<string>, options: BindingHookResolveIdExtraArgs) => MaybePromise<VoidNullable<BindingHookResolveIdOutput>>
|
|
308
|
+
resolveIdMeta?: BindingPluginHookMeta
|
|
309
|
+
resolveIdFilter?: BindingGeneralHookFilter
|
|
215
310
|
resolveDynamicImport?: (ctx: BindingPluginContext, specifier: string, importer: Nullable<string>) => MaybePromise<VoidNullable<BindingHookResolveIdOutput>>
|
|
311
|
+
resolveDynamicImportMeta?: BindingPluginHookMeta
|
|
216
312
|
load?: (ctx: BindingPluginContext, id: string) => MaybePromise<VoidNullable<BindingHookLoadOutput>>
|
|
217
|
-
|
|
313
|
+
loadMeta?: BindingPluginHookMeta
|
|
314
|
+
loadFilter?: BindingGeneralHookFilter
|
|
315
|
+
transform?: (ctx: BindingTransformPluginContext, id: string, code: string, module_type: BindingTransformHookExtraArgs) => MaybePromise<VoidNullable<BindingHookTransformOutput>>
|
|
316
|
+
transformMeta?: BindingPluginHookMeta
|
|
317
|
+
transformFilter?: BindingTransformHookFilter
|
|
218
318
|
moduleParsed?: (ctx: BindingPluginContext, module: BindingModuleInfo) => MaybePromise<VoidNullable>
|
|
319
|
+
moduleParsedMeta?: BindingPluginHookMeta
|
|
219
320
|
buildEnd?: (ctx: BindingPluginContext, error: Nullable<string>) => MaybePromise<VoidNullable>
|
|
321
|
+
buildEndMeta?: BindingPluginHookMeta
|
|
220
322
|
renderChunk?: (ctx: BindingPluginContext, code: string, chunk: RenderedChunk) => MaybePromise<VoidNullable<BindingHookRenderChunkOutput>>
|
|
323
|
+
renderChunkMeta?: BindingPluginHookMeta
|
|
221
324
|
augmentChunkHash?: (ctx: BindingPluginContext, chunk: RenderedChunk) => MaybePromise<void | string>
|
|
325
|
+
augmentChunkHashMeta?: BindingPluginHookMeta
|
|
222
326
|
renderStart?: (ctx: BindingPluginContext) => void
|
|
327
|
+
renderStartMeta?: BindingPluginHookMeta
|
|
223
328
|
renderError?: (ctx: BindingPluginContext, error: string) => void
|
|
329
|
+
renderErrorMeta?: BindingPluginHookMeta
|
|
224
330
|
generateBundle?: (ctx: BindingPluginContext, bundle: BindingOutputs, isWrite: boolean) => MaybePromise<VoidNullable>
|
|
331
|
+
generateBundleMeta?: BindingPluginHookMeta
|
|
225
332
|
writeBundle?: (ctx: BindingPluginContext, bundle: BindingOutputs) => MaybePromise<VoidNullable>
|
|
333
|
+
writeBundleMeta?: BindingPluginHookMeta
|
|
226
334
|
banner?: (ctx: BindingPluginContext, chunk: RenderedChunk) => void
|
|
335
|
+
bannerMeta?: BindingPluginHookMeta
|
|
336
|
+
footer?: (ctx: BindingPluginContext, chunk: RenderedChunk) => void
|
|
337
|
+
footerMeta?: BindingPluginHookMeta
|
|
338
|
+
intro?: (ctx: BindingPluginContext, chunk: RenderedChunk) => void
|
|
339
|
+
introMeta?: BindingPluginHookMeta
|
|
340
|
+
outro?: (ctx: BindingPluginContext, chunk: RenderedChunk) => void
|
|
341
|
+
outroMeta?: BindingPluginHookMeta
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
export declare enum BindingPluginOrder {
|
|
345
|
+
Pre = 0,
|
|
346
|
+
Post = 1
|
|
227
347
|
}
|
|
228
348
|
|
|
229
349
|
export interface BindingPluginWithIndex {
|
|
@@ -235,6 +355,13 @@ export interface BindingRenderedModule {
|
|
|
235
355
|
code?: string
|
|
236
356
|
}
|
|
237
357
|
|
|
358
|
+
export interface BindingReplacePluginConfig {
|
|
359
|
+
values: Record<string, string>
|
|
360
|
+
delimiters?: [string, string]
|
|
361
|
+
preventAssignment?: boolean
|
|
362
|
+
objectGuards?: boolean
|
|
363
|
+
}
|
|
364
|
+
|
|
238
365
|
export interface BindingResolveOptions {
|
|
239
366
|
alias?: Array<AliasItem>
|
|
240
367
|
aliasFields?: Array<Array<string>>
|
|
@@ -252,11 +379,42 @@ export interface BindingSourcemap {
|
|
|
252
379
|
inner: string | BindingJsonSourcemap
|
|
253
380
|
}
|
|
254
381
|
|
|
382
|
+
/**
|
|
383
|
+
* For String, value is the string content, flag is the `None`
|
|
384
|
+
* For Regex, value is the regular expression, flag is the `Some()`.
|
|
385
|
+
* Make sure put a `Some("")` in flag even there is no flag in regexp.
|
|
386
|
+
*/
|
|
387
|
+
export interface BindingStringOrRegex {
|
|
388
|
+
value: string
|
|
389
|
+
/**
|
|
390
|
+
* There is a more compact way to represent this, `Option<u8>` with bitflags, but it will be hard
|
|
391
|
+
* to use(in js side), since construct a `JsRegex` is not used frequently. Optimize it when it is needed.
|
|
392
|
+
*/
|
|
393
|
+
flag?: string
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
export interface BindingTransformHookExtraArgs {
|
|
397
|
+
moduleType: string
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
export interface BindingTransformHookFilter {
|
|
401
|
+
code?: BindingGeneralHookFilter
|
|
402
|
+
moduleType?: Array<string>
|
|
403
|
+
id?: BindingGeneralHookFilter
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
export interface BindingTransformPluginConfig {
|
|
407
|
+
include?: Array<BindingStringOrRegex>
|
|
408
|
+
exclude?: Array<BindingStringOrRegex>
|
|
409
|
+
jsxInject?: string
|
|
410
|
+
}
|
|
411
|
+
|
|
255
412
|
export interface BindingTreeshake {
|
|
256
413
|
moduleSideEffects: string
|
|
257
414
|
}
|
|
258
415
|
|
|
259
416
|
export interface Es2015BindingOptions {
|
|
417
|
+
/** Transform arrow functions into function expressions. */
|
|
260
418
|
arrowFunction?: ArrowFunctionsBindingOptions
|
|
261
419
|
}
|
|
262
420
|
|
|
@@ -268,15 +426,97 @@ export interface IsolatedDeclarationsResult {
|
|
|
268
426
|
errors: Array<string>
|
|
269
427
|
}
|
|
270
428
|
|
|
429
|
+
export interface PreRenderedChunk {
|
|
430
|
+
name: string
|
|
431
|
+
isEntry: boolean
|
|
432
|
+
isDynamicEntry: boolean
|
|
433
|
+
facadeModuleId?: string
|
|
434
|
+
moduleIds: Array<string>
|
|
435
|
+
exports: Array<string>
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
/**
|
|
439
|
+
* Configure how TSX and JSX are transformed.
|
|
440
|
+
*
|
|
441
|
+
* @see [@babel/plugin-transform-react-jsx](https://babeljs.io/docs/babel-plugin-transform-react-jsx#options)
|
|
442
|
+
*/
|
|
271
443
|
export interface ReactBindingOptions {
|
|
444
|
+
/**
|
|
445
|
+
* Decides which runtime to use.
|
|
446
|
+
*
|
|
447
|
+
* - 'automatic' - auto-import the correct JSX factories
|
|
448
|
+
* - 'classic' - no auto-import
|
|
449
|
+
*
|
|
450
|
+
* @default 'automatic'
|
|
451
|
+
*/
|
|
272
452
|
runtime?: 'classic' | 'automatic'
|
|
453
|
+
/**
|
|
454
|
+
* Emit development-specific information, such as `__source` and `__self`.
|
|
455
|
+
*
|
|
456
|
+
* @default false
|
|
457
|
+
*
|
|
458
|
+
* @see [@babel/plugin-transform-react-jsx-development](https://babeljs.io/docs/babel-plugin-transform-react-jsx-development)
|
|
459
|
+
*/
|
|
273
460
|
development?: boolean
|
|
461
|
+
/**
|
|
462
|
+
* Toggles whether or not to throw an error if an XML namespaced tag name
|
|
463
|
+
* is used.
|
|
464
|
+
*
|
|
465
|
+
* Though the JSX spec allows this, it is disabled by default since React's
|
|
466
|
+
* JSX does not currently have support for it.
|
|
467
|
+
*
|
|
468
|
+
* @default true
|
|
469
|
+
*/
|
|
274
470
|
throwIfNamespace?: boolean
|
|
471
|
+
/**
|
|
472
|
+
* Enables [@babel/plugin-transform-react-pure-annotations](https://babeljs.io/docs/en/babel-plugin-transform-react-pure-annotations).
|
|
473
|
+
*
|
|
474
|
+
* It will mark top-level React method calls as pure for tree shaking.
|
|
475
|
+
*
|
|
476
|
+
* @default true
|
|
477
|
+
*/
|
|
275
478
|
pure?: boolean
|
|
479
|
+
/**
|
|
480
|
+
* Replaces the import source when importing functions.
|
|
481
|
+
*
|
|
482
|
+
* @default 'react'
|
|
483
|
+
*/
|
|
276
484
|
importSource?: string
|
|
485
|
+
/**
|
|
486
|
+
* Replace the function used when compiling JSX expressions. It should be a
|
|
487
|
+
* qualified name (e.g. `React.createElement`) or an identifier (e.g.
|
|
488
|
+
* `createElement`).
|
|
489
|
+
*
|
|
490
|
+
* Only used for `classic` {@link runtime}.
|
|
491
|
+
*
|
|
492
|
+
* @default 'React.createElement'
|
|
493
|
+
*/
|
|
277
494
|
pragma?: string
|
|
495
|
+
/**
|
|
496
|
+
* Replace the component used when compiling JSX fragments. It should be a
|
|
497
|
+
* valid JSX tag name.
|
|
498
|
+
*
|
|
499
|
+
* Only used for `classic` {@link runtime}.
|
|
500
|
+
*
|
|
501
|
+
* @default 'React.Fragment'
|
|
502
|
+
*/
|
|
278
503
|
pragmaFrag?: string
|
|
504
|
+
/**
|
|
505
|
+
* When spreading props, use `Object.assign` directly instead of an extend helper.
|
|
506
|
+
*
|
|
507
|
+
* Only used for `classic` {@link runtime}.
|
|
508
|
+
*
|
|
509
|
+
* @default false
|
|
510
|
+
*/
|
|
279
511
|
useBuiltIns?: boolean
|
|
512
|
+
/**
|
|
513
|
+
* When spreading props, use inline object with spread elements directly
|
|
514
|
+
* instead of an extend helper or Object.assign.
|
|
515
|
+
*
|
|
516
|
+
* Only used for `classic` {@link runtime}.
|
|
517
|
+
*
|
|
518
|
+
* @default false
|
|
519
|
+
*/
|
|
280
520
|
useSpread?: boolean
|
|
281
521
|
}
|
|
282
522
|
|
|
@@ -295,7 +535,7 @@ export interface RenderedChunk {
|
|
|
295
535
|
dynamicImports: Array<string>
|
|
296
536
|
}
|
|
297
537
|
|
|
298
|
-
export interface
|
|
538
|
+
export interface SourceMap {
|
|
299
539
|
file?: string
|
|
300
540
|
mappings?: string
|
|
301
541
|
sourceRoot?: string
|
|
@@ -304,28 +544,93 @@ export interface Sourcemap {
|
|
|
304
544
|
names?: Array<string>
|
|
305
545
|
}
|
|
306
546
|
|
|
547
|
+
/**
|
|
548
|
+
* Transpile a JavaScript or TypeScript into a target ECMAScript version.
|
|
549
|
+
*
|
|
550
|
+
* @param filename The name of the file being transformed. If this is a
|
|
551
|
+
* relative path, consider setting the {@link TransformOptions#cwd} option..
|
|
552
|
+
* @param sourceText the source code itself
|
|
553
|
+
* @param options The options for the transformation. See {@link
|
|
554
|
+
* TransformOptions} for more information.
|
|
555
|
+
*
|
|
556
|
+
* @returns an object containing the transformed code, source maps, and any
|
|
557
|
+
* errors that occurred during parsing or transformation.
|
|
558
|
+
*/
|
|
307
559
|
export declare function transform(filename: string, sourceText: string, options?: TransformOptions | undefined | null): TransformResult
|
|
308
560
|
|
|
561
|
+
/**
|
|
562
|
+
* Options for transforming a JavaScript or TypeScript file.
|
|
563
|
+
*
|
|
564
|
+
* @see {@link transform}
|
|
565
|
+
*/
|
|
309
566
|
export interface TransformOptions {
|
|
310
567
|
sourceType?: 'script' | 'module' | 'unambiguous' | undefined
|
|
311
|
-
/**
|
|
568
|
+
/**
|
|
569
|
+
* The current working directory. Used to resolve relative paths in other
|
|
570
|
+
* options.
|
|
571
|
+
*/
|
|
572
|
+
cwd?: string
|
|
573
|
+
/**
|
|
574
|
+
* Force jsx parsing,
|
|
575
|
+
*
|
|
576
|
+
* @default false
|
|
577
|
+
*/
|
|
312
578
|
jsx?: boolean
|
|
579
|
+
/** Configure how TypeScript is transformed. */
|
|
313
580
|
typescript?: TypeScriptBindingOptions
|
|
581
|
+
/** Configure how TSX and JSX are transformed. */
|
|
314
582
|
react?: ReactBindingOptions
|
|
583
|
+
/** Enable ES2015 transformations. */
|
|
315
584
|
es2015?: Es2015BindingOptions
|
|
316
585
|
/**
|
|
317
|
-
* Enable
|
|
586
|
+
* Enable source map generation.
|
|
587
|
+
*
|
|
588
|
+
* When `true`, the `sourceMap` field of transform result objects will be populated.
|
|
318
589
|
*
|
|
319
|
-
*
|
|
590
|
+
* @default false
|
|
320
591
|
*
|
|
321
|
-
*
|
|
592
|
+
* @see {@link SourceMap}
|
|
322
593
|
*/
|
|
323
594
|
sourcemap?: boolean
|
|
324
595
|
}
|
|
325
596
|
|
|
326
597
|
export interface TransformResult {
|
|
598
|
+
/**
|
|
599
|
+
* The transformed code.
|
|
600
|
+
*
|
|
601
|
+
* If parsing failed, this will be an empty string.
|
|
602
|
+
*/
|
|
327
603
|
sourceText: string
|
|
328
|
-
|
|
604
|
+
/**
|
|
605
|
+
* The source map for the transformed code.
|
|
606
|
+
*
|
|
607
|
+
* This will be set if {@link TransformOptions#sourcemap} is `true`.
|
|
608
|
+
*/
|
|
609
|
+
sourceMap?: SourceMap
|
|
610
|
+
/**
|
|
611
|
+
* The `.d.ts` declaration file for the transformed code. Declarations are
|
|
612
|
+
* only generated if `declaration` is set to `true` and a TypeScript file
|
|
613
|
+
* is provided.
|
|
614
|
+
*
|
|
615
|
+
* If parsing failed and `declaration` is set, this will be an empty string.
|
|
616
|
+
*
|
|
617
|
+
* @see {@link TypeScriptBindingOptions#declaration}
|
|
618
|
+
* @see [declaration tsconfig option](https://www.typescriptlang.org/tsconfig/#declaration)
|
|
619
|
+
*/
|
|
620
|
+
declaration?: string
|
|
621
|
+
/**
|
|
622
|
+
* Declaration source map. Only generated if both
|
|
623
|
+
* {@link TypeScriptBindingOptions#declaration declaration} and
|
|
624
|
+
* {@link TransformOptions#sourcemap sourcemap} are set to `true`.
|
|
625
|
+
*/
|
|
626
|
+
declarationMap?: SourceMap
|
|
627
|
+
/**
|
|
628
|
+
* Parse and transformation errors.
|
|
629
|
+
*
|
|
630
|
+
* Oxc's parser recovers from common syntax errors, meaning that
|
|
631
|
+
* transformed code may still be available even if there are errors in this
|
|
632
|
+
* list.
|
|
633
|
+
*/
|
|
329
634
|
errors: Array<string>
|
|
330
635
|
}
|
|
331
636
|
|
|
@@ -335,5 +640,15 @@ export interface TypeScriptBindingOptions {
|
|
|
335
640
|
onlyRemoveTypeImports?: boolean
|
|
336
641
|
allowNamespaces?: boolean
|
|
337
642
|
allowDeclareFields?: boolean
|
|
643
|
+
/**
|
|
644
|
+
* Also generate a `.d.ts` declaration file for TypeScript files.
|
|
645
|
+
*
|
|
646
|
+
* The source file must be compliant with all
|
|
647
|
+
* [`isolatedDeclarations`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-5-5.html#isolated-declarations)
|
|
648
|
+
* requirements.
|
|
649
|
+
*
|
|
650
|
+
* @default false
|
|
651
|
+
*/
|
|
652
|
+
declaration?: boolean
|
|
338
653
|
}
|
|
339
654
|
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare const flattenedSchema: Record<string, import("./types").Schema>;
|
|
2
|
+
export declare const options: {
|
|
3
|
+
[k: string]: {
|
|
4
|
+
type: "boolean" | "string";
|
|
5
|
+
multiple: boolean;
|
|
6
|
+
short?: string;
|
|
7
|
+
default?: boolean | string | string[];
|
|
8
|
+
hint?: string;
|
|
9
|
+
description?: string;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
export type ParseArgsOptions = typeof options;
|
|
13
|
+
export declare function parseCliArguments(): import("./normalize").NormalizedCliOptions;
|