rolldown 0.13.2 → 0.14.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/LICENSE +1 -1
- package/dist/cjs/cli.cjs +388 -95
- package/dist/cjs/experimental-index.cjs +2 -3
- package/dist/cjs/index.cjs +2 -13
- package/dist/cjs/parallel-plugin-worker.cjs +2 -2
- package/dist/esm/cli.mjs +387 -94
- package/dist/esm/experimental-index.mjs +1 -2
- package/dist/esm/index.mjs +2 -14
- package/dist/esm/parallel-plugin-worker.mjs +1 -1
- package/dist/shared/{consola.36c0034f-eps_ogJv.cjs → consola.36c0034f-HcmWcfPe.cjs} +2 -2
- package/dist/shared/{consola.36c0034f-m5cABVv4.mjs → consola.36c0034f-Xyw7SC_7.mjs} +1 -1
- package/dist/shared/{prompt-Ah5G71p-.cjs → prompt-9Ij3R3TG.cjs} +2 -2
- package/dist/shared/{prompt-9VjtYvi_.mjs → prompt-hoPhcrA-.mjs} +1 -1
- package/dist/shared/rolldown-binding.wasi.cjs +82 -73
- package/dist/shared/src_index-3pqhEViJ.cjs +2785 -0
- package/dist/shared/src_index-ywYMd4vB.mjs +2786 -0
- package/dist/shared/watcher-worker.js +1 -0
- package/dist/types/binding.d.ts +154 -66
- package/dist/types/cli/arguments/alias.d.ts +1 -0
- package/dist/types/cli/arguments/index.d.ts +1 -1
- package/dist/types/cli/arguments/normalize.d.ts +1 -0
- package/dist/types/cli/arguments/schema.d.ts +120 -35
- package/dist/types/constants/plugin.d.ts +1 -1
- package/dist/types/constants/types.d.ts +1 -0
- package/dist/types/experimental-index.d.ts +1 -0
- package/dist/types/index.d.ts +6 -5
- package/dist/types/log/logger.d.ts +9 -2
- package/dist/types/options/input-options.d.ts +241 -13
- package/dist/types/options/normalized-alias-plugin-config.d.ts +0 -2
- package/dist/types/options/normalized-output-options.d.ts +1 -1
- package/dist/types/options/output-options.d.ts +52 -54
- package/dist/types/options/watch-option.d.ts +5 -0
- package/dist/types/plugin/bindingify-hook-filter.d.ts +2 -0
- package/dist/types/plugin/bindingify-output-hooks.d.ts +1 -0
- package/dist/types/plugin/bindingify-watch-hooks.d.ts +7 -0
- package/dist/types/plugin/hook-filter.d.ts +48 -0
- package/dist/types/plugin/index.d.ts +9 -15
- package/dist/types/plugin/plugin-context-data.d.ts +1 -1
- package/dist/types/plugin/plugin-context.d.ts +2 -6
- package/dist/types/plugin/plugin-driver.d.ts +1 -0
- package/dist/types/rolldown-build.d.ts +1 -1
- package/dist/types/rolldown.d.ts +3 -0
- package/dist/types/types/utils.d.ts +1 -0
- package/dist/types/utils/create-bundler.d.ts +3 -2
- package/dist/types/utils/transform-to-rollup-output.d.ts +8 -3
- package/dist/types/watcher.d.ts +31 -0
- package/package.json +19 -17
- package/dist/shared/package-8qJYyGdm.cjs +0 -11
- package/dist/shared/package-unZcnfG9.mjs +0 -9
- package/dist/shared/plugin-context-data-F1I9ytXp.cjs +0 -1435
- package/dist/shared/plugin-context-data-iKSAvmTX.mjs +0 -1442
- package/dist/shared/rolldown-ESzFTeqV.cjs +0 -1087
- package/dist/shared/rolldown-Hf7txSlh.mjs +0 -1071
- /package/dist/shared/{chunk-gQ4GMlVi.cjs → chunk-JoMxl5V2.cjs} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
while (true) {}
|
package/dist/types/binding.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
type MaybePromise<T> = T | Promise<T>
|
|
2
2
|
type Nullable<T> = T | null | undefined
|
|
3
3
|
type VoidNullable<T = void> = T | null | undefined | void
|
|
4
|
+
export type BindingStringOrRegex = string | RegExp
|
|
5
|
+
|
|
4
6
|
export declare class BindingLog {
|
|
5
7
|
code: string
|
|
6
8
|
message: string
|
|
@@ -20,7 +22,6 @@ export declare class BindingOutputAsset {
|
|
|
20
22
|
get fileName(): string
|
|
21
23
|
get originalFileName(): string | null
|
|
22
24
|
get source(): BindingAssetSource
|
|
23
|
-
set source(source: BindingAssetSource)
|
|
24
25
|
get name(): string | null
|
|
25
26
|
}
|
|
26
27
|
|
|
@@ -33,22 +34,17 @@ export declare class BindingOutputChunk {
|
|
|
33
34
|
get fileName(): string
|
|
34
35
|
get modules(): Record<string, BindingRenderedModule>
|
|
35
36
|
get imports(): Array<string>
|
|
36
|
-
set imports(imports: Array<string>)
|
|
37
37
|
get dynamicImports(): Array<string>
|
|
38
38
|
get code(): string
|
|
39
|
-
set code(code: string)
|
|
40
39
|
get map(): string | null
|
|
41
|
-
set map(map: string)
|
|
42
40
|
get sourcemapFileName(): string | null
|
|
43
41
|
get preliminaryFileName(): string
|
|
44
42
|
get name(): string
|
|
45
43
|
}
|
|
46
44
|
|
|
47
|
-
/** The `BindingOutputs` owner `Vec<Output>` the mutable reference, it avoid `Clone` at call `writeBundle/generateBundle` hook, and make it mutable. */
|
|
48
45
|
export declare class BindingOutputs {
|
|
49
46
|
get chunks(): Array<BindingOutputChunk>
|
|
50
47
|
get assets(): Array<BindingOutputAsset>
|
|
51
|
-
delete(fileName: string): void
|
|
52
48
|
}
|
|
53
49
|
|
|
54
50
|
export declare class BindingPluginContext {
|
|
@@ -57,26 +53,25 @@ export declare class BindingPluginContext {
|
|
|
57
53
|
getFileName(referenceId: string): string
|
|
58
54
|
getModuleInfo(moduleId: string): BindingModuleInfo | null
|
|
59
55
|
getModuleIds(): Array<string> | null
|
|
56
|
+
addWatchFile(file: string): void
|
|
60
57
|
}
|
|
61
58
|
|
|
62
59
|
export declare class BindingTransformPluginContext {
|
|
63
60
|
inner(): BindingPluginContext
|
|
64
61
|
}
|
|
65
62
|
|
|
63
|
+
export declare class BindingWatcher {
|
|
64
|
+
close(): Promise<void>
|
|
65
|
+
on(event: BindingWatcherEvent, listener: (data?: Record<string, string>) => void): void
|
|
66
|
+
}
|
|
67
|
+
|
|
66
68
|
export declare class Bundler {
|
|
67
69
|
constructor(inputOptions: BindingInputOptions, outputOptions: BindingOutputOptions, parallelPluginsRegistry?: ParallelJsPluginRegistry | undefined | null)
|
|
68
|
-
write(): Promise<
|
|
69
|
-
generate(): Promise<
|
|
70
|
+
write(): Promise<BindingOutputs>
|
|
71
|
+
generate(): Promise<BindingOutputs>
|
|
70
72
|
scan(): Promise<void>
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
* The `FinalBindingOutputs` is used at `write()` or `generate()`, it is similar to `BindingOutputs`, if using `BindingOutputs` has unexpected behavior.
|
|
75
|
-
* TODO find a way to export it gracefully.
|
|
76
|
-
*/
|
|
77
|
-
export declare class FinalBindingOutputs {
|
|
78
|
-
get chunks(): Array<BindingOutputChunk>
|
|
79
|
-
get assets(): Array<BindingOutputAsset>
|
|
73
|
+
close(): Promise<void>
|
|
74
|
+
watch(): Promise<BindingWatcher>
|
|
80
75
|
}
|
|
81
76
|
|
|
82
77
|
export declare class ParallelJsPluginRegistry {
|
|
@@ -90,7 +85,7 @@ export interface AliasItem {
|
|
|
90
85
|
replacements: Array<string>
|
|
91
86
|
}
|
|
92
87
|
|
|
93
|
-
export interface
|
|
88
|
+
export interface ArrowFunctionsOptions {
|
|
94
89
|
/**
|
|
95
90
|
* This option enables the following:
|
|
96
91
|
* * Wrap the generated function in .bind(this) and keeps uses of this inside the function as-is, instead of using a renamed this.
|
|
@@ -156,6 +151,11 @@ export interface BindingEmittedAsset {
|
|
|
156
151
|
source: BindingAssetSource
|
|
157
152
|
}
|
|
158
153
|
|
|
154
|
+
export interface BindingExperimentalOptions {
|
|
155
|
+
strictExecutionOrder?: boolean
|
|
156
|
+
disableLiveBindings?: boolean
|
|
157
|
+
}
|
|
158
|
+
|
|
159
159
|
export interface BindingGeneralHookFilter {
|
|
160
160
|
include?: Array<BindingStringOrRegex>
|
|
161
161
|
exclude?: Array<BindingStringOrRegex>
|
|
@@ -235,6 +235,10 @@ export interface BindingInputOptions {
|
|
|
235
235
|
moduleTypes?: Record<string, string>
|
|
236
236
|
define?: Array<[string, string]>
|
|
237
237
|
inject?: Array<BindingInjectImportNamed | BindingInjectImportNamespace>
|
|
238
|
+
experimental?: BindingExperimentalOptions
|
|
239
|
+
profilerNames?: boolean
|
|
240
|
+
jsx?: JsxOptions
|
|
241
|
+
watch?: BindingWatchOption
|
|
238
242
|
}
|
|
239
243
|
|
|
240
244
|
export interface BindingJsonPluginConfig {
|
|
@@ -265,7 +269,7 @@ export interface BindingManifestPluginConfig {
|
|
|
265
269
|
|
|
266
270
|
export interface BindingMatchGroup {
|
|
267
271
|
name: string
|
|
268
|
-
test?:
|
|
272
|
+
test?: BindingStringOrRegex
|
|
269
273
|
priority?: number
|
|
270
274
|
minSize?: number
|
|
271
275
|
minShareCount?: number
|
|
@@ -275,6 +279,11 @@ export interface BindingModulePreloadPolyfillPluginConfig {
|
|
|
275
279
|
skip?: boolean
|
|
276
280
|
}
|
|
277
281
|
|
|
282
|
+
export interface BindingNotifyOption {
|
|
283
|
+
pollInterval?: number
|
|
284
|
+
compareContents?: boolean
|
|
285
|
+
}
|
|
286
|
+
|
|
278
287
|
export interface BindingOutputOptions {
|
|
279
288
|
name?: string
|
|
280
289
|
entryFileNames?: string | ((chunk: PreRenderedChunk) => string)
|
|
@@ -282,12 +291,13 @@ export interface BindingOutputOptions {
|
|
|
282
291
|
assetFileNames?: string
|
|
283
292
|
banner?: (chunk: RenderedChunk) => MaybePromise<VoidNullable<string>>
|
|
284
293
|
dir?: string
|
|
294
|
+
file?: string
|
|
285
295
|
esModule?: boolean | 'if-default-prop'
|
|
286
296
|
exports?: 'default' | 'named' | 'none' | 'auto'
|
|
287
297
|
extend?: boolean
|
|
288
298
|
externalLiveBindings?: boolean
|
|
289
299
|
footer?: (chunk: RenderedChunk) => MaybePromise<VoidNullable<string>>
|
|
290
|
-
format?: 'es' | 'cjs' | 'iife'
|
|
300
|
+
format?: 'es' | 'cjs' | 'iife' | 'umd'
|
|
291
301
|
globals?: Record<string, string>
|
|
292
302
|
inlineDynamicImports?: boolean
|
|
293
303
|
intro?: (chunk: RenderedChunk) => MaybePromise<VoidNullable<string>>
|
|
@@ -295,6 +305,7 @@ export interface BindingOutputOptions {
|
|
|
295
305
|
plugins: (BindingBuiltinPlugin | BindingPluginOptions | undefined)[]
|
|
296
306
|
sourcemap?: 'file' | 'inline' | 'hidden'
|
|
297
307
|
sourcemapIgnoreList?: (source: string, sourcemapPath: string) => boolean
|
|
308
|
+
sourcemapDebugIds?: boolean
|
|
298
309
|
sourcemapPathTransform?: (source: string, sourcemapPath: string) => string
|
|
299
310
|
minify?: boolean
|
|
300
311
|
advancedChunks?: BindingAdvancedChunksOptions
|
|
@@ -342,10 +353,16 @@ export interface BindingPluginOptions {
|
|
|
342
353
|
renderStartMeta?: BindingPluginHookMeta
|
|
343
354
|
renderError?: (ctx: BindingPluginContext, error: string) => void
|
|
344
355
|
renderErrorMeta?: BindingPluginHookMeta
|
|
345
|
-
generateBundle?: (ctx: BindingPluginContext, bundle: BindingOutputs, isWrite: boolean) => MaybePromise<VoidNullable
|
|
356
|
+
generateBundle?: (ctx: BindingPluginContext, bundle: BindingOutputs, isWrite: boolean) => MaybePromise<VoidNullable<JsChangedOutputs>>
|
|
346
357
|
generateBundleMeta?: BindingPluginHookMeta
|
|
347
|
-
writeBundle?: (ctx: BindingPluginContext, bundle: BindingOutputs) => MaybePromise<VoidNullable
|
|
358
|
+
writeBundle?: (ctx: BindingPluginContext, bundle: BindingOutputs) => MaybePromise<VoidNullable<JsChangedOutputs>>
|
|
348
359
|
writeBundleMeta?: BindingPluginHookMeta
|
|
360
|
+
closeBundle?: (ctx: BindingPluginContext) => MaybePromise<VoidNullable>
|
|
361
|
+
closeBundleMeta?: BindingPluginHookMeta
|
|
362
|
+
watchChange?: (ctx: BindingPluginContext, path: string, event: string) => MaybePromise<VoidNullable>
|
|
363
|
+
watchChangeMeta?: BindingPluginHookMeta
|
|
364
|
+
closeWatcher?: (ctx: BindingPluginContext) => MaybePromise<VoidNullable>
|
|
365
|
+
closeWatcherMeta?: BindingPluginHookMeta
|
|
349
366
|
banner?: (ctx: BindingPluginContext, chunk: RenderedChunk) => void
|
|
350
367
|
bannerMeta?: BindingPluginHookMeta
|
|
351
368
|
footer?: (ctx: BindingPluginContext, chunk: RenderedChunk) => void
|
|
@@ -383,6 +400,7 @@ export interface BindingResolveOptions {
|
|
|
383
400
|
conditionNames?: Array<string>
|
|
384
401
|
exportsFields?: Array<Array<string>>
|
|
385
402
|
extensions?: Array<string>
|
|
403
|
+
extensionAlias?: Array<ExtensionAliasItem>
|
|
386
404
|
mainFields?: Array<string>
|
|
387
405
|
mainFiles?: Array<string>
|
|
388
406
|
modules?: Array<string>
|
|
@@ -394,20 +412,6 @@ export interface BindingSourcemap {
|
|
|
394
412
|
inner: string | BindingJsonSourcemap
|
|
395
413
|
}
|
|
396
414
|
|
|
397
|
-
/**
|
|
398
|
-
* For String, value is the string content, flag is the `None`
|
|
399
|
-
* For Regex, value is the regular expression, flag is the `Some()`.
|
|
400
|
-
* Make sure put a `Some("")` in flag even there is no flag in regexp.
|
|
401
|
-
*/
|
|
402
|
-
export interface BindingStringOrRegex {
|
|
403
|
-
value: string
|
|
404
|
-
/**
|
|
405
|
-
* There is a more compact way to represent this, `Option<u8>` with bitflags, but it will be hard
|
|
406
|
-
* to use(in js side), since construct a `JsRegex` is not used frequently. Optimize it when it is needed.
|
|
407
|
-
*/
|
|
408
|
-
flag?: string
|
|
409
|
-
}
|
|
410
|
-
|
|
411
415
|
export interface BindingTransformHookExtraArgs {
|
|
412
416
|
moduleType: string
|
|
413
417
|
}
|
|
@@ -422,22 +426,51 @@ export interface BindingTransformPluginConfig {
|
|
|
422
426
|
include?: Array<BindingStringOrRegex>
|
|
423
427
|
exclude?: Array<BindingStringOrRegex>
|
|
424
428
|
jsxInject?: string
|
|
429
|
+
targets?: string
|
|
425
430
|
}
|
|
426
431
|
|
|
427
432
|
export interface BindingTreeshake {
|
|
428
433
|
moduleSideEffects: string
|
|
429
434
|
}
|
|
430
435
|
|
|
431
|
-
export
|
|
436
|
+
export declare enum BindingWatcherEvent {
|
|
437
|
+
Close = 0,
|
|
438
|
+
Event = 1,
|
|
439
|
+
ReStart = 2,
|
|
440
|
+
Change = 3
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
export interface BindingWatchOption {
|
|
444
|
+
skipWrite?: boolean
|
|
445
|
+
notify?: BindingNotifyOption
|
|
446
|
+
include?: Array<BindingStringOrRegex>
|
|
447
|
+
exclude?: Array<BindingStringOrRegex>
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
export interface Es2015Options {
|
|
432
451
|
/** Transform arrow functions into function expressions. */
|
|
433
|
-
arrowFunction?:
|
|
452
|
+
arrowFunction?: ArrowFunctionsOptions
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
export interface ExtensionAliasItem {
|
|
456
|
+
target: string
|
|
457
|
+
replacements: Array<string>
|
|
434
458
|
}
|
|
435
459
|
|
|
436
460
|
/** TypeScript Isolated Declarations for Standalone DTS Emit */
|
|
437
|
-
export declare function isolatedDeclaration(filename: string, sourceText: string, options
|
|
461
|
+
export declare function isolatedDeclaration(filename: string, sourceText: string, options?: IsolatedDeclarationsOptions | undefined | null): IsolatedDeclarationsResult
|
|
438
462
|
|
|
439
463
|
export interface IsolatedDeclarationsOptions {
|
|
440
|
-
|
|
464
|
+
/**
|
|
465
|
+
* Do not emit declarations for code that has an @internal annotation in its JSDoc comment.
|
|
466
|
+
* This is an internal compiler option; use at your own risk, because the compiler does not check that the result is valid.
|
|
467
|
+
*
|
|
468
|
+
* Default: `false`
|
|
469
|
+
*
|
|
470
|
+
* See <https://www.typescriptlang.org/tsconfig/#stripInternal>
|
|
471
|
+
*/
|
|
472
|
+
stripInternal?: boolean
|
|
473
|
+
sourcemap?: boolean
|
|
441
474
|
}
|
|
442
475
|
|
|
443
476
|
export interface IsolatedDeclarationsResult {
|
|
@@ -446,21 +479,42 @@ export interface IsolatedDeclarationsResult {
|
|
|
446
479
|
errors: Array<string>
|
|
447
480
|
}
|
|
448
481
|
|
|
449
|
-
export interface
|
|
482
|
+
export interface JsChangedOutputs {
|
|
483
|
+
chunks: Array<JsOutputChunk>
|
|
484
|
+
assets: Array<JsOutputAsset>
|
|
485
|
+
deleted: Array<string>
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
export interface JsOutputAsset {
|
|
489
|
+
name?: string
|
|
490
|
+
originalFileName?: string
|
|
491
|
+
filename: string
|
|
492
|
+
source: BindingAssetSource
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
export interface JsOutputChunk {
|
|
450
496
|
name: string
|
|
451
497
|
isEntry: boolean
|
|
452
498
|
isDynamicEntry: boolean
|
|
453
499
|
facadeModuleId?: string
|
|
454
500
|
moduleIds: Array<string>
|
|
455
501
|
exports: Array<string>
|
|
502
|
+
filename: string
|
|
503
|
+
modules: Record<string, BindingRenderedModule>
|
|
504
|
+
imports: Array<string>
|
|
505
|
+
dynamicImports: Array<string>
|
|
506
|
+
code: string
|
|
507
|
+
map?: BindingSourcemap
|
|
508
|
+
sourcemapFilename?: string
|
|
509
|
+
preliminaryFilename: string
|
|
456
510
|
}
|
|
457
511
|
|
|
458
512
|
/**
|
|
459
513
|
* Configure how TSX and JSX are transformed.
|
|
460
514
|
*
|
|
461
|
-
* @see
|
|
515
|
+
* @see {@link https://babeljs.io/docs/babel-plugin-transform-react-jsx#options}
|
|
462
516
|
*/
|
|
463
|
-
export interface
|
|
517
|
+
export interface JsxOptions {
|
|
464
518
|
/**
|
|
465
519
|
* Decides which runtime to use.
|
|
466
520
|
*
|
|
@@ -475,7 +529,7 @@ export interface ReactBindingOptions {
|
|
|
475
529
|
*
|
|
476
530
|
* @default false
|
|
477
531
|
*
|
|
478
|
-
* @see
|
|
532
|
+
* @see {@link https://babeljs.io/docs/babel-plugin-transform-react-jsx-development}
|
|
479
533
|
*/
|
|
480
534
|
development?: boolean
|
|
481
535
|
/**
|
|
@@ -489,10 +543,12 @@ export interface ReactBindingOptions {
|
|
|
489
543
|
*/
|
|
490
544
|
throwIfNamespace?: boolean
|
|
491
545
|
/**
|
|
492
|
-
* Enables
|
|
546
|
+
* Enables `@babel/plugin-transform-react-pure-annotations`.
|
|
493
547
|
*
|
|
494
548
|
* It will mark top-level React method calls as pure for tree shaking.
|
|
495
549
|
*
|
|
550
|
+
* @see {@link https://babeljs.io/docs/en/babel-plugin-transform-react-pure-annotations}
|
|
551
|
+
*
|
|
496
552
|
* @default true
|
|
497
553
|
*/
|
|
498
554
|
pure?: boolean
|
|
@@ -538,6 +594,39 @@ export interface ReactBindingOptions {
|
|
|
538
594
|
* @default false
|
|
539
595
|
*/
|
|
540
596
|
useSpread?: boolean
|
|
597
|
+
/**
|
|
598
|
+
* Enable React Fast Refresh .
|
|
599
|
+
*
|
|
600
|
+
* Conforms to the implementation in {@link https://github.com/facebook/react/tree/main/packages/react-refresh}
|
|
601
|
+
*
|
|
602
|
+
* @default false
|
|
603
|
+
*/
|
|
604
|
+
refresh?: boolean | ReactRefreshOptions
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
export interface PreRenderedChunk {
|
|
608
|
+
name: string
|
|
609
|
+
isEntry: boolean
|
|
610
|
+
isDynamicEntry: boolean
|
|
611
|
+
facadeModuleId?: string
|
|
612
|
+
moduleIds: Array<string>
|
|
613
|
+
exports: Array<string>
|
|
614
|
+
}
|
|
615
|
+
|
|
616
|
+
export interface ReactRefreshOptions {
|
|
617
|
+
/**
|
|
618
|
+
* Specify the identifier of the refresh registration variable.
|
|
619
|
+
*
|
|
620
|
+
* @default `$RefreshReg$`.
|
|
621
|
+
*/
|
|
622
|
+
refreshReg?: string
|
|
623
|
+
/**
|
|
624
|
+
* Specify the identifier of the refresh signature variable.
|
|
625
|
+
*
|
|
626
|
+
* @default `$RefreshSig$`.
|
|
627
|
+
*/
|
|
628
|
+
refreshSig?: string
|
|
629
|
+
emitFullSignatures?: boolean
|
|
541
630
|
}
|
|
542
631
|
|
|
543
632
|
export declare function registerPlugins(id: number, plugins: Array<BindingPluginWithIndex>): void
|
|
@@ -557,11 +646,13 @@ export interface RenderedChunk {
|
|
|
557
646
|
|
|
558
647
|
export interface SourceMap {
|
|
559
648
|
file?: string
|
|
560
|
-
mappings
|
|
649
|
+
mappings: string
|
|
650
|
+
names: Array<string>
|
|
561
651
|
sourceRoot?: string
|
|
562
|
-
sources
|
|
563
|
-
sourcesContent?: Array<string
|
|
564
|
-
|
|
652
|
+
sources: Array<string>
|
|
653
|
+
sourcesContent?: Array<string>
|
|
654
|
+
version: number
|
|
655
|
+
x_google_ignoreList?: Array<number>
|
|
565
656
|
}
|
|
566
657
|
|
|
567
658
|
/**
|
|
@@ -585,23 +676,13 @@ export declare function transform(filename: string, sourceText: string, options?
|
|
|
585
676
|
*/
|
|
586
677
|
export interface TransformOptions {
|
|
587
678
|
sourceType?: 'script' | 'module' | 'unambiguous' | undefined
|
|
679
|
+
/** Treat the source text as `js`, `jsx`, `ts`, or `tsx`. */
|
|
680
|
+
lang?: 'js' | 'jsx' | 'ts' | 'tsx'
|
|
588
681
|
/**
|
|
589
682
|
* The current working directory. Used to resolve relative paths in other
|
|
590
683
|
* options.
|
|
591
684
|
*/
|
|
592
685
|
cwd?: string
|
|
593
|
-
/**
|
|
594
|
-
* Force jsx parsing,
|
|
595
|
-
*
|
|
596
|
-
* @default false
|
|
597
|
-
*/
|
|
598
|
-
jsx?: boolean
|
|
599
|
-
/** Configure how TypeScript is transformed. */
|
|
600
|
-
typescript?: TypeScriptBindingOptions
|
|
601
|
-
/** Configure how TSX and JSX are transformed. */
|
|
602
|
-
react?: ReactBindingOptions
|
|
603
|
-
/** Enable ES2015 transformations. */
|
|
604
|
-
es2015?: Es2015BindingOptions
|
|
605
686
|
/**
|
|
606
687
|
* Enable source map generation.
|
|
607
688
|
*
|
|
@@ -612,6 +693,14 @@ export interface TransformOptions {
|
|
|
612
693
|
* @see {@link SourceMap}
|
|
613
694
|
*/
|
|
614
695
|
sourcemap?: boolean
|
|
696
|
+
/** Configure how TypeScript is transformed. */
|
|
697
|
+
typescript?: TypeScriptOptions
|
|
698
|
+
/** Configure how TSX and JSX are transformed. */
|
|
699
|
+
jsx?: JsxOptions
|
|
700
|
+
/** Define Plugin */
|
|
701
|
+
define?: Record<string, string>
|
|
702
|
+
/** Inject Plugin */
|
|
703
|
+
inject?: Record<string, string | [string, string]>
|
|
615
704
|
}
|
|
616
705
|
|
|
617
706
|
export interface TransformResult {
|
|
@@ -634,13 +723,13 @@ export interface TransformResult {
|
|
|
634
723
|
*
|
|
635
724
|
* If parsing failed and `declaration` is set, this will be an empty string.
|
|
636
725
|
*
|
|
637
|
-
* @see {@link
|
|
726
|
+
* @see {@link TypeScriptOptions#declaration}
|
|
638
727
|
* @see [declaration tsconfig option](https://www.typescriptlang.org/tsconfig/#declaration)
|
|
639
728
|
*/
|
|
640
729
|
declaration?: string
|
|
641
730
|
/**
|
|
642
731
|
* Declaration source map. Only generated if both
|
|
643
|
-
* {@link
|
|
732
|
+
* {@link TypeScriptOptions#declaration declaration} and
|
|
644
733
|
* {@link TransformOptions#sourcemap sourcemap} are set to `true`.
|
|
645
734
|
*/
|
|
646
735
|
declarationMap?: SourceMap
|
|
@@ -654,7 +743,7 @@ export interface TransformResult {
|
|
|
654
743
|
errors: Array<string>
|
|
655
744
|
}
|
|
656
745
|
|
|
657
|
-
export interface
|
|
746
|
+
export interface TypeScriptOptions {
|
|
658
747
|
jsxPragma?: string
|
|
659
748
|
jsxPragmaFrag?: string
|
|
660
749
|
onlyRemoveTypeImports?: boolean
|
|
@@ -669,7 +758,7 @@ export interface TypeScriptBindingOptions {
|
|
|
669
758
|
*
|
|
670
759
|
* @default false
|
|
671
760
|
*/
|
|
672
|
-
declaration?:
|
|
761
|
+
declaration?: IsolatedDeclarationsOptions
|
|
673
762
|
/**
|
|
674
763
|
* Rewrite or remove TypeScript import/export declaration extensions.
|
|
675
764
|
*
|
|
@@ -682,4 +771,3 @@ export interface TypeScriptBindingOptions {
|
|
|
682
771
|
*/
|
|
683
772
|
rewriteImportExtensions?: 'rewrite' | 'remove' | boolean
|
|
684
773
|
}
|
|
685
|
-
|