vite 3.0.9 → 3.1.0-beta.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.
- package/LICENSE.md +46 -116
- package/dist/client/client.mjs +8 -25
- package/dist/client/client.mjs.map +1 -1
- package/dist/node/chunks/dep-4069c338.js +8079 -0
- package/dist/node/chunks/{dep-94c1417a.js → dep-42c2c4e4.js} +67 -13
- package/dist/node/chunks/{dep-25be4b3b.js → dep-6d69fd4f.js} +142 -154
- package/dist/node/chunks/{dep-0fc8e132.js → dep-d66eb979.js} +24026 -23684
- package/dist/node/cli.js +7 -6
- package/dist/node/constants.js +1 -1
- package/dist/node/index.d.ts +31 -23
- package/dist/node/index.js +3 -2
- package/dist/node-cjs/publicUtils.cjs +7 -2
- package/package.json +12 -13
- package/src/client/client.ts +30 -40
- package/types/chokidar.d.ts +1 -1
- package/types/hmrPayload.d.ts +4 -0
- package/types/shims.d.ts +1 -0
- package/dist/node/chunks/dep-9d3f225a.js +0 -8816
package/dist/node/cli.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { performance } from 'node:perf_hooks';
|
|
2
2
|
import { EventEmitter } from 'events';
|
|
3
|
-
import { y as picocolors, u as createLogger, e as resolveConfig } from './chunks/dep-
|
|
3
|
+
import { y as picocolors, u as createLogger, e as resolveConfig } from './chunks/dep-d66eb979.js';
|
|
4
4
|
import { VERSION } from './constants.js';
|
|
5
5
|
import 'node:fs';
|
|
6
6
|
import 'node:path';
|
|
@@ -25,13 +25,14 @@ import 'node:dns';
|
|
|
25
25
|
import 'resolve';
|
|
26
26
|
import 'crypto';
|
|
27
27
|
import 'buffer';
|
|
28
|
+
import 'node:buffer';
|
|
28
29
|
import 'module';
|
|
30
|
+
import 'worker_threads';
|
|
29
31
|
import 'zlib';
|
|
30
32
|
import 'https';
|
|
31
33
|
import 'tls';
|
|
32
34
|
import 'node:http';
|
|
33
35
|
import 'node:https';
|
|
34
|
-
import 'worker_threads';
|
|
35
36
|
import 'querystring';
|
|
36
37
|
import 'node:readline';
|
|
37
38
|
import 'node:child_process';
|
|
@@ -694,7 +695,7 @@ cli
|
|
|
694
695
|
.action(async (root, options) => {
|
|
695
696
|
// output structure is preserved even after bundling so require()
|
|
696
697
|
// is ok here
|
|
697
|
-
const { createServer } = await import('./chunks/dep-
|
|
698
|
+
const { createServer } = await import('./chunks/dep-d66eb979.js').then(function (n) { return n.C; });
|
|
698
699
|
try {
|
|
699
700
|
const server = await createServer({
|
|
700
701
|
root,
|
|
@@ -741,7 +742,7 @@ cli
|
|
|
741
742
|
.option('--emptyOutDir', `[boolean] force empty outDir when it's outside of root`)
|
|
742
743
|
.option('-w, --watch', `[boolean] rebuilds when modules have changed on disk`)
|
|
743
744
|
.action(async (root, options) => {
|
|
744
|
-
const { build } = await import('./chunks/dep-
|
|
745
|
+
const { build } = await import('./chunks/dep-d66eb979.js').then(function (n) { return n.B; });
|
|
745
746
|
const buildOptions = cleanOptions(options);
|
|
746
747
|
try {
|
|
747
748
|
await build({
|
|
@@ -765,7 +766,7 @@ cli
|
|
|
765
766
|
.command('optimize [root]', 'pre-bundle dependencies')
|
|
766
767
|
.option('--force', `[boolean] force the optimizer to ignore the cache and re-bundle`)
|
|
767
768
|
.action(async (root, options) => {
|
|
768
|
-
const { optimizeDeps } = await import('./chunks/dep-
|
|
769
|
+
const { optimizeDeps } = await import('./chunks/dep-d66eb979.js').then(function (n) { return n.A; });
|
|
769
770
|
try {
|
|
770
771
|
const config = await resolveConfig({
|
|
771
772
|
root,
|
|
@@ -788,7 +789,7 @@ cli
|
|
|
788
789
|
.option('--https', `[boolean] use TLS + HTTP/2`)
|
|
789
790
|
.option('--open [path]', `[boolean | string] open browser on startup`)
|
|
790
791
|
.action(async (root, options) => {
|
|
791
|
-
const { preview } = await import('./chunks/dep-
|
|
792
|
+
const { preview } = await import('./chunks/dep-d66eb979.js').then(function (n) { return n.D; });
|
|
792
793
|
try {
|
|
793
794
|
const server = await preview({
|
|
794
795
|
root,
|
package/dist/node/constants.js
CHANGED
package/dist/node/index.d.ts
CHANGED
|
@@ -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>;
|
|
@@ -1196,7 +1199,7 @@ export declare interface IndexHtmlTransformContext {
|
|
|
1196
1199
|
originalUrl?: string;
|
|
1197
1200
|
}
|
|
1198
1201
|
|
|
1199
|
-
export declare type IndexHtmlTransformHook = (html: string, ctx: IndexHtmlTransformContext) => IndexHtmlTransformResult | void | Promise<IndexHtmlTransformResult | void>;
|
|
1202
|
+
export declare type IndexHtmlTransformHook = (this: void, html: string, ctx: IndexHtmlTransformContext) => IndexHtmlTransformResult | void | Promise<IndexHtmlTransformResult | void>;
|
|
1200
1203
|
|
|
1201
1204
|
export declare type IndexHtmlTransformResult = string | HtmlTagDescriptor[] | {
|
|
1202
1205
|
html: string;
|
|
@@ -1494,7 +1497,7 @@ declare interface Plugin_2 extends Plugin_3 {
|
|
|
1494
1497
|
/**
|
|
1495
1498
|
* Apply the plugin only for serve or build, or on certain conditions.
|
|
1496
1499
|
*/
|
|
1497
|
-
apply?: 'serve' | 'build' | ((config: UserConfig, env: ConfigEnv) => boolean);
|
|
1500
|
+
apply?: 'serve' | 'build' | ((this: void, config: UserConfig, env: ConfigEnv) => boolean);
|
|
1498
1501
|
/**
|
|
1499
1502
|
* Modify vite config before it's resolved. The hook can either mutate the
|
|
1500
1503
|
* passed-in config directly, or return a partial config object that will be
|
|
@@ -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<(this: void, 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<(this: void, 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
|
|
1564
|
+
handleHotUpdate?: ObjectHook<(this: void, 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
|
/**
|
|
@@ -1619,8 +1627,6 @@ export declare interface PreviewServer {
|
|
|
1619
1627
|
httpServer: http.Server;
|
|
1620
1628
|
/**
|
|
1621
1629
|
* The resolved urls Vite prints on the CLI
|
|
1622
|
-
*
|
|
1623
|
-
* @experimental
|
|
1624
1630
|
*/
|
|
1625
1631
|
resolvedUrls: ResolvedServerUrls;
|
|
1626
1632
|
/**
|
|
@@ -1629,7 +1635,7 @@ export declare interface PreviewServer {
|
|
|
1629
1635
|
printUrls(): void;
|
|
1630
1636
|
}
|
|
1631
1637
|
|
|
1632
|
-
export declare type PreviewServerHook = (server: {
|
|
1638
|
+
export declare type PreviewServerHook = (this: void, server: {
|
|
1633
1639
|
middlewares: Connect.Server;
|
|
1634
1640
|
httpServer: http.Server;
|
|
1635
1641
|
}) => (() => void) | void | Promise<(() => void) | void>;
|
|
@@ -1704,7 +1710,7 @@ export declare type ResolvedConfig = Readonly<Omit<UserConfig, 'plugins' | 'asse
|
|
|
1704
1710
|
worker: ResolveWorkerOptions;
|
|
1705
1711
|
appType: AppType;
|
|
1706
1712
|
experimental: ExperimentalOptions;
|
|
1707
|
-
}>;
|
|
1713
|
+
} & PluginHookUtils>;
|
|
1708
1714
|
|
|
1709
1715
|
export declare interface ResolvedPreviewOptions extends PreviewOptions {
|
|
1710
1716
|
}
|
|
@@ -1754,7 +1760,7 @@ export declare interface ResolverObject {
|
|
|
1754
1760
|
resolveId: ResolverFunction
|
|
1755
1761
|
}
|
|
1756
1762
|
|
|
1757
|
-
export declare interface ResolveWorkerOptions {
|
|
1763
|
+
export declare interface ResolveWorkerOptions extends PluginHookUtils {
|
|
1758
1764
|
format: 'es' | 'iife';
|
|
1759
1765
|
plugins: Plugin_2[];
|
|
1760
1766
|
rollupOptions: RollupOptions;
|
|
@@ -2025,7 +2031,7 @@ export declare interface SendOptions {
|
|
|
2025
2031
|
map?: SourceMap | null;
|
|
2026
2032
|
}
|
|
2027
2033
|
|
|
2028
|
-
export declare type ServerHook = (server: ViteDevServer) => (() => void) | void | Promise<(() => void) | void>;
|
|
2034
|
+
export declare type ServerHook = (this: void, server: ViteDevServer) => (() => void) | void | Promise<(() => void) | void>;
|
|
2029
2035
|
|
|
2030
2036
|
export declare interface ServerOptions extends CommonServerOptions {
|
|
2031
2037
|
/**
|
|
@@ -2353,6 +2359,10 @@ export declare interface Update {
|
|
|
2353
2359
|
path: string
|
|
2354
2360
|
acceptedPath: string
|
|
2355
2361
|
timestamp: number
|
|
2362
|
+
/**
|
|
2363
|
+
* @experimental internal
|
|
2364
|
+
*/
|
|
2365
|
+
explicitImportRequired?: boolean | undefined
|
|
2356
2366
|
}
|
|
2357
2367
|
|
|
2358
2368
|
export declare interface UpdatePayload {
|
|
@@ -2560,8 +2570,6 @@ export declare interface ViteDevServer {
|
|
|
2560
2570
|
/**
|
|
2561
2571
|
* The resolved urls Vite prints on the CLI. null in middleware mode or
|
|
2562
2572
|
* before `server.listen` is called.
|
|
2563
|
-
*
|
|
2564
|
-
* @experimental
|
|
2565
2573
|
*/
|
|
2566
2574
|
resolvedUrls: ResolvedServerUrls | null;
|
|
2567
2575
|
/**
|
|
@@ -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
|
*/
|
|
@@ -2706,7 +2714,7 @@ export declare interface WatchOptions {
|
|
|
2706
2714
|
ignorePermissionErrors?: boolean
|
|
2707
2715
|
|
|
2708
2716
|
/**
|
|
2709
|
-
* `true` if `useFsEvents` and `usePolling` are `false
|
|
2717
|
+
* `true` if `useFsEvents` and `usePolling` are `false`. Automatically filters out artifacts
|
|
2710
2718
|
* that occur when using editors that use "atomic writes" instead of writing directly to the
|
|
2711
2719
|
* source file. If a file is re-added within 100 ms of being deleted, Chokidar emits a `change`
|
|
2712
2720
|
* event rather than `unlink` then `add`. If the default of 100 ms does not work well for you,
|
package/dist/node/index.js
CHANGED
|
@@ -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-
|
|
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-d66eb979.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.
|
|
34
|
+
var version = "3.1.0-beta.2";
|
|
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
|
-
|
|
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.
|
|
3
|
+
"version": "3.1.0-beta.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Evan You",
|
|
@@ -58,29 +58,28 @@
|
|
|
58
58
|
},
|
|
59
59
|
"//": "READ CONTRIBUTING.md to understand what to put under deps vs. devDeps!",
|
|
60
60
|
"dependencies": {
|
|
61
|
-
"esbuild": "^0.
|
|
61
|
+
"esbuild": "^0.15.6",
|
|
62
62
|
"postcss": "^8.4.16",
|
|
63
63
|
"resolve": "^1.22.1",
|
|
64
|
-
"rollup": "
|
|
64
|
+
"rollup": "~2.78.0"
|
|
65
65
|
},
|
|
66
66
|
"optionalDependencies": {
|
|
67
67
|
"fsevents": "~2.3.2"
|
|
68
68
|
},
|
|
69
69
|
"devDependencies": {
|
|
70
70
|
"@ampproject/remapping": "^2.2.0",
|
|
71
|
-
"@babel/parser": "^7.18.
|
|
72
|
-
"@babel/types": "^7.18.
|
|
71
|
+
"@babel/parser": "^7.18.13",
|
|
72
|
+
"@babel/types": "^7.18.13",
|
|
73
73
|
"@jridgewell/trace-mapping": "^0.3.15",
|
|
74
74
|
"@rollup/plugin-alias": "^3.1.9",
|
|
75
75
|
"@rollup/plugin-commonjs": "^22.0.2",
|
|
76
76
|
"@rollup/plugin-dynamic-import-vars": "^1.4.4",
|
|
77
77
|
"@rollup/plugin-json": "^4.1.0",
|
|
78
78
|
"@rollup/plugin-node-resolve": "13.3.0",
|
|
79
|
-
"@rollup/plugin-typescript": "^8.
|
|
79
|
+
"@rollup/plugin-typescript": "^8.4.0",
|
|
80
80
|
"@rollup/pluginutils": "^4.2.1",
|
|
81
|
-
"@vue/compiler-dom": "^3.2.37",
|
|
82
81
|
"acorn": "^8.8.0",
|
|
83
|
-
"cac": "^6.7.
|
|
82
|
+
"cac": "^6.7.14",
|
|
84
83
|
"chokidar": "^3.5.3",
|
|
85
84
|
"connect": "^3.7.0",
|
|
86
85
|
"connect-history-api-fallback": "^2.0.0",
|
|
@@ -96,20 +95,20 @@
|
|
|
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.
|
|
98
|
+
"launch-editor-middleware": "^2.6.0",
|
|
100
99
|
"magic-string": "^0.26.2",
|
|
101
100
|
"micromatch": "^4.0.5",
|
|
102
|
-
"mlly": "^0.5.
|
|
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
|
-
"postcss-import": "^
|
|
108
|
+
"postcss-import": "^15.0.0",
|
|
109
109
|
"postcss-load-config": "^4.0.1",
|
|
110
|
-
"postcss-modules": "^
|
|
110
|
+
"postcss-modules": "^5.0.0",
|
|
111
111
|
"resolve.exports": "^1.1.0",
|
|
112
|
-
"rollup-plugin-license": "^2.8.1",
|
|
113
112
|
"sirv": "^2.0.2",
|
|
114
113
|
"source-map-js": "^1.0.2",
|
|
115
114
|
"source-map-support": "^0.5.21",
|
package/src/client/client.ts
CHANGED
|
@@ -189,7 +189,7 @@ async function handleMessage(payload: HMRPayload) {
|
|
|
189
189
|
outdatedLinkTags.add(el)
|
|
190
190
|
el.after(newLinkTag)
|
|
191
191
|
}
|
|
192
|
-
console.
|
|
192
|
+
console.debug(`[vite] css hot updated: ${searchUrl}`)
|
|
193
193
|
}
|
|
194
194
|
})
|
|
195
195
|
break
|
|
@@ -388,7 +388,12 @@ export function removeStyle(id: string): void {
|
|
|
388
388
|
}
|
|
389
389
|
}
|
|
390
390
|
|
|
391
|
-
async function fetchUpdate({
|
|
391
|
+
async function fetchUpdate({
|
|
392
|
+
path,
|
|
393
|
+
acceptedPath,
|
|
394
|
+
timestamp,
|
|
395
|
+
explicitImportRequired
|
|
396
|
+
}: Update) {
|
|
392
397
|
const mod = hotModulesMap.get(path)
|
|
393
398
|
if (!mod) {
|
|
394
399
|
// In a code-splitting project,
|
|
@@ -400,52 +405,37 @@ async function fetchUpdate({ path, acceptedPath, timestamp }: Update) {
|
|
|
400
405
|
const moduleMap = new Map<string, ModuleNamespace>()
|
|
401
406
|
const isSelfUpdate = path === acceptedPath
|
|
402
407
|
|
|
403
|
-
// make sure we only import each dep once
|
|
404
|
-
const modulesToUpdate = new Set<string>()
|
|
405
|
-
if (isSelfUpdate) {
|
|
406
|
-
// self update - only update self
|
|
407
|
-
modulesToUpdate.add(path)
|
|
408
|
-
} else {
|
|
409
|
-
// dep update
|
|
410
|
-
for (const { deps } of mod.callbacks) {
|
|
411
|
-
deps.forEach((dep) => {
|
|
412
|
-
if (acceptedPath === dep) {
|
|
413
|
-
modulesToUpdate.add(dep)
|
|
414
|
-
}
|
|
415
|
-
})
|
|
416
|
-
}
|
|
417
|
-
}
|
|
418
|
-
|
|
419
408
|
// determine the qualified callbacks before we re-import the modules
|
|
420
|
-
const qualifiedCallbacks = mod.callbacks.filter(({ deps }) =>
|
|
421
|
-
|
|
422
|
-
})
|
|
423
|
-
|
|
424
|
-
await Promise.all(
|
|
425
|
-
Array.from(modulesToUpdate).map(async (dep) => {
|
|
426
|
-
const disposer = disposeMap.get(dep)
|
|
427
|
-
if (disposer) await disposer(dataMap.get(dep))
|
|
428
|
-
const [path, query] = dep.split(`?`)
|
|
429
|
-
try {
|
|
430
|
-
const newMod: ModuleNamespace = await import(
|
|
431
|
-
/* @vite-ignore */
|
|
432
|
-
base +
|
|
433
|
-
path.slice(1) +
|
|
434
|
-
`?import&t=${timestamp}${query ? `&${query}` : ''}`
|
|
435
|
-
)
|
|
436
|
-
moduleMap.set(dep, newMod)
|
|
437
|
-
} catch (e) {
|
|
438
|
-
warnFailedFetch(e, dep)
|
|
439
|
-
}
|
|
440
|
-
})
|
|
409
|
+
const qualifiedCallbacks = mod.callbacks.filter(({ deps }) =>
|
|
410
|
+
deps.includes(acceptedPath)
|
|
441
411
|
)
|
|
442
412
|
|
|
413
|
+
if (isSelfUpdate || qualifiedCallbacks.length > 0) {
|
|
414
|
+
const dep = acceptedPath
|
|
415
|
+
const disposer = disposeMap.get(dep)
|
|
416
|
+
if (disposer) await disposer(dataMap.get(dep))
|
|
417
|
+
const [path, query] = dep.split(`?`)
|
|
418
|
+
try {
|
|
419
|
+
const newMod: ModuleNamespace = await import(
|
|
420
|
+
/* @vite-ignore */
|
|
421
|
+
base +
|
|
422
|
+
path.slice(1) +
|
|
423
|
+
`?${explicitImportRequired ? 'import&' : ''}t=${timestamp}${
|
|
424
|
+
query ? `&${query}` : ''
|
|
425
|
+
}`
|
|
426
|
+
)
|
|
427
|
+
moduleMap.set(dep, newMod)
|
|
428
|
+
} catch (e) {
|
|
429
|
+
warnFailedFetch(e, dep)
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
|
|
443
433
|
return () => {
|
|
444
434
|
for (const { deps, fn } of qualifiedCallbacks) {
|
|
445
435
|
fn(deps.map((dep) => moduleMap.get(dep)))
|
|
446
436
|
}
|
|
447
437
|
const loggedPath = isSelfUpdate ? path : `${acceptedPath} via ${path}`
|
|
448
|
-
console.
|
|
438
|
+
console.debug(`[vite] hot updated: ${loggedPath}`)
|
|
449
439
|
}
|
|
450
440
|
}
|
|
451
441
|
|
package/types/chokidar.d.ts
CHANGED
|
@@ -194,7 +194,7 @@ export interface WatchOptions {
|
|
|
194
194
|
ignorePermissionErrors?: boolean
|
|
195
195
|
|
|
196
196
|
/**
|
|
197
|
-
* `true` if `useFsEvents` and `usePolling` are `false
|
|
197
|
+
* `true` if `useFsEvents` and `usePolling` are `false`. Automatically filters out artifacts
|
|
198
198
|
* that occur when using editors that use "atomic writes" instead of writing directly to the
|
|
199
199
|
* source file. If a file is re-added within 100 ms of being deleted, Chokidar emits a `change`
|
|
200
200
|
* event rather than `unlink` then `add`. If the default of 100 ms does not work well for you,
|
package/types/hmrPayload.d.ts
CHANGED
package/types/shims.d.ts
CHANGED