vite-plus 0.1.24 → 0.2.1

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 (174) hide show
  1. package/LICENSE +30 -0
  2. package/README.md +8 -6
  3. package/bin/oxfmt +5 -2
  4. package/bin/oxlint +12 -2
  5. package/binding/index.cjs +84 -67
  6. package/binding/index.d.cts +155 -4
  7. package/dist/{agent-Nuk-9l77.js → agent--cKmgD_n.js} +941 -70
  8. package/dist/bin.js +22 -30
  9. package/dist/{compat-DXZgnEyq.js → compat-Cql3K40m.js} +1 -1
  10. package/dist/config/bin.js +30 -14
  11. package/dist/constants-CrfJQIUX.js +66 -0
  12. package/dist/create/bin.d.ts +6 -0
  13. package/dist/create/bin.js +508 -232
  14. package/dist/define-config-2tfJoXr1.d.ts +305 -0
  15. package/dist/define-config-BGSjF6Xp.cjs +488 -0
  16. package/dist/define-config-DJUehepE.js +445 -0
  17. package/dist/define-config.cjs +8 -1
  18. package/dist/define-config.d.ts +2 -2
  19. package/dist/define-config.js +2 -2
  20. package/dist/dist-DRJUd9bL.js +3 -0
  21. package/dist/{dist-BgQuvbtq.js → dist-Oxo16Y0q.js} +4 -4
  22. package/dist/index.cjs +9 -4
  23. package/dist/index.d.ts +3 -3
  24. package/dist/index.js +3 -3
  25. package/dist/{main-DpJl3LoU.js → json-Dn87fvjk.js} +137 -1
  26. package/dist/migration/bin.js +292 -76
  27. package/dist/{oxlint-plugin-config-B89iKTKN.js → oxlint-plugin-config-q8a5PFch.js} +1 -1
  28. package/dist/oxlint-plugin.js +11 -3
  29. package/dist/pack-bin.js +44 -15
  30. package/dist/{package-PmBUZ-ve.js → package-BHirM1_v.js} +3 -138
  31. package/dist/{report-DgSBQUdz.js → report-BHSkWqRR.js} +2 -0
  32. package/dist/{resolve-vite-config-TTvhycU1.js → resolve-vite-config-CmdsfQzS.js} +13 -4
  33. package/dist/staged/bin.js +5 -5
  34. package/dist/test/_at-vitest-browser/context.d.ts +2 -0
  35. package/dist/test/_at-vitest-browser.d.ts +2 -0
  36. package/dist/test/browser/context.d.ts +2 -2
  37. package/dist/test/browser/context.js +1 -1
  38. package/dist/test/browser/providers/playwright/context.d.ts +1 -0
  39. package/dist/test/browser/providers/playwright/context.js +1 -0
  40. package/dist/test/browser/providers/playwright.d.ts +124 -2
  41. package/dist/test/browser/providers/playwright.js +1 -1
  42. package/dist/test/browser/providers/preview/context.d.ts +1 -0
  43. package/dist/test/browser/providers/preview/context.js +1 -0
  44. package/dist/test/browser/providers/preview.d.ts +32 -2
  45. package/dist/test/browser/providers/preview.js +1 -1
  46. package/dist/test/browser/providers/webdriverio/context.d.ts +1 -0
  47. package/dist/test/browser/providers/webdriverio/context.js +1 -0
  48. package/dist/test/browser/providers/webdriverio.d.ts +77 -2
  49. package/dist/test/browser/providers/webdriverio.js +1 -1
  50. package/dist/test/browser-compat.d.ts +2 -0
  51. package/dist/test/browser-compat.js +1 -1
  52. package/dist/test/browser-playwright/context.d.ts +1 -0
  53. package/dist/test/browser-playwright/context.js +1 -0
  54. package/dist/test/browser-playwright.d.ts +124 -2
  55. package/dist/test/browser-playwright.js +1 -1
  56. package/dist/test/browser-preview/context.d.ts +1 -0
  57. package/dist/test/browser-preview/context.js +1 -0
  58. package/dist/test/browser-preview.d.ts +32 -2
  59. package/dist/test/browser-preview.js +1 -1
  60. package/dist/test/browser-webdriverio/context.d.ts +1 -0
  61. package/dist/test/browser-webdriverio/context.js +1 -0
  62. package/dist/test/browser-webdriverio.d.ts +77 -2
  63. package/dist/test/browser-webdriverio.js +1 -1
  64. package/dist/test/browser.d.ts +2 -2
  65. package/dist/test/browser.js +1 -1
  66. package/dist/test/client.js +1 -1
  67. package/dist/test/config.cjs +1 -1
  68. package/dist/test/config.d.ts +2 -2
  69. package/dist/test/config.js +1 -1
  70. package/dist/test/context.d.ts +942 -2
  71. package/dist/test/context.js +1 -1
  72. package/dist/test/coverage.d.ts +2 -2
  73. package/dist/test/coverage.js +1 -1
  74. package/dist/test/environments.d.ts +2 -2
  75. package/dist/test/environments.js +1 -1
  76. package/dist/test/globals.d.ts +2 -2
  77. package/dist/test/import-meta.d.ts +2 -2
  78. package/dist/test/importMeta.d.ts +2 -2
  79. package/dist/test/index.cjs +1 -1
  80. package/dist/test/index.d.cts +2 -2
  81. package/dist/test/index.d.ts +2 -2
  82. package/dist/test/index.js +1 -1
  83. package/dist/test/internal/browser.d.ts +2 -2
  84. package/dist/test/internal/browser.js +1 -1
  85. package/dist/test/jsdom.d.ts +2 -2
  86. package/dist/test/locators.d.ts +294 -0
  87. package/dist/test/locators.js +1 -1
  88. package/dist/test/matchers.d.ts +29 -0
  89. package/dist/test/matchers.js +1 -1
  90. package/dist/test/node.d.ts +2 -2
  91. package/dist/test/node.js +1 -1
  92. package/dist/test/optional-runtime-types.js.d.ts +2 -2
  93. package/dist/test/optional-types.js.d.ts +2 -2
  94. package/dist/test/plugins/browser-client.js +1 -1
  95. package/dist/test/plugins/browser-context.js +1 -1
  96. package/dist/test/plugins/browser-locators.js +1 -1
  97. package/dist/test/plugins/browser-playwright.js +1 -1
  98. package/dist/test/plugins/browser-preview.js +1 -1
  99. package/dist/test/plugins/browser-webdriverio.js +1 -1
  100. package/dist/test/plugins/browser.js +1 -1
  101. package/dist/test/plugins/expect.js +1 -1
  102. package/dist/test/plugins/mocker-automock.js +1 -1
  103. package/dist/test/plugins/mocker-browser.js +1 -1
  104. package/dist/test/plugins/mocker-node.js +1 -1
  105. package/dist/test/plugins/mocker-redirect.js +1 -1
  106. package/dist/test/plugins/mocker-register.js +1 -1
  107. package/dist/test/plugins/mocker-transforms.js +1 -1
  108. package/dist/test/plugins/mocker.js +1 -1
  109. package/dist/test/plugins/pretty-format.js +1 -1
  110. package/dist/test/plugins/runner-types.js +1 -1
  111. package/dist/test/plugins/runner-utils.js +1 -1
  112. package/dist/test/plugins/runner.js +1 -1
  113. package/dist/test/plugins/snapshot-environment.js +1 -1
  114. package/dist/test/plugins/snapshot-manager.js +1 -1
  115. package/dist/test/plugins/snapshot.js +1 -1
  116. package/dist/test/plugins/spy.js +1 -1
  117. package/dist/test/plugins/utils-constants.js +1 -1
  118. package/dist/test/plugins/utils-diff.js +1 -1
  119. package/dist/test/plugins/utils-display.js +1 -1
  120. package/dist/test/plugins/utils-error.js +1 -1
  121. package/dist/test/plugins/utils-helpers.js +1 -1
  122. package/dist/test/plugins/utils-offset.js +1 -1
  123. package/dist/test/plugins/utils-resolver.js +1 -1
  124. package/dist/test/plugins/utils-serialize.js +1 -1
  125. package/dist/test/plugins/utils-source-map-node.js +1 -1
  126. package/dist/test/plugins/utils-source-map.js +1 -1
  127. package/dist/test/plugins/utils-timers.js +1 -1
  128. package/dist/test/plugins/utils.js +1 -1
  129. package/dist/test/reporters.d.ts +2 -2
  130. package/dist/test/reporters.js +1 -1
  131. package/dist/test/runners.d.ts +2 -2
  132. package/dist/test/runners.js +1 -1
  133. package/dist/test/runtime.d.ts +2 -2
  134. package/dist/test/runtime.js +1 -1
  135. package/dist/test/snapshot.d.ts +2 -2
  136. package/dist/test/snapshot.js +1 -1
  137. package/dist/test/suite.d.ts +2 -2
  138. package/dist/test/suite.js +1 -1
  139. package/dist/test/utils.js +1 -1
  140. package/dist/test/worker.d.ts +2 -2
  141. package/dist/test/worker.js +1 -1
  142. package/dist/{tsconfig-DFb5BKyT.js → tsconfig-BWQPmGKz.js} +565 -231
  143. package/dist/tsgolint-path-B-yOos8p.js +32 -0
  144. package/dist/tsgolint-path.d.ts +8 -0
  145. package/dist/tsgolint-path.js +2 -0
  146. package/dist/version.js +3 -3
  147. package/dist/versions.d.ts +1 -1
  148. package/dist/versions.js +6 -6
  149. package/dist/{workspace-NL-m9wgM.js → workspace-D0AVy4fu.js} +11 -9
  150. package/docs/_data/team.ts +2 -1
  151. package/docs/config/create.md +36 -1
  152. package/docs/config/index.md +7 -5
  153. package/docs/guide/commit-hooks.md +9 -0
  154. package/docs/guide/create.md +106 -2
  155. package/docs/guide/env.md +33 -5
  156. package/docs/guide/index.md +5 -3
  157. package/docs/guide/install.md +31 -12
  158. package/docs/guide/migrate.md +13 -3
  159. package/docs/guide/troubleshooting.md +2 -2
  160. package/docs/guide/upgrade.md +26 -7
  161. package/docs/package.json +3 -3
  162. package/docs/pnpm-lock.yaml +298 -395
  163. package/package.json +103 -55
  164. package/templates/generator/bin/index.ts +6 -3
  165. package/templates/generator/package.json +2 -3
  166. package/templates/generator/src/template.ts +0 -2
  167. package/templates/monorepo/package.json +1 -1
  168. package/dist/constants-DCBWlNrn.js +0 -33
  169. package/dist/define-config-BR1Y88zz.cjs +0 -84
  170. package/dist/define-config-BRC7qPNE.js +0 -21
  171. package/dist/define-config-COdn-tsn.d.ts +0 -177
  172. package/dist/dist-Bapm49IR.js +0 -3
  173. package/dist/test/plugins/utils-highlight.js +0 -1
  174. /package/dist/{chunk-DnnnRqeS.js → rolldown-runtime-DnnnRqeS.js} +0 -0
@@ -41,7 +41,7 @@ export interface CompressOptions {
41
41
  *
42
42
  * @default 'esnext'
43
43
  *
44
- * @see [esbuild#target](https://esbuild.github.io/api/#target)
44
+ * @see [oxc#target](https://oxc.rs/docs/guide/usage/transformer/lowering#target)
45
45
  */
46
46
  target?: string | Array<string>;
47
47
  /**
@@ -1184,6 +1184,97 @@ 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
+
1187
1278
  export interface ReactRefreshOptions {
1188
1279
  /**
1189
1280
  * Specify the identifier of the refresh registration variable.
@@ -1365,6 +1456,14 @@ export interface TransformOptions {
1365
1456
  inject?: Record<string, string | [string, string]>;
1366
1457
  /** Decorator plugin */
1367
1458
  decorator?: DecoratorOptions;
1459
+ /**
1460
+ * Enable the experimental [React Compiler](https://github.com/facebook/react/pull/36173).
1461
+ *
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.
1465
+ */
1466
+ reactCompiler?: boolean | ReactCompilerOptions;
1368
1467
  /**
1369
1468
  * Third-party plugins to use.
1370
1469
  * @see {@link https://oxc.rs/docs/guide/usage/transformer/plugins}
@@ -1599,12 +1698,12 @@ export declare class BindingDevEngine {
1599
1698
  run(): Promise<void>;
1600
1699
  ensureCurrentBuildFinish(): Promise<void>;
1601
1700
  getBundleState(): Promise<BindingBundleState>;
1602
- ensureLatestBuildOutput(): Promise<void>;
1701
+ ensureLatestBuildOutput(): Promise<BindingResult<undefined>>;
1603
1702
  triggerFullBuild(): void;
1604
1703
  invalidate(
1605
1704
  caller: string,
1606
1705
  firstInvalidatedBy?: string | undefined | null,
1607
- ): Promise<Array<BindingClientHmrUpdate>>;
1706
+ ): Promise<BindingResult<Array<BindingClientHmrUpdate>>>;
1608
1707
  registerModules(clientId: string, modules: Array<string>): Promise<void>;
1609
1708
  removeClient(clientId: string): Promise<void>;
1610
1709
  close(): Promise<void>;
@@ -2023,6 +2122,7 @@ export interface BindingChecksOptions {
2023
2122
  unsupportedTsconfigOption?: boolean;
2024
2123
  ineffectiveDynamicImport?: boolean;
2025
2124
  largeBarrelModules?: boolean;
2125
+ sourcemapBroken?: boolean;
2026
2126
  }
2027
2127
 
2028
2128
  export interface BindingChunkImportMap {
@@ -2352,7 +2452,11 @@ export interface BindingHookLoadOutput {
2352
2452
 
2353
2453
  export interface BindingHookRenderChunkOutput {
2354
2454
  code: string;
2355
- map?: BindingSourcemap;
2455
+ /**
2456
+ * A sourcemap, or `null` to explicitly signal "no sourcemap" (distinct from
2457
+ * omitting the field, which mirrors Rollup's "possibly broken" semantics).
2458
+ */
2459
+ map?: BindingSourcemap | null;
2356
2460
  }
2357
2461
 
2358
2462
  export interface BindingHookResolveIdExtraArgs {
@@ -2543,6 +2647,7 @@ export interface BindingMatchGroup {
2543
2647
  entriesAware?: boolean;
2544
2648
  entriesAwareMergeThreshold?: number;
2545
2649
  tags?: Array<string>;
2650
+ includeDependenciesRecursively?: boolean;
2546
2651
  }
2547
2652
 
2548
2653
  export interface BindingModulePreloadOptions {
@@ -3607,5 +3712,51 @@ export interface RunCommandResult {
3607
3712
  */
3608
3713
  export declare function shouldPrintVitePlusHeader(): boolean;
3609
3714
 
3715
+ /**
3716
+ * Set the value of a top-level config key in a vite config file (upsert)
3717
+ *
3718
+ * Unlike `mergeJsonConfig`, which prepends a new key (and duplicates it when
3719
+ * the key already exists), this targets only direct config objects
3720
+ * (`defineConfig({...})`, `export default {...}`, direct callback returns):
3721
+ * it replaces the value of an existing `config_key` (pair or shorthand
3722
+ * property) or inserts the key when absent. Unrecognized shapes (e.g.
3723
+ * `module.exports`, `return someVar`) report `updated: false` instead of
3724
+ * being corrupted. The splice is raw, the JS caller is expected to reformat
3725
+ * afterwards.
3726
+ *
3727
+ * # Arguments
3728
+ *
3729
+ * * `vite_config_path` - Path to the vite.config.ts or vite.config.js file
3730
+ * * `json_config_path` - Path to the JSON config file whose contents become the new value
3731
+ * * `config_key` - The top-level key whose value should be set
3732
+ *
3733
+ * # Returns
3734
+ *
3735
+ * Returns a `MergeJsonConfigResult`. `updated` is `true` only when at least
3736
+ * one direct config object was updated; otherwise the original content is
3737
+ * returned unchanged.
3738
+ *
3739
+ * # Example
3740
+ *
3741
+ * ```javascript
3742
+ * const result = upsertJsonConfig('vite.config.ts', 'create.json', 'create');
3743
+ * if (result.updated) {
3744
+ * fs.writeFileSync('vite.config.ts', result.content);
3745
+ * }
3746
+ * ```
3747
+ */
3748
+ export declare function upsertJsonConfig(
3749
+ viteConfigPath: string,
3750
+ jsonConfigPath: string,
3751
+ configKey: string,
3752
+ ): MergeJsonConfigResult;
3753
+
3610
3754
  /** Render the Vite+ header using the Rust implementation. */
3611
3755
  export declare function vitePlusHeader(): string;
3756
+
3757
+ /**
3758
+ * Wrap safe inline `plugins: [...]` arrays in recognized Vite config objects
3759
+ * with `lazyPlugins(() => [...])` and add a `lazyPlugins` import from
3760
+ * `vite-plus` when needed.
3761
+ */
3762
+ export declare function wrapLazyPlugins(viteConfigPath: string): MergeJsonConfigResult;