vite-node 0.25.3 → 0.25.4
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/dist/cli.cjs +2 -2
- package/dist/cli.d.ts +1 -1
- package/dist/cli.mjs +2 -2
- package/dist/client.cjs +11 -9
- package/dist/client.d.ts +1 -1
- package/dist/client.mjs +11 -9
- package/dist/hmr.d.ts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/server.cjs +3 -1
- package/dist/server.d.ts +1 -1
- package/dist/server.mjs +3 -1
- package/dist/source-map.cjs +26 -0
- package/dist/source-map.d.ts +5 -2
- package/dist/source-map.mjs +25 -1
- package/dist/{types-257c4f87.d.ts → types-60eb9672.d.ts} +3 -2
- package/dist/types.d.ts +1 -1
- package/dist/utils.cjs +0 -14
- package/dist/utils.d.ts +2 -4
- package/dist/utils.mjs +1 -14
- package/package.json +1 -1
package/dist/cli.cjs
CHANGED
|
@@ -15,9 +15,9 @@ require('debug');
|
|
|
15
15
|
require('fs');
|
|
16
16
|
require('mlly');
|
|
17
17
|
require('url');
|
|
18
|
+
require('source-map-support');
|
|
18
19
|
require('module');
|
|
19
20
|
require('vm');
|
|
20
|
-
require('source-map-support');
|
|
21
21
|
|
|
22
22
|
function toArr(any) {
|
|
23
23
|
return any == null ? [] : Array.isArray(any) ? any : [any];
|
|
@@ -632,7 +632,7 @@ class CAC extends events.EventEmitter {
|
|
|
632
632
|
|
|
633
633
|
const cac = (name = "") => new CAC(name);
|
|
634
634
|
|
|
635
|
-
var version = "0.25.
|
|
635
|
+
var version = "0.25.4";
|
|
636
636
|
|
|
637
637
|
const cli = cac("vite-node");
|
|
638
638
|
cli.version(version).option("-r, --root <path>", "Use specified root directory").option("-c, --config <path>", "Use specified config file").option("-w, --watch", 'Restart on file changes, similar to "nodemon"').option("--options <options>", "Use specified Vite server options").help();
|
package/dist/cli.d.ts
CHANGED
package/dist/cli.mjs
CHANGED
|
@@ -13,9 +13,9 @@ import 'debug';
|
|
|
13
13
|
import 'fs';
|
|
14
14
|
import 'mlly';
|
|
15
15
|
import 'url';
|
|
16
|
+
import 'source-map-support';
|
|
16
17
|
import 'module';
|
|
17
18
|
import 'vm';
|
|
18
|
-
import 'source-map-support';
|
|
19
19
|
|
|
20
20
|
function toArr(any) {
|
|
21
21
|
return any == null ? [] : Array.isArray(any) ? any : [any];
|
|
@@ -630,7 +630,7 @@ class CAC extends EventEmitter {
|
|
|
630
630
|
|
|
631
631
|
const cac = (name = "") => new CAC(name);
|
|
632
632
|
|
|
633
|
-
var version = "0.25.
|
|
633
|
+
var version = "0.25.4";
|
|
634
634
|
|
|
635
635
|
const cli = cac("vite-node");
|
|
636
636
|
cli.version(version).option("-r, --root <path>", "Use specified root directory").option("-c, --config <path>", "Use specified config file").option("-w, --watch", 'Restart on file changes, similar to "nodemon"').option("--options <options>", "Use specified Vite server options").help();
|
package/dist/client.cjs
CHANGED
|
@@ -9,7 +9,9 @@ var pathe = require('pathe');
|
|
|
9
9
|
var mlly = require('mlly');
|
|
10
10
|
var createDebug = require('debug');
|
|
11
11
|
var utils = require('./utils.cjs');
|
|
12
|
+
var sourceMap = require('./source-map.cjs');
|
|
12
13
|
require('fs');
|
|
14
|
+
require('source-map-support');
|
|
13
15
|
|
|
14
16
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
15
17
|
|
|
@@ -125,14 +127,11 @@ class ModuleCacheMap extends Map {
|
|
|
125
127
|
return invalidated;
|
|
126
128
|
}
|
|
127
129
|
getSourceMap(id) {
|
|
128
|
-
|
|
129
|
-
const fsPath = this.normalizePath(id);
|
|
130
|
-
const cache = this.get(fsPath);
|
|
130
|
+
const cache = this.get(id);
|
|
131
131
|
if (cache.map)
|
|
132
132
|
return cache.map;
|
|
133
|
-
const
|
|
134
|
-
if (
|
|
135
|
-
const map = JSON.parse(Buffer.from(mapString, "base64").toString("utf-8"));
|
|
133
|
+
const map = cache.code && sourceMap.extractSourceMap(cache.code);
|
|
134
|
+
if (map) {
|
|
136
135
|
cache.map = map;
|
|
137
136
|
return map;
|
|
138
137
|
}
|
|
@@ -169,7 +168,10 @@ class ViteNodeRunner {
|
|
|
169
168
|
if (mod.promise)
|
|
170
169
|
return mod.promise;
|
|
171
170
|
const promise = this.directRequest(id, fsPath, callstack);
|
|
172
|
-
Object.assign(mod, { promise });
|
|
171
|
+
Object.assign(mod, { promise, evaluated: false });
|
|
172
|
+
promise.finally(() => {
|
|
173
|
+
mod.evaluated = true;
|
|
174
|
+
});
|
|
173
175
|
return await promise;
|
|
174
176
|
}
|
|
175
177
|
async directRequest(id, fsPath, _callstack) {
|
|
@@ -248,7 +250,7 @@ ${getStack()}`), 2e3);
|
|
|
248
250
|
return true;
|
|
249
251
|
}
|
|
250
252
|
});
|
|
251
|
-
Object.assign(mod, { code: transformed, exports });
|
|
253
|
+
Object.assign(mod, { code: transformed, exports, evaluated: false });
|
|
252
254
|
const __filename = url.fileURLToPath(url$1);
|
|
253
255
|
const moduleProxy = {
|
|
254
256
|
set exports(value) {
|
|
@@ -347,7 +349,7 @@ function defineExport(exports, key, value) {
|
|
|
347
349
|
function exportAll(exports, sourceModule) {
|
|
348
350
|
if (exports === sourceModule)
|
|
349
351
|
return;
|
|
350
|
-
if (
|
|
352
|
+
if (utils.isPrimitive(sourceModule) || Array.isArray(sourceModule))
|
|
351
353
|
return;
|
|
352
354
|
for (const key in sourceModule) {
|
|
353
355
|
if (key !== "default") {
|
package/dist/client.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { j as DEFAULT_REQUEST_STUBS, M as ModuleCacheMap, h as ViteNodeRunner } from './types-
|
|
1
|
+
export { j as DEFAULT_REQUEST_STUBS, M as ModuleCacheMap, h as ViteNodeRunner } from './types-60eb9672.js';
|
package/dist/client.mjs
CHANGED
|
@@ -5,7 +5,9 @@ import { resolve, dirname, isAbsolute, extname } from 'pathe';
|
|
|
5
5
|
import { isNodeBuiltin } from 'mlly';
|
|
6
6
|
import createDebug from 'debug';
|
|
7
7
|
import { normalizeModuleId, slash, normalizeRequestId, toFilePath, isPrimitive, mergeSlashes } from './utils.mjs';
|
|
8
|
+
import { extractSourceMap } from './source-map.mjs';
|
|
8
9
|
import 'fs';
|
|
10
|
+
import 'source-map-support';
|
|
9
11
|
|
|
10
12
|
const debugExecute = createDebug("vite-node:client:execute");
|
|
11
13
|
const debugNative = createDebug("vite-node:client:native");
|
|
@@ -98,14 +100,11 @@ class ModuleCacheMap extends Map {
|
|
|
98
100
|
return invalidated;
|
|
99
101
|
}
|
|
100
102
|
getSourceMap(id) {
|
|
101
|
-
|
|
102
|
-
const fsPath = this.normalizePath(id);
|
|
103
|
-
const cache = this.get(fsPath);
|
|
103
|
+
const cache = this.get(id);
|
|
104
104
|
if (cache.map)
|
|
105
105
|
return cache.map;
|
|
106
|
-
const
|
|
107
|
-
if (
|
|
108
|
-
const map = JSON.parse(Buffer.from(mapString, "base64").toString("utf-8"));
|
|
106
|
+
const map = cache.code && extractSourceMap(cache.code);
|
|
107
|
+
if (map) {
|
|
109
108
|
cache.map = map;
|
|
110
109
|
return map;
|
|
111
110
|
}
|
|
@@ -142,7 +141,10 @@ class ViteNodeRunner {
|
|
|
142
141
|
if (mod.promise)
|
|
143
142
|
return mod.promise;
|
|
144
143
|
const promise = this.directRequest(id, fsPath, callstack);
|
|
145
|
-
Object.assign(mod, { promise });
|
|
144
|
+
Object.assign(mod, { promise, evaluated: false });
|
|
145
|
+
promise.finally(() => {
|
|
146
|
+
mod.evaluated = true;
|
|
147
|
+
});
|
|
146
148
|
return await promise;
|
|
147
149
|
}
|
|
148
150
|
async directRequest(id, fsPath, _callstack) {
|
|
@@ -221,7 +223,7 @@ ${getStack()}`), 2e3);
|
|
|
221
223
|
return true;
|
|
222
224
|
}
|
|
223
225
|
});
|
|
224
|
-
Object.assign(mod, { code: transformed, exports });
|
|
226
|
+
Object.assign(mod, { code: transformed, exports, evaluated: false });
|
|
225
227
|
const __filename = fileURLToPath(url);
|
|
226
228
|
const moduleProxy = {
|
|
227
229
|
set exports(value) {
|
|
@@ -320,7 +322,7 @@ function defineExport(exports, key, value) {
|
|
|
320
322
|
function exportAll(exports, sourceModule) {
|
|
321
323
|
if (exports === sourceModule)
|
|
322
324
|
return;
|
|
323
|
-
if (
|
|
325
|
+
if (isPrimitive(sourceModule) || Array.isArray(sourceModule))
|
|
324
326
|
return;
|
|
325
327
|
for (const key in sourceModule) {
|
|
326
328
|
if (key !== "default") {
|
package/dist/hmr.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { EventEmitter } from 'events';
|
|
2
2
|
import { HMRPayload, Plugin } from 'vite';
|
|
3
|
-
import { g as CustomEventMap, h as ViteNodeRunner, i as HMRPayload$1, H as HotContext } from './types-
|
|
3
|
+
import { g as CustomEventMap, h as ViteNodeRunner, i as HMRPayload$1, H as HotContext } from './types-60eb9672.js';
|
|
4
4
|
|
|
5
5
|
declare type EventType = string | symbol;
|
|
6
6
|
declare type Handler<T = unknown> = (event: T) => void;
|
package/dist/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { A as Arrayable, C as CreateHotContextFunction, f as DebuggerOptions, D as DepsHandlingOptions, a as FetchFunction, F as FetchResult, H as HotContext, c as ModuleCache, M as ModuleCacheMap, N as Nullable, R as RawSourceMap, b as ResolveIdFunction, S as StartOfSourceMap, d as ViteNodeResolveId, V as ViteNodeRunnerOptions, e as ViteNodeServerOptions } from './types-
|
|
1
|
+
export { A as Arrayable, C as CreateHotContextFunction, f as DebuggerOptions, D as DepsHandlingOptions, a as FetchFunction, F as FetchResult, H as HotContext, c as ModuleCache, M as ModuleCacheMap, N as Nullable, R as RawSourceMap, b as ResolveIdFunction, S as StartOfSourceMap, d as ViteNodeResolveId, V as ViteNodeRunnerOptions, e as ViteNodeServerOptions } from './types-60eb9672.js';
|
package/dist/server.cjs
CHANGED
|
@@ -9,8 +9,10 @@ var fs = require('fs');
|
|
|
9
9
|
var mlly = require('mlly');
|
|
10
10
|
var utils = require('./utils.cjs');
|
|
11
11
|
var picocolors = require('./chunk-picocolors.cjs');
|
|
12
|
+
var sourceMap = require('./source-map.cjs');
|
|
12
13
|
require('url');
|
|
13
14
|
require('tty');
|
|
15
|
+
require('source-map-support');
|
|
14
16
|
|
|
15
17
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
16
18
|
|
|
@@ -299,7 +301,7 @@ class ViteNodeServer {
|
|
|
299
301
|
}
|
|
300
302
|
const sourcemap = this.options.sourcemap ?? "inline";
|
|
301
303
|
if (sourcemap === "inline" && result && !id.includes("node_modules"))
|
|
302
|
-
|
|
304
|
+
sourceMap.withInlineSourcemap(result);
|
|
303
305
|
if ((_c = this.options.debug) == null ? void 0 : _c.dumpModules)
|
|
304
306
|
await ((_d = this.debugger) == null ? void 0 : _d.dumpFile(id, result));
|
|
305
307
|
return result;
|
package/dist/server.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { TransformResult, ViteDevServer } from 'vite';
|
|
2
|
-
import { f as DebuggerOptions, D as DepsHandlingOptions, e as ViteNodeServerOptions, F as FetchResult, d as ViteNodeResolveId, R as RawSourceMap } from './types-
|
|
2
|
+
import { f as DebuggerOptions, D as DepsHandlingOptions, e as ViteNodeServerOptions, F as FetchResult, d as ViteNodeResolveId, R as RawSourceMap } from './types-60eb9672.js';
|
|
3
3
|
|
|
4
4
|
declare class Debugger {
|
|
5
5
|
options: DebuggerOptions;
|
package/dist/server.mjs
CHANGED
|
@@ -3,10 +3,12 @@ import { resolve, join } from 'pathe';
|
|
|
3
3
|
import createDebug from 'debug';
|
|
4
4
|
import { existsSync, promises } from 'fs';
|
|
5
5
|
import { isNodeBuiltin, isValidNodeImport } from 'mlly';
|
|
6
|
-
import { slash, toArray, toFilePath
|
|
6
|
+
import { slash, toArray, toFilePath } from './utils.mjs';
|
|
7
7
|
import { p as picocolors } from './chunk-picocolors.mjs';
|
|
8
|
+
import { withInlineSourcemap } from './source-map.mjs';
|
|
8
9
|
import 'url';
|
|
9
10
|
import 'tty';
|
|
11
|
+
import 'source-map-support';
|
|
10
12
|
|
|
11
13
|
const ESM_EXT_RE = /\.(es|esm|esm-browser|esm-bundler|es6|module)\.js$/;
|
|
12
14
|
const ESM_FOLDER_RE = /\/(es|esm)\/(.*\.js)$/;
|
package/dist/source-map.cjs
CHANGED
|
@@ -4,6 +4,30 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var sourceMapSupport = require('source-map-support');
|
|
6
6
|
|
|
7
|
+
let SOURCEMAPPING_URL = "sourceMa";
|
|
8
|
+
SOURCEMAPPING_URL += "ppingURL";
|
|
9
|
+
const VITE_NODE_SOURCEMAPPING_URL = `${SOURCEMAPPING_URL}=data:application/json;charset=utf-8;source=vite-node`;
|
|
10
|
+
const VITE_NODE_SOURCEMAPPING_REGEXP = new RegExp(`//# ${VITE_NODE_SOURCEMAPPING_URL};base64,(.+)`);
|
|
11
|
+
const OTHER_SOURCE_MAP_REGEXP = new RegExp(`//# ${SOURCEMAPPING_URL}=data:application/json[^,]+base64,(.+)`);
|
|
12
|
+
async function withInlineSourcemap(result) {
|
|
13
|
+
const { code, map } = result;
|
|
14
|
+
if (!map || code.includes(VITE_NODE_SOURCEMAPPING_URL))
|
|
15
|
+
return result;
|
|
16
|
+
if (OTHER_SOURCE_MAP_REGEXP.test(code))
|
|
17
|
+
result.code = code.replace(OTHER_SOURCE_MAP_REGEXP, "");
|
|
18
|
+
result.code = `${code}
|
|
19
|
+
|
|
20
|
+
//# ${VITE_NODE_SOURCEMAPPING_URL};base64,${Buffer.from(JSON.stringify(map), "utf-8").toString("base64")}
|
|
21
|
+
`;
|
|
22
|
+
return result;
|
|
23
|
+
}
|
|
24
|
+
function extractSourceMap(code) {
|
|
25
|
+
var _a;
|
|
26
|
+
const mapString = (_a = code.match(VITE_NODE_SOURCEMAPPING_REGEXP)) == null ? void 0 : _a[1];
|
|
27
|
+
if (mapString)
|
|
28
|
+
return JSON.parse(Buffer.from(mapString, "base64").toString("utf-8"));
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
7
31
|
function installSourcemapsSupport(options) {
|
|
8
32
|
sourceMapSupport.install({
|
|
9
33
|
environment: "node",
|
|
@@ -21,4 +45,6 @@ function installSourcemapsSupport(options) {
|
|
|
21
45
|
});
|
|
22
46
|
}
|
|
23
47
|
|
|
48
|
+
exports.extractSourceMap = extractSourceMap;
|
|
24
49
|
exports.installSourcemapsSupport = installSourcemapsSupport;
|
|
50
|
+
exports.withInlineSourcemap = withInlineSourcemap;
|
package/dist/source-map.d.ts
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { TransformResult } from 'vite';
|
|
2
|
+
import { R as RawSourceMap } from './types-60eb9672.js';
|
|
2
3
|
|
|
3
4
|
interface InstallSourceMapSupportOptions {
|
|
4
5
|
getSourceMap: (source: string) => RawSourceMap | null | undefined;
|
|
5
6
|
}
|
|
7
|
+
declare function withInlineSourcemap(result: TransformResult): Promise<TransformResult>;
|
|
8
|
+
declare function extractSourceMap(code: string): RawSourceMap | null;
|
|
6
9
|
declare function installSourcemapsSupport(options: InstallSourceMapSupportOptions): void;
|
|
7
10
|
|
|
8
|
-
export { installSourcemapsSupport };
|
|
11
|
+
export { extractSourceMap, installSourcemapsSupport, withInlineSourcemap };
|
package/dist/source-map.mjs
CHANGED
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
import { install } from 'source-map-support';
|
|
2
2
|
|
|
3
|
+
let SOURCEMAPPING_URL = "sourceMa";
|
|
4
|
+
SOURCEMAPPING_URL += "ppingURL";
|
|
5
|
+
const VITE_NODE_SOURCEMAPPING_URL = `${SOURCEMAPPING_URL}=data:application/json;charset=utf-8;source=vite-node`;
|
|
6
|
+
const VITE_NODE_SOURCEMAPPING_REGEXP = new RegExp(`//# ${VITE_NODE_SOURCEMAPPING_URL};base64,(.+)`);
|
|
7
|
+
const OTHER_SOURCE_MAP_REGEXP = new RegExp(`//# ${SOURCEMAPPING_URL}=data:application/json[^,]+base64,(.+)`);
|
|
8
|
+
async function withInlineSourcemap(result) {
|
|
9
|
+
const { code, map } = result;
|
|
10
|
+
if (!map || code.includes(VITE_NODE_SOURCEMAPPING_URL))
|
|
11
|
+
return result;
|
|
12
|
+
if (OTHER_SOURCE_MAP_REGEXP.test(code))
|
|
13
|
+
result.code = code.replace(OTHER_SOURCE_MAP_REGEXP, "");
|
|
14
|
+
result.code = `${code}
|
|
15
|
+
|
|
16
|
+
//# ${VITE_NODE_SOURCEMAPPING_URL};base64,${Buffer.from(JSON.stringify(map), "utf-8").toString("base64")}
|
|
17
|
+
`;
|
|
18
|
+
return result;
|
|
19
|
+
}
|
|
20
|
+
function extractSourceMap(code) {
|
|
21
|
+
var _a;
|
|
22
|
+
const mapString = (_a = code.match(VITE_NODE_SOURCEMAPPING_REGEXP)) == null ? void 0 : _a[1];
|
|
23
|
+
if (mapString)
|
|
24
|
+
return JSON.parse(Buffer.from(mapString, "base64").toString("utf-8"));
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
3
27
|
function installSourcemapsSupport(options) {
|
|
4
28
|
install({
|
|
5
29
|
environment: "node",
|
|
@@ -17,4 +41,4 @@ function installSourcemapsSupport(options) {
|
|
|
17
41
|
});
|
|
18
42
|
}
|
|
19
43
|
|
|
20
|
-
export { installSourcemapsSupport };
|
|
44
|
+
export { extractSourceMap, installSourcemapsSupport, withInlineSourcemap };
|
|
@@ -142,7 +142,7 @@ declare class ModuleCacheMap extends Map<string, ModuleCache> {
|
|
|
142
142
|
/**
|
|
143
143
|
* Return parsed source map based on inlined source map of the module
|
|
144
144
|
*/
|
|
145
|
-
getSourceMap(id: string):
|
|
145
|
+
getSourceMap(id: string): RawSourceMap | null;
|
|
146
146
|
}
|
|
147
147
|
declare class ViteNodeRunner {
|
|
148
148
|
options: ViteNodeRunnerOptions;
|
|
@@ -156,7 +156,7 @@ declare class ViteNodeRunner {
|
|
|
156
156
|
constructor(options: ViteNodeRunnerOptions);
|
|
157
157
|
executeFile(file: string): Promise<any>;
|
|
158
158
|
executeId(id: string): Promise<any>;
|
|
159
|
-
getSourceMap(id: string):
|
|
159
|
+
getSourceMap(id: string): RawSourceMap | null;
|
|
160
160
|
/** @internal */
|
|
161
161
|
cachedRequest(rawId: string, callstack: string[]): Promise<any>;
|
|
162
162
|
/** @internal */
|
|
@@ -209,6 +209,7 @@ declare type CreateHotContextFunction = (runner: ViteNodeRunner, url: string) =>
|
|
|
209
209
|
interface ModuleCache {
|
|
210
210
|
promise?: Promise<any>;
|
|
211
211
|
exports?: any;
|
|
212
|
+
evaluated?: boolean;
|
|
212
213
|
code?: string;
|
|
213
214
|
map?: RawSourceMap;
|
|
214
215
|
/**
|
package/dist/types.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { A as Arrayable, C as CreateHotContextFunction, f as DebuggerOptions, D as DepsHandlingOptions, a as FetchFunction, F as FetchResult, H as HotContext, c as ModuleCache, M as ModuleCacheMap, N as Nullable, R as RawSourceMap, b as ResolveIdFunction, S as StartOfSourceMap, d as ViteNodeResolveId, V as ViteNodeRunnerOptions, e as ViteNodeServerOptions } from './types-
|
|
1
|
+
export { A as Arrayable, C as CreateHotContextFunction, f as DebuggerOptions, D as DepsHandlingOptions, a as FetchFunction, F as FetchResult, H as HotContext, c as ModuleCache, M as ModuleCacheMap, N as Nullable, R as RawSourceMap, b as ResolveIdFunction, S as StartOfSourceMap, d as ViteNodeResolveId, V as ViteNodeRunnerOptions, e as ViteNodeServerOptions } from './types-60eb9672.js';
|
package/dist/utils.cjs
CHANGED
|
@@ -51,19 +51,6 @@ function toFilePath(id, root) {
|
|
|
51
51
|
absolute = absolute.slice(1);
|
|
52
52
|
return isWindows && absolute.startsWith("/") ? slash(url.fileURLToPath(url.pathToFileURL(absolute.slice(1)).href)) : absolute;
|
|
53
53
|
}
|
|
54
|
-
let SOURCEMAPPING_URL = "sourceMa";
|
|
55
|
-
SOURCEMAPPING_URL += "ppingURL";
|
|
56
|
-
async function withInlineSourcemap(result) {
|
|
57
|
-
const { code, map } = result;
|
|
58
|
-
if (code.includes(`${SOURCEMAPPING_URL}=`))
|
|
59
|
-
return result;
|
|
60
|
-
if (map)
|
|
61
|
-
result.code = `${code}
|
|
62
|
-
|
|
63
|
-
//# ${SOURCEMAPPING_URL}=data:application/json;charset=utf-8;base64,${Buffer.from(JSON.stringify(map), "utf-8").toString("base64")}
|
|
64
|
-
`;
|
|
65
|
-
return result;
|
|
66
|
-
}
|
|
67
54
|
function toArray(array) {
|
|
68
55
|
if (array === null || array === void 0)
|
|
69
56
|
array = [];
|
|
@@ -81,4 +68,3 @@ exports.pathFromRoot = pathFromRoot;
|
|
|
81
68
|
exports.slash = slash;
|
|
82
69
|
exports.toArray = toArray;
|
|
83
70
|
exports.toFilePath = toFilePath;
|
|
84
|
-
exports.withInlineSourcemap = withInlineSourcemap;
|
package/dist/utils.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { N as Nullable, A as Arrayable } from './types-257c4f87.js';
|
|
1
|
+
import { N as Nullable, A as Arrayable } from './types-60eb9672.js';
|
|
3
2
|
|
|
4
3
|
declare const isWindows: boolean;
|
|
5
4
|
declare function slash(str: string): string;
|
|
@@ -9,7 +8,6 @@ declare function normalizeModuleId(id: string): string;
|
|
|
9
8
|
declare function isPrimitive(v: any): boolean;
|
|
10
9
|
declare function pathFromRoot(root: string, filename: string): string;
|
|
11
10
|
declare function toFilePath(id: string, root: string): string;
|
|
12
|
-
declare function withInlineSourcemap(result: TransformResult): Promise<TransformResult>;
|
|
13
11
|
/**
|
|
14
12
|
* Convert `Arrayable<T>` to `Array<T>`
|
|
15
13
|
*
|
|
@@ -17,4 +15,4 @@ declare function withInlineSourcemap(result: TransformResult): Promise<Transform
|
|
|
17
15
|
*/
|
|
18
16
|
declare function toArray<T>(array?: Nullable<Arrayable<T>>): Array<T>;
|
|
19
17
|
|
|
20
|
-
export { isPrimitive, isWindows, mergeSlashes, normalizeModuleId, normalizeRequestId, pathFromRoot, slash, toArray, toFilePath
|
|
18
|
+
export { isPrimitive, isWindows, mergeSlashes, normalizeModuleId, normalizeRequestId, pathFromRoot, slash, toArray, toFilePath };
|
package/dist/utils.mjs
CHANGED
|
@@ -47,19 +47,6 @@ function toFilePath(id, root) {
|
|
|
47
47
|
absolute = absolute.slice(1);
|
|
48
48
|
return isWindows && absolute.startsWith("/") ? slash(fileURLToPath(pathToFileURL(absolute.slice(1)).href)) : absolute;
|
|
49
49
|
}
|
|
50
|
-
let SOURCEMAPPING_URL = "sourceMa";
|
|
51
|
-
SOURCEMAPPING_URL += "ppingURL";
|
|
52
|
-
async function withInlineSourcemap(result) {
|
|
53
|
-
const { code, map } = result;
|
|
54
|
-
if (code.includes(`${SOURCEMAPPING_URL}=`))
|
|
55
|
-
return result;
|
|
56
|
-
if (map)
|
|
57
|
-
result.code = `${code}
|
|
58
|
-
|
|
59
|
-
//# ${SOURCEMAPPING_URL}=data:application/json;charset=utf-8;base64,${Buffer.from(JSON.stringify(map), "utf-8").toString("base64")}
|
|
60
|
-
`;
|
|
61
|
-
return result;
|
|
62
|
-
}
|
|
63
50
|
function toArray(array) {
|
|
64
51
|
if (array === null || array === void 0)
|
|
65
52
|
array = [];
|
|
@@ -68,4 +55,4 @@ function toArray(array) {
|
|
|
68
55
|
return [array];
|
|
69
56
|
}
|
|
70
57
|
|
|
71
|
-
export { isPrimitive, isWindows, mergeSlashes, normalizeModuleId, normalizeRequestId, pathFromRoot, slash, toArray, toFilePath
|
|
58
|
+
export { isPrimitive, isWindows, mergeSlashes, normalizeModuleId, normalizeRequestId, pathFromRoot, slash, toArray, toFilePath };
|