vite-plus 0.2.0 → 0.2.2

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.
Files changed (68) hide show
  1. package/bin/oxfmt +6 -3
  2. package/bin/oxlint +6 -3
  3. package/bin/vpr +9 -0
  4. package/binding/index.cjs +53 -53
  5. package/binding/index.d.cts +86 -144
  6. package/dist/agent-D7O7mSeO.js +9456 -0
  7. package/dist/bin.js +10 -7
  8. package/dist/{cli-truncate-CWsmbK3p.js → cli-truncate-BVOlIIPy.js} +1 -1
  9. package/dist/config/bin.js +2 -2
  10. package/dist/{constants-CrfJQIUX.js → constants-NeTOxrzV.js} +7 -3
  11. package/dist/create/bin.js +22 -60
  12. package/dist/{define-config-2tfJoXr1.d.ts → define-config-BuMs_LKa.d.ts} +64 -9
  13. package/dist/{define-config-DJUehepE.js → define-config-CSgy0zML.js} +43 -18
  14. package/dist/{define-config-BGSjF6Xp.cjs → define-config-CrA3lZhQ.cjs} +61 -22
  15. package/dist/define-config.cjs +2 -1
  16. package/dist/define-config.d.ts +2 -2
  17. package/dist/define-config.js +2 -2
  18. package/dist/{dist-Oxo16Y0q.js → dist-CKz3vcoG.js} +4 -4
  19. package/dist/dist-CtM2JRbM.js +3 -0
  20. package/dist/editor-CPzssglc.js +584 -0
  21. package/dist/index.cjs +1 -1
  22. package/dist/index.d.ts +1 -1
  23. package/dist/index.js +1 -1
  24. package/dist/{json-Dn87fvjk.js → json-DiRs8ceZ.js} +13 -1
  25. package/dist/{log-update-lyIiuflf.js → log-update-DHZRyJ2m.js} +2 -2
  26. package/dist/migration/bin.d.ts +1 -10
  27. package/dist/migration/bin.js +531 -170
  28. package/dist/migration/compat/worker.d.ts +1 -0
  29. package/dist/migration/compat/worker.js +35 -0
  30. package/dist/{oxlint-plugin-config-q8a5PFch.js → oxlint-plugin-config-C2Rqc_WQ.js} +1 -1
  31. package/dist/oxlint-plugin.js +78 -9
  32. package/dist/pack-bin.js +1 -1
  33. package/dist/{package-BHirM1_v.js → package-CU2g7URl.js} +52 -3
  34. package/dist/protocol-D99W10Qi.js +4 -0
  35. package/dist/{report-BHSkWqRR.js → report-BS7ULx7A.js} +2 -0
  36. package/dist/{resolve-vite-config-CmdsfQzS.js → resolve-vite-config-r91rIaPs.js} +14 -10
  37. package/dist/{rolldown-runtime-DnnnRqeS.js → rolldown-runtime-C7HZzL1F.js} +1 -1
  38. package/dist/staged/bin.js +23 -19
  39. package/dist/{tsconfig-CJ_StdFc.js → tsconfig-fvpxgUq2.js} +395 -200
  40. package/dist/version.js +2 -5
  41. package/dist/versions.js +5 -5
  42. package/dist/{wrap-ansi-k7Dn4VtV.js → wrap-ansi-DNjkuBEp.js} +1 -1
  43. package/dist/wrap-ansi-DUi52C6W.js +2 -0
  44. package/docs/_data/team.ts +9 -0
  45. package/docs/config/check.md +35 -0
  46. package/docs/config/index.md +2 -0
  47. package/docs/config/run.md +61 -12
  48. package/docs/guide/automatic-data-tracking.md +145 -0
  49. package/docs/guide/cache.md +14 -35
  50. package/docs/guide/check.md +16 -0
  51. package/docs/guide/ci.md +4 -0
  52. package/docs/guide/docker.md +175 -0
  53. package/docs/guide/env.md +12 -0
  54. package/docs/guide/github-actions-cache.md +165 -0
  55. package/docs/guide/install.md +12 -2
  56. package/docs/guide/migrate-rules.md +347 -0
  57. package/docs/guide/migrate.md +14 -0
  58. package/docs/guide/pack.md +8 -0
  59. package/docs/guide/run.md +33 -3
  60. package/docs/guide/troubleshooting.md +1 -1
  61. package/docs/guide/upgrade.md +43 -21
  62. package/docs/package.json +1 -1
  63. package/package.json +21 -20
  64. package/dist/agent-BD31CsvU.js +0 -3341
  65. package/dist/compat-Cql3K40m.js +0 -14
  66. package/dist/dist-DRJUd9bL.js +0 -3
  67. package/dist/workspace-Cjoc1c_A.js +0 -5830
  68. package/dist/wrap-ansi-CeQuiQ31.js +0 -2
@@ -1184,97 +1184,6 @@ export interface PluginsOptions {
1184
1184
  taggedTemplateEscape?: boolean;
1185
1185
  }
1186
1186
 
1187
- /** Dynamic gating for {@link ReactCompilerOptions#dynamicGating}. */
1188
- export interface ReactCompilerDynamicGating {
1189
- /** Module the gating import comes from. */
1190
- source: string;
1191
- }
1192
-
1193
- /** Static gating for {@link ReactCompilerOptions#gating}. */
1194
- export interface ReactCompilerGating {
1195
- /** Module the gating import comes from. */
1196
- source: string;
1197
- /** Imported specifier used as the gate. */
1198
- importSpecifierName: string;
1199
- }
1200
-
1201
- /**
1202
- * Options for the experimental [React Compiler](https://github.com/facebook/react/pull/36173).
1203
- *
1204
- * Mirrors the compiler's `PluginOptions`. The deep `environment` configuration
1205
- * (inference / validation flags) is not surfaced here.
1206
- *
1207
- * @see {@link TransformOptions#reactCompiler}
1208
- */
1209
- export interface ReactCompilerOptions {
1210
- /**
1211
- * Which functions to compile.
1212
- *
1213
- * @default 'infer'
1214
- */
1215
- compilationMode?: 'infer' | 'syntax' | 'annotation' | 'all';
1216
- /**
1217
- * What to do when a function cannot be compiled.
1218
- *
1219
- * @default 'none'
1220
- */
1221
- panicThreshold?: 'none' | 'critical_errors' | 'all_errors';
1222
- /**
1223
- * React runtime version target. `17` and `18` require the
1224
- * `react-compiler-runtime` package; `19` ships the runtime in `react`.
1225
- *
1226
- * @default '19'
1227
- */
1228
- target?: '17' | '18' | '19';
1229
- /**
1230
- * Analyze and report diagnostics only; emit no transformed code.
1231
- *
1232
- * @default false
1233
- */
1234
- noEmit?: boolean;
1235
- /**
1236
- * Compiler output mode.
1237
- *
1238
- * @default undefined
1239
- */
1240
- outputMode?: 'client' | 'ssr' | 'lint';
1241
- /**
1242
- * Compile even functions marked with the `"use no memo"` / `"use no forget"`
1243
- * opt-out directives.
1244
- *
1245
- * @default false
1246
- */
1247
- ignoreUseNoForget?: boolean;
1248
- /**
1249
- * Treat Flow suppression comments as opt-outs.
1250
- *
1251
- * @default true
1252
- */
1253
- flowSuppressions?: boolean;
1254
- /**
1255
- * Enable `react-native-reanimated` support.
1256
- *
1257
- * @default false
1258
- */
1259
- enableReanimated?: boolean;
1260
- /**
1261
- * Development mode (extra validation / instrumentation).
1262
- *
1263
- * @default false
1264
- */
1265
- isDev?: boolean;
1266
- /** Source file name, used for the fast-refresh hash and in diagnostics. */
1267
- filename?: string;
1268
- /** ESLint rules whose suppressions opt a function out of compilation. */
1269
- eslintSuppressionRules?: Array<string>;
1270
- /** Extra directives that opt a function out of compilation. */
1271
- customOptOutDirectives?: Array<string>;
1272
- /** Also emit a gated (feature-flagged) version of each compiled function. */
1273
- gating?: ReactCompilerGating;
1274
- /** Dynamically-gated compilation. */
1275
- dynamicGating?: ReactCompilerDynamicGating;
1276
- }
1277
-
1278
1187
  export interface ReactRefreshOptions {
1279
1188
  /**
1280
1189
  * Specify the identifier of the refresh registration variable.
@@ -1322,7 +1231,10 @@ export interface StyledComponentsOptions {
1322
1231
  * Transpiles styled-components tagged template literals to a smaller representation
1323
1232
  * than what Babel normally creates, helping to reduce bundle size.
1324
1233
  *
1325
- * @default true
1234
+ * Disabled by default because Oxc does not down-level template literals, so this
1235
+ * transform only increases output size.
1236
+ *
1237
+ * @default false
1326
1238
  */
1327
1239
  transpileTemplateLiterals?: boolean;
1328
1240
  /**
@@ -1393,6 +1305,13 @@ export declare function transform(
1393
1305
  /**
1394
1306
  * Options for transforming a JavaScript or TypeScript file.
1395
1307
  *
1308
+ * Options are listed in evaluation order: the source is parsed (`lang`,
1309
+ * `sourceType`), declarations are emitted (`typescript.declaration`), then
1310
+ * transforms run (`typescript`, `decorator`, `plugins`,
1311
+ * `jsx`, `target`), followed by the `inject` and `define` plugins, and
1312
+ * finally codegen (`sourcemap`). `helpers` configures the runtime helpers
1313
+ * the transforms emit.
1314
+ *
1396
1315
  * @see {@link transform}
1397
1316
  */
1398
1317
  export interface TransformOptions {
@@ -1405,23 +1324,23 @@ export interface TransformOptions {
1405
1324
  * options.
1406
1325
  */
1407
1326
  cwd?: string;
1408
- /**
1409
- * Enable source map generation.
1410
- *
1411
- * When `true`, the `sourceMap` field of transform result objects will be populated.
1412
- *
1413
- * @default false
1414
- *
1415
- * @see {@link SourceMap}
1416
- */
1417
- sourcemap?: boolean;
1418
1327
  /** Set assumptions in order to produce smaller output. */
1419
1328
  assumptions?: CompilerAssumptions;
1420
1329
  /**
1421
1330
  * Configure how TypeScript is transformed.
1331
+ *
1332
+ * `typescript.declaration` is evaluated before all transforms.
1333
+ *
1422
1334
  * @see {@link https://oxc.rs/docs/guide/usage/transformer/typescript}
1423
1335
  */
1424
1336
  typescript?: TypeScriptOptions;
1337
+ /** Decorator plugin */
1338
+ decorator?: DecoratorOptions;
1339
+ /**
1340
+ * Third-party plugins to use.
1341
+ * @see {@link https://oxc.rs/docs/guide/usage/transformer/plugins}
1342
+ */
1343
+ plugins?: PluginsOptions;
1425
1344
  /**
1426
1345
  * Configure how TSX and JSX are transformed.
1427
1346
  * @see {@link https://oxc.rs/docs/guide/usage/transformer/jsx}
@@ -1444,31 +1363,32 @@ export interface TransformOptions {
1444
1363
  target?: string | Array<string>;
1445
1364
  /** Behaviour for runtime helpers. */
1446
1365
  helpers?: Helpers;
1447
- /**
1448
- * Define Plugin
1449
- * @see {@link https://oxc.rs/docs/guide/usage/transformer/global-variable-replacement#define}
1450
- */
1451
- define?: Record<string, string>;
1452
1366
  /**
1453
1367
  * Inject Plugin
1368
+ *
1369
+ * Runs after all transforms.
1370
+ *
1454
1371
  * @see {@link https://oxc.rs/docs/guide/usage/transformer/global-variable-replacement#inject}
1455
1372
  */
1456
1373
  inject?: Record<string, string | [string, string]>;
1457
- /** Decorator plugin */
1458
- decorator?: DecoratorOptions;
1459
1374
  /**
1460
- * Enable the experimental [React Compiler](https://github.com/facebook/react/pull/36173).
1375
+ * Define Plugin
1461
1376
  *
1462
- * `true` enables it with default options; an object enables it with the
1463
- * given options; `false` or omitted disables it. When enabled, the compiler
1464
- * runs as the first transform and memoizes React components and hooks.
1377
+ * Runs after the inject plugin.
1378
+ *
1379
+ * @see {@link https://oxc.rs/docs/guide/usage/transformer/global-variable-replacement#define}
1465
1380
  */
1466
- reactCompiler?: boolean | ReactCompilerOptions;
1381
+ define?: Record<string, string>;
1467
1382
  /**
1468
- * Third-party plugins to use.
1469
- * @see {@link https://oxc.rs/docs/guide/usage/transformer/plugins}
1383
+ * Enable source map generation.
1384
+ *
1385
+ * When `true`, the `sourceMap` field of transform result objects will be populated.
1386
+ *
1387
+ * @default false
1388
+ *
1389
+ * @see {@link SourceMap}
1470
1390
  */
1471
- plugins?: PluginsOptions;
1391
+ sourcemap?: boolean;
1472
1392
  }
1473
1393
 
1474
1394
  export interface TransformResult {
@@ -2017,11 +1937,6 @@ export declare class ParallelJsPluginRegistry {
2017
1937
  constructor(workerCount: number);
2018
1938
  }
2019
1939
 
2020
- export declare class ScheduledBuild {
2021
- wait(): Promise<void>;
2022
- alreadyScheduled(): boolean;
2023
- }
2024
-
2025
1940
  export declare class TraceSubscriberGuard {
2026
1941
  close(): void;
2027
1942
  }
@@ -2076,7 +1991,6 @@ export declare const enum BindingBuiltinPluginName {
2076
1991
  ViteReporter = 'builtin:vite-reporter',
2077
1992
  ViteResolve = 'builtin:vite-resolve',
2078
1993
  ViteTransform = 'builtin:vite-transform',
2079
- ViteWasmFallback = 'builtin:vite-wasm-fallback',
2080
1994
  ViteWebWorkerPost = 'builtin:vite-web-worker-post',
2081
1995
  OxcRuntime = 'builtin:oxc-runtime',
2082
1996
  }
@@ -2095,7 +2009,16 @@ export interface BindingBundlerOptions {
2095
2009
  }
2096
2010
 
2097
2011
  export interface BindingBundleState {
2098
- lastFullBuildFailed: boolean;
2012
+ lastBuildErrored: boolean;
2013
+ /**
2014
+ * The stage of the last incremental failure, when `last_build_errored`
2015
+ * is true and the engine is in an incremental-failure state. Absent on
2016
+ * success and for an initial full-build failure (use
2017
+ * `last_build_errored` to detect that). The consumer can force a full
2018
+ * rebuild on the next page load when this is `Hmr`. See
2019
+ * `internal-docs/dev-engine/implementation.md` §12.
2020
+ */
2021
+ lastErrorStage?: BindingErrorStage;
2099
2022
  hasStaleOutput: boolean;
2100
2023
  }
2101
2024
 
@@ -2182,6 +2105,12 @@ export interface BindingDevOptions {
2182
2105
  | undefined
2183
2106
  | ((result: BindingResult<[BindingClientHmrUpdate[], string[]]>) => void | Promise<void>);
2184
2107
  onOutput?: undefined | ((result: BindingResult<BindingOutputs>) => void | Promise<void>);
2108
+ /**
2109
+ * Called with assets emitted while generating an HMR patch or compiling a
2110
+ * lazy entry. These never go through `on_output`, so a consumer (e.g. Vite)
2111
+ * must register this to serve them (e.g. write them to its in-memory files).
2112
+ */
2113
+ onAdditionalAssets?: undefined | ((output: BindingOutputs) => void | Promise<void>);
2185
2114
  rebuildStrategy?: BindingRebuildStrategy;
2186
2115
  watch?: BindingDevWatchOptions;
2187
2116
  }
@@ -2364,6 +2293,20 @@ export interface BindingErrors {
2364
2293
  isBindingErrors: boolean;
2365
2294
  }
2366
2295
 
2296
+ /**
2297
+ * Which stage of an incremental dev build produced the last error.
2298
+ *
2299
+ * Mirrors `rolldown_dev::ErrorStage`. Surfaced on
2300
+ * [`crate::binding_dev_engine::BindingBundleState`] so the consumer can
2301
+ * treat an `Hmr`-stage failure as recoverable by forcing a full rebuild
2302
+ * on the next page load (HMR generation may itself be buggy). See
2303
+ * `internal-docs/dev-engine/implementation.md` §12.
2304
+ */
2305
+ export declare const enum BindingErrorStage {
2306
+ Hmr = 'Hmr',
2307
+ Rebuild = 'Rebuild',
2308
+ }
2309
+
2367
2310
  export interface BindingEsmExternalRequirePluginConfig {
2368
2311
  external: Array<BindingStringOrRegex>;
2369
2312
  skipDuplicateCheck?: boolean;
@@ -2400,10 +2343,6 @@ export interface BindingGeneratedCodeOptions {
2400
2343
  preset?: string;
2401
2344
  }
2402
2345
 
2403
- export type BindingGenerateHmrPatchReturn =
2404
- | { type: 'Ok'; field0: Array<BindingHmrUpdate> }
2405
- | { type: 'Error'; field0: Array<BindingError> };
2406
-
2407
2346
  export interface BindingHmrBoundaryOutput {
2408
2347
  boundary: string;
2409
2348
  acceptedVia: string;
@@ -2510,6 +2449,8 @@ export interface BindingIndentOptions {
2510
2449
  exclude?: Array<Array<number>> | Array<number>;
2511
2450
  }
2512
2451
 
2452
+ export type BindingInjectImport = BindingInjectImportNamed | BindingInjectImportNamespace;
2453
+
2513
2454
  export interface BindingInjectImportNamed {
2514
2455
  tagNamed: true;
2515
2456
  imported: string;
@@ -2549,7 +2490,7 @@ export interface BindingInputOptions {
2549
2490
  moduleTypes?: Record<string, string>;
2550
2491
  define?: Array<[string, string]>;
2551
2492
  dropLabels?: Array<string>;
2552
- inject?: Array<BindingInjectImportNamed | BindingInjectImportNamespace>;
2493
+ inject?: Array<BindingInjectImport>;
2553
2494
  experimental?: BindingExperimentalOptions;
2554
2495
  profilerNames?: boolean;
2555
2496
  transform?: TransformOptions;
@@ -2667,7 +2608,7 @@ export interface BindingModules {
2667
2608
  export interface BindingModuleSideEffectsRule {
2668
2609
  test?: RegExp | undefined;
2669
2610
  sideEffects: boolean;
2670
- external?: boolean | undefined;
2611
+ external?: boolean;
2671
2612
  }
2672
2613
 
2673
2614
  export interface BindingOptimization {
@@ -3006,6 +2947,13 @@ export interface BindingTsconfigCompilerOptions {
3006
2947
  experimentalDecorators?: boolean;
3007
2948
  /** Enables decorator metadata emission. */
3008
2949
  emitDecoratorMetadata?: boolean;
2950
+ /** Enables all strict type-checking options. Used as the fallback for `strictNullChecks`. */
2951
+ strict?: boolean;
2952
+ /**
2953
+ * Enables strict null checks. Controls whether `null`/`undefined` are elided from
2954
+ * nullable-union `design:type` decorator metadata.
2955
+ */
2956
+ strictNullChecks?: boolean;
3009
2957
  /** Preserves module structure of imports/exports. */
3010
2958
  verbatimModuleSyntax?: boolean;
3011
2959
  /** Configures how class fields are emitted. */
@@ -3052,18 +3000,6 @@ export interface BindingViteBuildImportAnalysisPluginConfig {
3052
3000
  optimizeModulePreloadRelativePaths: boolean;
3053
3001
  renderBuiltUrl: boolean;
3054
3002
  isRelativeBase: boolean;
3055
- v2?: BindingViteBuildImportAnalysisPluginV2Config;
3056
- }
3057
-
3058
- export interface BindingViteBuildImportAnalysisPluginV2Config {
3059
- isSsr: boolean;
3060
- urlBase: string;
3061
- decodedBase: string;
3062
- modulePreload: false | BindingModulePreloadOptions;
3063
- renderBuiltUrl?: (
3064
- filename: string,
3065
- type: BindingRenderBuiltUrlConfig,
3066
- ) => undefined | string | BindingRenderBuiltUrlRet;
3067
3003
  }
3068
3004
 
3069
3005
  export interface BindingViteDynamicImportVarsPluginConfig {
@@ -3090,7 +3026,6 @@ export type BindingViteJsonPluginStringify = boolean | string;
3090
3026
  export interface BindingViteManifestPluginConfig {
3091
3027
  root: string;
3092
3028
  outPath: string;
3093
- isEnableV2?: boolean;
3094
3029
  isLegacy?: (args: BindingNormalizedOptions) => boolean;
3095
3030
  cssEntries: () => Record<string, string>;
3096
3031
  }
@@ -3337,6 +3272,8 @@ export interface BatchRewriteError {
3337
3272
  export interface BatchRewriteResult {
3338
3273
  /** Files that were modified */
3339
3274
  modifiedFiles: Array<string>;
3275
+ /** Files in Nuxt test-utils packages where upstream `vitest` imports were preserved */
3276
+ preservedVitestFiles: Array<string>;
3340
3277
  /** Files that had errors */
3341
3278
  errors: Array<BatchRewriteError>;
3342
3279
  }
@@ -3569,6 +3506,8 @@ export declare function rewriteEslint(scriptsJson: string): string | null;
3569
3506
  * # Arguments
3570
3507
  *
3571
3508
  * * `root` - The root directory to search for files
3509
+ * * `preserve_vitest_in_nuxt_packages` - Preserve `vitest` and `vitest/*`
3510
+ * specifiers throughout packages that declare `@nuxt/test-utils`
3572
3511
  *
3573
3512
  * # Returns
3574
3513
  *
@@ -3586,7 +3525,10 @@ export declare function rewriteEslint(scriptsJson: string): string | null;
3586
3525
  * }
3587
3526
  * ```
3588
3527
  */
3589
- export declare function rewriteImportsInDirectory(root: string): BatchRewriteResult;
3528
+ export declare function rewriteImportsInDirectory(
3529
+ root: string,
3530
+ preserveVitestInNuxtPackages?: boolean | undefined | null,
3531
+ ): BatchRewriteResult;
3590
3532
 
3591
3533
  /**
3592
3534
  * Rewrite Prettier scripts: rename `prettier` → `vp fmt` and strip Prettier-only flags.