vite 3.0.9 → 3.1.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -21,6 +21,7 @@ import type { LoadResult } from 'rollup';
21
21
  import type { ModuleFormat } from 'rollup';
22
22
  import type { ModuleInfo } from 'rollup';
23
23
  import type * as net from 'node:net';
24
+ import type { ObjectHook } from 'rollup';
24
25
  import type { OutgoingHttpHeaders } from 'node:http';
25
26
  import type { OutputBundle } from 'rollup';
26
27
  import type { OutputChunk } from 'rollup';
@@ -846,6 +847,8 @@ export declare type HMRPayload =
846
847
  | ErrorPayload
847
848
  | PrunePayload
848
849
 
850
+ export declare type HookHandler<T> = T extends ObjectHook<infer H> ? H : T;
851
+
849
852
  export declare interface HtmlTagDescriptor {
850
853
  tag: string;
851
854
  attrs?: Record<string, string | boolean | undefined>;
@@ -1503,11 +1506,11 @@ declare interface Plugin_2 extends Plugin_3 {
1503
1506
  * Note: User plugins are resolved before running this hook so injecting other
1504
1507
  * plugins inside the `config` hook will have no effect.
1505
1508
  */
1506
- config?: (config: UserConfig, env: ConfigEnv) => UserConfig | null | void | Promise<UserConfig | null | void>;
1509
+ config?: ObjectHook<(config: UserConfig, env: ConfigEnv) => UserConfig | null | void | Promise<UserConfig | null | void>>;
1507
1510
  /**
1508
1511
  * Use this hook to read and store the final resolved vite config.
1509
1512
  */
1510
- configResolved?: (config: ResolvedConfig) => void | Promise<void>;
1513
+ configResolved?: ObjectHook<(config: ResolvedConfig) => void | Promise<void>>;
1511
1514
  /**
1512
1515
  * Configure the vite server. The hook receives the {@link ViteDevServer}
1513
1516
  * instance. This can also be used to store a reference to the server
@@ -1517,7 +1520,7 @@ declare interface Plugin_2 extends Plugin_3 {
1517
1520
  * can return a post hook that will be called after internal middlewares
1518
1521
  * are applied. Hook can be async functions and will be called in series.
1519
1522
  */
1520
- configureServer?: ServerHook;
1523
+ configureServer?: ObjectHook<ServerHook>;
1521
1524
  /**
1522
1525
  * Configure the preview server. The hook receives the connect server and
1523
1526
  * its underlying http server.
@@ -1526,7 +1529,7 @@ declare interface Plugin_2 extends Plugin_3 {
1526
1529
  * return a post hook that will be called after other middlewares are
1527
1530
  * applied. Hooks can be async functions and will be called in series.
1528
1531
  */
1529
- configurePreviewServer?: PreviewServerHook;
1532
+ configurePreviewServer?: ObjectHook<PreviewServerHook>;
1530
1533
  /**
1531
1534
  * Transform index.html.
1532
1535
  * The hook receives the following arguments:
@@ -1558,22 +1561,22 @@ declare interface Plugin_2 extends Plugin_3 {
1558
1561
  * - If the hook doesn't return a value, the hmr update will be performed as
1559
1562
  * normal.
1560
1563
  */
1561
- handleHotUpdate?(ctx: HmrContext): Array<ModuleNode> | void | Promise<Array<ModuleNode> | void>;
1564
+ handleHotUpdate?: ObjectHook<(ctx: HmrContext) => Array<ModuleNode> | void | Promise<Array<ModuleNode> | void>>;
1562
1565
  /**
1563
1566
  * extend hooks with ssr flag
1564
1567
  */
1565
- resolveId?: (this: PluginContext, source: string, importer: string | undefined, options: {
1568
+ resolveId?: ObjectHook<(this: PluginContext, source: string, importer: string | undefined, options: {
1566
1569
  custom?: CustomPluginOptions;
1567
1570
  ssr?: boolean;
1568
1571
  /* Excluded from this release type: scan */
1569
1572
  isEntry: boolean;
1570
- }) => Promise<ResolveIdResult> | ResolveIdResult;
1571
- load?: (this: PluginContext, id: string, options?: {
1573
+ }) => Promise<ResolveIdResult> | ResolveIdResult>;
1574
+ load?: ObjectHook<(this: PluginContext, id: string, options?: {
1572
1575
  ssr?: boolean;
1573
- }) => Promise<LoadResult> | LoadResult;
1574
- transform?: (this: TransformPluginContext, code: string, id: string, options?: {
1576
+ }) => Promise<LoadResult> | LoadResult>;
1577
+ transform?: ObjectHook<(this: TransformPluginContext, code: string, id: string, options?: {
1575
1578
  ssr?: boolean;
1576
- }) => Promise<TransformResult_2> | TransformResult_2;
1579
+ }) => Promise<TransformResult_2> | TransformResult_2>;
1577
1580
  }
1578
1581
  export { Plugin_2 as Plugin }
1579
1582
 
@@ -1598,6 +1601,11 @@ export declare interface PluginContainer {
1598
1601
  close(): Promise<void>;
1599
1602
  }
1600
1603
 
1604
+ export declare interface PluginHookUtils {
1605
+ getSortedPlugins: (hookName: keyof Plugin_2) => Plugin_2[];
1606
+ getSortedPluginHooks: <K extends keyof Plugin_2>(hookName: K) => NonNullable<HookHandler<Plugin_2[K]>>[];
1607
+ }
1608
+
1601
1609
  export declare type PluginOption = Plugin_2 | false | null | undefined | PluginOption[] | Promise<Plugin_2 | false | null | undefined | PluginOption[]>;
1602
1610
 
1603
1611
  /**
@@ -1704,7 +1712,7 @@ export declare type ResolvedConfig = Readonly<Omit<UserConfig, 'plugins' | 'asse
1704
1712
  worker: ResolveWorkerOptions;
1705
1713
  appType: AppType;
1706
1714
  experimental: ExperimentalOptions;
1707
- }>;
1715
+ } & PluginHookUtils>;
1708
1716
 
1709
1717
  export declare interface ResolvedPreviewOptions extends PreviewOptions {
1710
1718
  }
@@ -1754,7 +1762,7 @@ export declare interface ResolverObject {
1754
1762
  resolveId: ResolverFunction
1755
1763
  }
1756
1764
 
1757
- export declare interface ResolveWorkerOptions {
1765
+ export declare interface ResolveWorkerOptions extends PluginHookUtils {
1758
1766
  format: 'es' | 'iife';
1759
1767
  plugins: Plugin_2[];
1760
1768
  rollupOptions: RollupOptions;
@@ -2576,7 +2584,7 @@ export declare interface ViteDevServer {
2576
2584
  /**
2577
2585
  * Transform module code into SSR format.
2578
2586
  */
2579
- ssrTransform(code: string, inMap: SourceMap | null, url: string): Promise<TransformResult | null>;
2587
+ ssrTransform(code: string, inMap: SourceMap | null, url: string, originalCode?: string): Promise<TransformResult | null>;
2580
2588
  /**
2581
2589
  * Load a given URL as an instantiated module for SSR.
2582
2590
  */
@@ -1,4 +1,4 @@
1
- export { b as build, k as createFilter, u as createLogger, c as createServer, d as defineConfig, f as formatPostcssSourceMap, h as getDepOptimizationConfig, i as isDepsOptimizerEnabled, l as loadConfigFromFile, w as loadEnv, j as mergeAlias, m as mergeConfig, n as normalizePath, o as optimizeDeps, p as preview, g as resolveBaseUrl, e as resolveConfig, x as resolveEnvPrefix, a as resolvePackageData, r as resolvePackageEntry, v as searchForWorkspaceRoot, q as send, s as sortUserPlugins, t as transformWithEsbuild } from './chunks/dep-0fc8e132.js';
1
+ export { b as build, k as createFilter, u as createLogger, c as createServer, d as defineConfig, f as formatPostcssSourceMap, h as getDepOptimizationConfig, i as isDepsOptimizerEnabled, l as loadConfigFromFile, w as loadEnv, j as mergeAlias, m as mergeConfig, n as normalizePath, o as optimizeDeps, p as preview, g as resolveBaseUrl, e as resolveConfig, x as resolveEnvPrefix, a as resolvePackageData, r as resolvePackageEntry, v as searchForWorkspaceRoot, q as send, s as sortUserPlugins, t as transformWithEsbuild } from './chunks/dep-34b4c4eb.js';
2
2
  export { VERSION as version } from './constants.js';
3
3
  export { version as esbuildVersion } from 'esbuild';
4
4
  export { VERSION as rollupVersion } from 'rollup';
@@ -26,13 +26,14 @@ import 'node:dns';
26
26
  import 'resolve';
27
27
  import 'crypto';
28
28
  import 'buffer';
29
+ import 'node:buffer';
29
30
  import 'module';
31
+ import 'worker_threads';
30
32
  import 'zlib';
31
33
  import 'https';
32
34
  import 'tls';
33
35
  import 'node:http';
34
36
  import 'node:https';
35
- import 'worker_threads';
36
37
  import 'querystring';
37
38
  import 'node:readline';
38
39
  import 'node:child_process';
@@ -31,7 +31,7 @@ var require$$1__default$1 = /*#__PURE__*/_interopDefaultLegacy(require$$1$1);
31
31
  var readline__default = /*#__PURE__*/_interopDefaultLegacy(readline);
32
32
  var require$$2__default = /*#__PURE__*/_interopDefaultLegacy(require$$2);
33
33
 
34
- var version = "3.0.9";
34
+ var version = "3.1.0-beta.0";
35
35
 
36
36
  const VERSION = version;
37
37
  const VITE_PACKAGE_DIR = path$3.resolve(
@@ -3434,7 +3434,12 @@ function lookupFile(dir, formats, options) {
3434
3434
  for (const format of formats) {
3435
3435
  const fullPath = path__default.join(dir, format);
3436
3436
  if (fs__default.existsSync(fullPath) && fs__default.statSync(fullPath).isFile()) {
3437
- return options?.pathOnly ? fullPath : fs__default.readFileSync(fullPath, 'utf-8');
3437
+ const result = options?.pathOnly
3438
+ ? fullPath
3439
+ : fs__default.readFileSync(fullPath, 'utf-8');
3440
+ if (!options?.predicate || options.predicate(result)) {
3441
+ return result;
3442
+ }
3438
3443
  }
3439
3444
  }
3440
3445
  const parentDir = path__default.dirname(dir);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite",
3
- "version": "3.0.9",
3
+ "version": "3.1.0-beta.0",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "author": "Evan You",
@@ -61,7 +61,7 @@
61
61
  "esbuild": "^0.14.47",
62
62
  "postcss": "^8.4.16",
63
63
  "resolve": "^1.22.1",
64
- "rollup": ">=2.75.6 <2.77.0 || ~2.77.0"
64
+ "rollup": "~2.78.0"
65
65
  },
66
66
  "optionalDependencies": {
67
67
  "fsevents": "~2.3.2"
@@ -78,7 +78,6 @@
78
78
  "@rollup/plugin-node-resolve": "13.3.0",
79
79
  "@rollup/plugin-typescript": "^8.3.4",
80
80
  "@rollup/pluginutils": "^4.2.1",
81
- "@vue/compiler-dom": "^3.2.37",
82
81
  "acorn": "^8.8.0",
83
82
  "cac": "^6.7.12",
84
83
  "chokidar": "^3.5.3",
@@ -96,18 +95,19 @@
96
95
  "fast-glob": "^3.2.11",
97
96
  "http-proxy": "^1.18.1",
98
97
  "json5": "^2.2.1",
99
- "launch-editor-middleware": "^2.5.0",
98
+ "launch-editor-middleware": "^2.6.0",
100
99
  "magic-string": "^0.26.2",
101
100
  "micromatch": "^4.0.5",
102
- "mlly": "^0.5.12",
101
+ "mlly": "^0.5.14",
103
102
  "mrmime": "^1.0.1",
104
103
  "okie": "^1.0.1",
105
104
  "open": "^8.4.0",
105
+ "parse5": "^7.0.0",
106
106
  "periscopic": "^3.0.4",
107
107
  "picocolors": "^1.0.0",
108
108
  "postcss-import": "^14.1.0",
109
109
  "postcss-load-config": "^4.0.1",
110
- "postcss-modules": "^4.3.1",
110
+ "postcss-modules": "^5.0.0",
111
111
  "resolve.exports": "^1.1.0",
112
112
  "rollup-plugin-license": "^2.8.1",
113
113
  "sirv": "^2.0.2",