rolldown-require 1.0.0 → 1.0.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.
- package/README.md +2 -0
- package/dist/index.cjs +29 -66
- package/dist/index.mjs +60 -105
- package/package.json +12 -3
- package/dist/chunk-Q6XJHTDB.cjs +0 -15
- package/dist/chunk-WUKYLWAZ.mjs +0 -0
- package/dist/false-G5OFYI37.mjs +0 -7
- package/dist/false-SI6OY5LO.cjs +0 -9
package/README.md
CHANGED
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
[](https://npm.im/rolldown-require) [](https://npm.im/rolldown-require) [](https://www.jsdocs.io/package/rolldown-require)
|
|
6
6
|
|
|
7
|
+
## [HomePage](https://github.com/weapp-vite/weapp-vite/tree/main/packages/rolldown-require)
|
|
8
|
+
|
|
7
9
|
## Use Case
|
|
8
10
|
|
|
9
11
|
Recently, the [rolldown-vite](https://github.com/vite/rolldown-vite) project needed to load user-provided configuration files. However, simply using `require()` was not sufficient, because the configuration files might not be `CommonJS` modules—they could be in `.mjs` format or even written in `TypeScript`. That’s where the `rolldown-require` package comes in, enabling you to load configuration files of any format.
|
package/dist/index.cjs
CHANGED
|
@@ -1,7 +1,13 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
|
-
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
2
|
+
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
3
|
+
}) : x)(function(x) {
|
|
4
|
+
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
5
|
+
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
6
|
+
});
|
|
3
7
|
|
|
4
|
-
|
|
8
|
+
// ../../node_modules/.pnpm/tsup@8.5.0_@swc+core@1.12.0_jiti@2.4.2_postcss@8.5.4_tsx@4.20.1_typescript@5.8.3_yaml@2.8.0/node_modules/tsup/assets/cjs_shims.js
|
|
9
|
+
var getImportMetaUrl = () => typeof document === "undefined" ? new URL(`file:${__filename}`).href : document.currentScript && document.currentScript.src || new URL("main.js", document.baseURI).href;
|
|
10
|
+
var importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
|
|
5
11
|
|
|
6
12
|
// src/index.ts
|
|
7
13
|
var _fs = require('fs'); var _fs2 = _interopRequireDefault(_fs);
|
|
@@ -23,8 +29,6 @@ var _rolldown = require('rolldown');
|
|
|
23
29
|
// src/utils.ts
|
|
24
30
|
var _child_process = require('child_process');
|
|
25
31
|
var _crypto = require('crypto'); var _crypto2 = _interopRequireDefault(_crypto);
|
|
26
|
-
var _dns = require('dns');
|
|
27
|
-
|
|
28
32
|
|
|
29
33
|
|
|
30
34
|
|
|
@@ -34,46 +38,12 @@ var _pluginutils = require('@rollup/pluginutils');
|
|
|
34
38
|
|
|
35
39
|
// src/constants.ts
|
|
36
40
|
|
|
37
|
-
|
|
38
|
-
|
|
39
41
|
var { version } = JSON.parse(
|
|
40
|
-
_fs.readFileSync.call(void 0, new URL("../package.json",
|
|
41
|
-
);
|
|
42
|
-
var DEFAULT_MAIN_FIELDS = [
|
|
43
|
-
"browser",
|
|
44
|
-
"module",
|
|
45
|
-
"jsnext:main",
|
|
46
|
-
// moment still uses this...
|
|
47
|
-
"jsnext"
|
|
48
|
-
];
|
|
49
|
-
var DEFAULT_CLIENT_MAIN_FIELDS = Object.freeze(DEFAULT_MAIN_FIELDS);
|
|
50
|
-
var DEFAULT_SERVER_MAIN_FIELDS = Object.freeze(
|
|
51
|
-
DEFAULT_MAIN_FIELDS.filter((f) => f !== "browser")
|
|
42
|
+
_fs.readFileSync.call(void 0, new URL("../package.json", importMetaUrl)).toString()
|
|
52
43
|
);
|
|
53
44
|
var DEV_PROD_CONDITION = `development|production`;
|
|
54
|
-
var DEFAULT_CONDITIONS = ["module", "browser", "node", DEV_PROD_CONDITION];
|
|
55
|
-
var DEFAULT_CLIENT_CONDITIONS = Object.freeze(
|
|
56
|
-
DEFAULT_CONDITIONS.filter((c) => c !== "node")
|
|
57
|
-
);
|
|
58
|
-
var DEFAULT_SERVER_CONDITIONS = Object.freeze(
|
|
59
|
-
DEFAULT_CONDITIONS.filter((c) => c !== "browser")
|
|
60
|
-
);
|
|
61
45
|
var OPTIMIZABLE_ENTRY_RE = /\.[cm]?[jt]s$/;
|
|
62
46
|
var SPECIAL_QUERY_RE = /[?&](?:worker|sharedworker|raw|url)\b/;
|
|
63
|
-
var FS_PREFIX = `/@fs/`;
|
|
64
|
-
var CLIENT_PUBLIC_PATH = `/@vite/client`;
|
|
65
|
-
var ENV_PUBLIC_PATH = `/@vite/env`;
|
|
66
|
-
var VITE_PACKAGE_DIR = _path.resolve.call(void 0,
|
|
67
|
-
// import.meta.url is `dist/node/constants.js` after bundle
|
|
68
|
-
_url.fileURLToPath.call(void 0, _chunkQ6XJHTDBcjs.importMetaUrl),
|
|
69
|
-
"../../.."
|
|
70
|
-
);
|
|
71
|
-
var CLIENT_ENTRY = _path.resolve.call(void 0, VITE_PACKAGE_DIR, "dist/client/client.mjs");
|
|
72
|
-
var ENV_ENTRY = _path.resolve.call(void 0, VITE_PACKAGE_DIR, "dist/client/env.mjs");
|
|
73
|
-
var CLIENT_DIR = _path2.default.dirname(CLIENT_ENTRY);
|
|
74
|
-
var VALID_ID_PREFIX = `/@id/`;
|
|
75
|
-
var SOURCEMAPPING_URL = "sourceMa";
|
|
76
|
-
SOURCEMAPPING_URL += "ppingURL";
|
|
77
47
|
|
|
78
48
|
// src/sharedUtils.ts
|
|
79
49
|
|
|
@@ -86,9 +56,9 @@ var postfixRE = /[?#].*$/;
|
|
|
86
56
|
function cleanUrl(url) {
|
|
87
57
|
return url.replace(postfixRE, "");
|
|
88
58
|
}
|
|
89
|
-
function splitFileAndPostfix(
|
|
90
|
-
const file = cleanUrl(
|
|
91
|
-
return { file, postfix:
|
|
59
|
+
function splitFileAndPostfix(path6) {
|
|
60
|
+
const file = cleanUrl(path6);
|
|
61
|
+
return { file, postfix: path6.slice(file.length) };
|
|
92
62
|
}
|
|
93
63
|
var AsyncFunction = async function() {
|
|
94
64
|
}.constructor;
|
|
@@ -143,11 +113,11 @@ function isOptimizable(id, optimizeDeps) {
|
|
|
143
113
|
}
|
|
144
114
|
var bareImportRE = /^(?![a-z]:)[\w@](?!.*:\/\/)/i;
|
|
145
115
|
var deepImportRE = /^([^@][^/]*)\/|^(@[^/]+\/[^/]+)\//;
|
|
146
|
-
var _require = _module.createRequire.call(void 0,
|
|
147
|
-
var _dirname = _path2.default.dirname(_url.fileURLToPath.call(void 0,
|
|
148
|
-
var urlCanParse = _nullishCoalesce(_url.URL.canParse, () => ( ((
|
|
116
|
+
var _require = _module.createRequire.call(void 0, importMetaUrl);
|
|
117
|
+
var _dirname = _path2.default.dirname(_url.fileURLToPath.call(void 0, importMetaUrl));
|
|
118
|
+
var urlCanParse = _nullishCoalesce(_url.URL.canParse, () => ( ((path6, base) => {
|
|
149
119
|
try {
|
|
150
|
-
new (0, _url.URL)(
|
|
120
|
+
new (0, _url.URL)(path6, base);
|
|
151
121
|
return true;
|
|
152
122
|
} catch (e2) {
|
|
153
123
|
return false;
|
|
@@ -156,13 +126,6 @@ var urlCanParse = _nullishCoalesce(_url.URL.canParse, () => ( ((path7, base) =>
|
|
|
156
126
|
function normalizePath(id) {
|
|
157
127
|
return _path2.default.posix.normalize(isWindows ? slash(id) : id);
|
|
158
128
|
}
|
|
159
|
-
var internalPrefixes = [
|
|
160
|
-
FS_PREFIX,
|
|
161
|
-
VALID_ID_PREFIX,
|
|
162
|
-
CLIENT_PUBLIC_PATH,
|
|
163
|
-
ENV_PUBLIC_PATH
|
|
164
|
-
];
|
|
165
|
-
var InternalPrefixRE = new RegExp(`^(?:${internalPrefixes.join("|")})`);
|
|
166
129
|
function injectQuery(url, queryToInject) {
|
|
167
130
|
const { file, postfix } = splitFileAndPostfix(url);
|
|
168
131
|
const normalizedFile = isWindows ? slash(file) : file;
|
|
@@ -196,8 +159,8 @@ function isFilePathESM(filePath, packageCache) {
|
|
|
196
159
|
}
|
|
197
160
|
var safeRealpathSync = isWindows ? windowsSafeRealPathSync : _fs2.default.realpathSync.native;
|
|
198
161
|
var windowsNetworkMap = /* @__PURE__ */ new Map();
|
|
199
|
-
function windowsMappedRealpathSync(
|
|
200
|
-
const realPath = _fs2.default.realpathSync.native(
|
|
162
|
+
function windowsMappedRealpathSync(path6) {
|
|
163
|
+
const realPath = _fs2.default.realpathSync.native(path6);
|
|
201
164
|
if (realPath.startsWith("\\\\")) {
|
|
202
165
|
for (const [network, volume] of windowsNetworkMap) {
|
|
203
166
|
if (realPath.startsWith(network)) {
|
|
@@ -209,12 +172,12 @@ function windowsMappedRealpathSync(path7) {
|
|
|
209
172
|
}
|
|
210
173
|
var parseNetUseRE = /^\w* +(\w:) +([^ ]+)\s/;
|
|
211
174
|
var firstSafeRealPathSyncRun = false;
|
|
212
|
-
function windowsSafeRealPathSync(
|
|
175
|
+
function windowsSafeRealPathSync(path6) {
|
|
213
176
|
if (!firstSafeRealPathSyncRun) {
|
|
214
177
|
optimizeSafeRealPathSync();
|
|
215
178
|
firstSafeRealPathSyncRun = true;
|
|
216
179
|
}
|
|
217
|
-
return _fs2.default.realpathSync(
|
|
180
|
+
return _fs2.default.realpathSync(path6);
|
|
218
181
|
}
|
|
219
182
|
function optimizeSafeRealPathSync() {
|
|
220
183
|
const nodeVersion = _process2.default.versions.node.split(".").map(Number);
|
|
@@ -267,7 +230,7 @@ function getNpmPackageName(importPath) {
|
|
|
267
230
|
}
|
|
268
231
|
}
|
|
269
232
|
var dynamicImport = async (id, { format }) => {
|
|
270
|
-
const fn = format === "esm" ? (file) => Promise.resolve().then(() => _interopRequireWildcard(require(file))) : false ? _module.createRequire.call(void 0,
|
|
233
|
+
const fn = format === "esm" ? (file) => Promise.resolve().then(() => _interopRequireWildcard(require(file))) : false ? _module.createRequire.call(void 0, importMetaUrl) : __require;
|
|
271
234
|
return fn(id);
|
|
272
235
|
};
|
|
273
236
|
|
|
@@ -275,7 +238,7 @@ var dynamicImport = async (id, { format }) => {
|
|
|
275
238
|
var pnp;
|
|
276
239
|
if (_process2.default.versions.pnp) {
|
|
277
240
|
try {
|
|
278
|
-
pnp = _module.createRequire.call(void 0,
|
|
241
|
+
pnp = _module.createRequire.call(void 0, importMetaUrl)("pnpapi");
|
|
279
242
|
} catch (e5) {
|
|
280
243
|
}
|
|
281
244
|
}
|
|
@@ -844,8 +807,8 @@ function mapWithBrowserField(relativePathInPkgDir, map) {
|
|
|
844
807
|
}
|
|
845
808
|
}
|
|
846
809
|
}
|
|
847
|
-
function equalWithoutSuffix(
|
|
848
|
-
return key.endsWith(suffix) && key.slice(0, -suffix.length) ===
|
|
810
|
+
function equalWithoutSuffix(path6, key, suffix) {
|
|
811
|
+
return key.endsWith(suffix) && key.slice(0, -suffix.length) === path6;
|
|
849
812
|
}
|
|
850
813
|
function tryResolveRealFile(file, preserveSymlinks) {
|
|
851
814
|
const stat = tryStatSync(file);
|
|
@@ -876,8 +839,8 @@ function getRealPath(resolved, preserveSymlinks) {
|
|
|
876
839
|
}
|
|
877
840
|
return normalizePath(resolved);
|
|
878
841
|
}
|
|
879
|
-
function isDirectory(
|
|
880
|
-
const stat = tryStatSync(
|
|
842
|
+
function isDirectory(path6) {
|
|
843
|
+
const stat = tryStatSync(path6);
|
|
881
844
|
return _nullishCoalesce(_optionalChain([stat, 'optionalAccess', _36 => _36.isDirectory, 'call', _37 => _37()]), () => ( false));
|
|
882
845
|
}
|
|
883
846
|
|
|
@@ -913,7 +876,7 @@ async function bundleFile(fileName, options) {
|
|
|
913
876
|
const { isESM } = options;
|
|
914
877
|
const isModuleSyncConditionEnabled = (await Promise.resolve().then(() => _interopRequireWildcard(require(
|
|
915
878
|
// @ts-ignore
|
|
916
|
-
"
|
|
879
|
+
"#module-sync-enabled"
|
|
917
880
|
)))).default;
|
|
918
881
|
const dirnameVarName = "__vite_injected_original_dirname";
|
|
919
882
|
const filenameVarName = "__vite_injected_original_filename";
|
|
@@ -1053,7 +1016,7 @@ async function bundleFile(fileName, options) {
|
|
|
1053
1016
|
dependencies: [...allModules]
|
|
1054
1017
|
};
|
|
1055
1018
|
}
|
|
1056
|
-
var _require2 = _module.createRequire.call(void 0,
|
|
1019
|
+
var _require2 = _module.createRequire.call(void 0, importMetaUrl);
|
|
1057
1020
|
async function loadFromBundledFile(fileName, bundledCode, options) {
|
|
1058
1021
|
const { isESM } = options;
|
|
1059
1022
|
if (isESM) {
|
package/dist/index.mjs
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import "./chunk-WUKYLWAZ.mjs";
|
|
2
|
-
|
|
3
1
|
// src/index.ts
|
|
4
2
|
import fs4 from "fs";
|
|
5
|
-
import
|
|
3
|
+
import fsp from "fs/promises";
|
|
6
4
|
import { createRequire as createRequire3 } from "module";
|
|
7
|
-
import
|
|
5
|
+
import path5 from "path";
|
|
8
6
|
import process4 from "process";
|
|
9
7
|
import { pathToFileURL } from "url";
|
|
10
8
|
import { promisify } from "util";
|
|
@@ -14,63 +12,27 @@ import { rolldown } from "rolldown";
|
|
|
14
12
|
// src/packages.ts
|
|
15
13
|
import fs2 from "fs";
|
|
16
14
|
import { createRequire as createRequire2 } from "module";
|
|
17
|
-
import
|
|
15
|
+
import path2 from "path";
|
|
18
16
|
import process3 from "process";
|
|
19
17
|
|
|
20
18
|
// src/utils.ts
|
|
21
19
|
import { exec } from "child_process";
|
|
22
20
|
import crypto from "crypto";
|
|
23
|
-
import { promises as dns } from "dns";
|
|
24
21
|
import fs from "fs";
|
|
25
|
-
import fsp from "fs/promises";
|
|
26
22
|
import { builtinModules, createRequire } from "module";
|
|
27
|
-
import
|
|
23
|
+
import path from "path";
|
|
28
24
|
import process2 from "process";
|
|
29
|
-
import { fileURLToPath
|
|
25
|
+
import { fileURLToPath, URL as URL2 } from "url";
|
|
30
26
|
import { createFilter as _createFilter } from "@rollup/pluginutils";
|
|
31
27
|
|
|
32
28
|
// src/constants.ts
|
|
33
29
|
import { readFileSync } from "fs";
|
|
34
|
-
import path, { resolve } from "path";
|
|
35
|
-
import { fileURLToPath } from "url";
|
|
36
30
|
var { version } = JSON.parse(
|
|
37
31
|
readFileSync(new URL("../package.json", import.meta.url)).toString()
|
|
38
32
|
);
|
|
39
|
-
var DEFAULT_MAIN_FIELDS = [
|
|
40
|
-
"browser",
|
|
41
|
-
"module",
|
|
42
|
-
"jsnext:main",
|
|
43
|
-
// moment still uses this...
|
|
44
|
-
"jsnext"
|
|
45
|
-
];
|
|
46
|
-
var DEFAULT_CLIENT_MAIN_FIELDS = Object.freeze(DEFAULT_MAIN_FIELDS);
|
|
47
|
-
var DEFAULT_SERVER_MAIN_FIELDS = Object.freeze(
|
|
48
|
-
DEFAULT_MAIN_FIELDS.filter((f) => f !== "browser")
|
|
49
|
-
);
|
|
50
33
|
var DEV_PROD_CONDITION = `development|production`;
|
|
51
|
-
var DEFAULT_CONDITIONS = ["module", "browser", "node", DEV_PROD_CONDITION];
|
|
52
|
-
var DEFAULT_CLIENT_CONDITIONS = Object.freeze(
|
|
53
|
-
DEFAULT_CONDITIONS.filter((c) => c !== "node")
|
|
54
|
-
);
|
|
55
|
-
var DEFAULT_SERVER_CONDITIONS = Object.freeze(
|
|
56
|
-
DEFAULT_CONDITIONS.filter((c) => c !== "browser")
|
|
57
|
-
);
|
|
58
34
|
var OPTIMIZABLE_ENTRY_RE = /\.[cm]?[jt]s$/;
|
|
59
35
|
var SPECIAL_QUERY_RE = /[?&](?:worker|sharedworker|raw|url)\b/;
|
|
60
|
-
var FS_PREFIX = `/@fs/`;
|
|
61
|
-
var CLIENT_PUBLIC_PATH = `/@vite/client`;
|
|
62
|
-
var ENV_PUBLIC_PATH = `/@vite/env`;
|
|
63
|
-
var VITE_PACKAGE_DIR = resolve(
|
|
64
|
-
// import.meta.url is `dist/node/constants.js` after bundle
|
|
65
|
-
fileURLToPath(import.meta.url),
|
|
66
|
-
"../../.."
|
|
67
|
-
);
|
|
68
|
-
var CLIENT_ENTRY = resolve(VITE_PACKAGE_DIR, "dist/client/client.mjs");
|
|
69
|
-
var ENV_ENTRY = resolve(VITE_PACKAGE_DIR, "dist/client/env.mjs");
|
|
70
|
-
var CLIENT_DIR = path.dirname(CLIENT_ENTRY);
|
|
71
|
-
var VALID_ID_PREFIX = `/@id/`;
|
|
72
|
-
var SOURCEMAPPING_URL = "sourceMa";
|
|
73
|
-
SOURCEMAPPING_URL += "ppingURL";
|
|
74
36
|
|
|
75
37
|
// src/sharedUtils.ts
|
|
76
38
|
import process from "process";
|
|
@@ -83,9 +45,9 @@ var postfixRE = /[?#].*$/;
|
|
|
83
45
|
function cleanUrl(url) {
|
|
84
46
|
return url.replace(postfixRE, "");
|
|
85
47
|
}
|
|
86
|
-
function splitFileAndPostfix(
|
|
87
|
-
const file = cleanUrl(
|
|
88
|
-
return { file, postfix:
|
|
48
|
+
function splitFileAndPostfix(path6) {
|
|
49
|
+
const file = cleanUrl(path6);
|
|
50
|
+
return { file, postfix: path6.slice(file.length) };
|
|
89
51
|
}
|
|
90
52
|
var AsyncFunction = async function() {
|
|
91
53
|
}.constructor;
|
|
@@ -141,25 +103,18 @@ function isOptimizable(id, optimizeDeps) {
|
|
|
141
103
|
var bareImportRE = /^(?![a-z]:)[\w@](?!.*:\/\/)/i;
|
|
142
104
|
var deepImportRE = /^([^@][^/]*)\/|^(@[^/]+\/[^/]+)\//;
|
|
143
105
|
var _require = createRequire(import.meta.url);
|
|
144
|
-
var _dirname =
|
|
145
|
-
var urlCanParse = URL2.canParse ?? ((
|
|
106
|
+
var _dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
107
|
+
var urlCanParse = URL2.canParse ?? ((path6, base) => {
|
|
146
108
|
try {
|
|
147
|
-
new URL2(
|
|
109
|
+
new URL2(path6, base);
|
|
148
110
|
return true;
|
|
149
111
|
} catch {
|
|
150
112
|
return false;
|
|
151
113
|
}
|
|
152
114
|
});
|
|
153
115
|
function normalizePath(id) {
|
|
154
|
-
return
|
|
116
|
+
return path.posix.normalize(isWindows ? slash(id) : id);
|
|
155
117
|
}
|
|
156
|
-
var internalPrefixes = [
|
|
157
|
-
FS_PREFIX,
|
|
158
|
-
VALID_ID_PREFIX,
|
|
159
|
-
CLIENT_PUBLIC_PATH,
|
|
160
|
-
ENV_PUBLIC_PATH
|
|
161
|
-
];
|
|
162
|
-
var InternalPrefixRE = new RegExp(`^(?:${internalPrefixes.join("|")})`);
|
|
163
118
|
function injectQuery(url, queryToInject) {
|
|
164
119
|
const { file, postfix } = splitFileAndPostfix(url);
|
|
165
120
|
const normalizedFile = isWindows ? slash(file) : file;
|
|
@@ -184,7 +139,7 @@ function isFilePathESM(filePath, packageCache) {
|
|
|
184
139
|
return false;
|
|
185
140
|
} else {
|
|
186
141
|
try {
|
|
187
|
-
const pkg = findNearestPackageData(
|
|
142
|
+
const pkg = findNearestPackageData(path.dirname(filePath), packageCache);
|
|
188
143
|
return pkg?.data.type === "module";
|
|
189
144
|
} catch {
|
|
190
145
|
return false;
|
|
@@ -193,8 +148,8 @@ function isFilePathESM(filePath, packageCache) {
|
|
|
193
148
|
}
|
|
194
149
|
var safeRealpathSync = isWindows ? windowsSafeRealPathSync : fs.realpathSync.native;
|
|
195
150
|
var windowsNetworkMap = /* @__PURE__ */ new Map();
|
|
196
|
-
function windowsMappedRealpathSync(
|
|
197
|
-
const realPath = fs.realpathSync.native(
|
|
151
|
+
function windowsMappedRealpathSync(path6) {
|
|
152
|
+
const realPath = fs.realpathSync.native(path6);
|
|
198
153
|
if (realPath.startsWith("\\\\")) {
|
|
199
154
|
for (const [network, volume] of windowsNetworkMap) {
|
|
200
155
|
if (realPath.startsWith(network)) {
|
|
@@ -206,12 +161,12 @@ function windowsMappedRealpathSync(path7) {
|
|
|
206
161
|
}
|
|
207
162
|
var parseNetUseRE = /^\w* +(\w:) +([^ ]+)\s/;
|
|
208
163
|
var firstSafeRealPathSyncRun = false;
|
|
209
|
-
function windowsSafeRealPathSync(
|
|
164
|
+
function windowsSafeRealPathSync(path6) {
|
|
210
165
|
if (!firstSafeRealPathSyncRun) {
|
|
211
166
|
optimizeSafeRealPathSync();
|
|
212
167
|
firstSafeRealPathSyncRun = true;
|
|
213
168
|
}
|
|
214
|
-
return fs.realpathSync(
|
|
169
|
+
return fs.realpathSync(path6);
|
|
215
170
|
}
|
|
216
171
|
function optimizeSafeRealPathSync() {
|
|
217
172
|
const nodeVersion = process2.versions.node.split(".").map(Number);
|
|
@@ -220,7 +175,7 @@ function optimizeSafeRealPathSync() {
|
|
|
220
175
|
return;
|
|
221
176
|
}
|
|
222
177
|
try {
|
|
223
|
-
fs.realpathSync.native(
|
|
178
|
+
fs.realpathSync.native(path.resolve("./"));
|
|
224
179
|
} catch (error) {
|
|
225
180
|
if (error.message.includes("EISDIR: illegal operation on a directory")) {
|
|
226
181
|
safeRealpathSync = fs.realpathSync;
|
|
@@ -289,7 +244,7 @@ function resolvePackageData(pkgName, basedir, preserveSymlinks = false, packageC
|
|
|
289
244
|
if (!pkg) {
|
|
290
245
|
return null;
|
|
291
246
|
}
|
|
292
|
-
const pkgData = loadPackageData(
|
|
247
|
+
const pkgData = loadPackageData(path2.join(pkg, "package.json"));
|
|
293
248
|
packageCache?.set(cacheKey, pkgData);
|
|
294
249
|
return pkgData;
|
|
295
250
|
} catch {
|
|
@@ -310,7 +265,7 @@ function resolvePackageData(pkgName, basedir, preserveSymlinks = false, packageC
|
|
|
310
265
|
return cached;
|
|
311
266
|
}
|
|
312
267
|
}
|
|
313
|
-
const pkg =
|
|
268
|
+
const pkg = path2.join(basedir, "node_modules", pkgName, "package.json");
|
|
314
269
|
try {
|
|
315
270
|
if (fs2.existsSync(pkg)) {
|
|
316
271
|
const pkgPath = preserveSymlinks ? pkg : safeRealpathSync(pkg);
|
|
@@ -329,7 +284,7 @@ function resolvePackageData(pkgName, basedir, preserveSymlinks = false, packageC
|
|
|
329
284
|
}
|
|
330
285
|
} catch {
|
|
331
286
|
}
|
|
332
|
-
const nextBasedir =
|
|
287
|
+
const nextBasedir = path2.dirname(basedir);
|
|
333
288
|
if (nextBasedir === basedir) {
|
|
334
289
|
break;
|
|
335
290
|
}
|
|
@@ -346,7 +301,7 @@ function findNearestPackageData(basedir, packageCache) {
|
|
|
346
301
|
return cached;
|
|
347
302
|
}
|
|
348
303
|
}
|
|
349
|
-
const pkgPath =
|
|
304
|
+
const pkgPath = path2.join(basedir, "package.json");
|
|
350
305
|
if (tryStatSync(pkgPath)?.isFile()) {
|
|
351
306
|
try {
|
|
352
307
|
const pkgData = loadPackageData(pkgPath);
|
|
@@ -357,7 +312,7 @@ function findNearestPackageData(basedir, packageCache) {
|
|
|
357
312
|
} catch {
|
|
358
313
|
}
|
|
359
314
|
}
|
|
360
|
-
const nextBasedir =
|
|
315
|
+
const nextBasedir = path2.dirname(basedir);
|
|
361
316
|
if (nextBasedir === basedir) {
|
|
362
317
|
break;
|
|
363
318
|
}
|
|
@@ -368,13 +323,13 @@ function findNearestPackageData(basedir, packageCache) {
|
|
|
368
323
|
function findNearestMainPackageData(basedir, packageCache) {
|
|
369
324
|
const nearestPackage = findNearestPackageData(basedir, packageCache);
|
|
370
325
|
return nearestPackage && (nearestPackage.data.name ? nearestPackage : findNearestMainPackageData(
|
|
371
|
-
|
|
326
|
+
path2.dirname(nearestPackage.dir),
|
|
372
327
|
packageCache
|
|
373
328
|
));
|
|
374
329
|
}
|
|
375
330
|
function loadPackageData(pkgPath) {
|
|
376
331
|
const data = JSON.parse(stripBomTag(fs2.readFileSync(pkgPath, "utf-8")));
|
|
377
|
-
const pkgDir = normalizePath(
|
|
332
|
+
const pkgDir = normalizePath(path2.dirname(pkgPath));
|
|
378
333
|
const { sideEffects } = data;
|
|
379
334
|
let hasSideEffects;
|
|
380
335
|
if (typeof sideEffects === "boolean") {
|
|
@@ -421,11 +376,11 @@ function getResolveCacheKey(key, options) {
|
|
|
421
376
|
}
|
|
422
377
|
function findNearestNodeModules(basedir) {
|
|
423
378
|
while (basedir) {
|
|
424
|
-
const pkgPath =
|
|
379
|
+
const pkgPath = path2.join(basedir, "node_modules");
|
|
425
380
|
if (tryStatSync(pkgPath)?.isDirectory()) {
|
|
426
381
|
return pkgPath;
|
|
427
382
|
}
|
|
428
|
-
const nextBasedir =
|
|
383
|
+
const nextBasedir = path2.dirname(basedir);
|
|
429
384
|
if (nextBasedir === basedir) {
|
|
430
385
|
break;
|
|
431
386
|
}
|
|
@@ -474,20 +429,20 @@ function getFnpdCacheKey(basedir) {
|
|
|
474
429
|
function traverseBetweenDirs(longerDir, shorterDir, cb) {
|
|
475
430
|
while (longerDir !== shorterDir) {
|
|
476
431
|
cb(longerDir);
|
|
477
|
-
longerDir =
|
|
432
|
+
longerDir = path2.dirname(longerDir);
|
|
478
433
|
}
|
|
479
434
|
}
|
|
480
435
|
|
|
481
436
|
// src/plugins/resolve.ts
|
|
482
437
|
import fs3 from "fs";
|
|
483
|
-
import
|
|
438
|
+
import path4 from "path";
|
|
484
439
|
import { hasESMSyntax } from "mlly";
|
|
485
440
|
import { exports, imports } from "resolve.exports";
|
|
486
441
|
|
|
487
442
|
// src/external.ts
|
|
488
|
-
import
|
|
443
|
+
import path3 from "path";
|
|
489
444
|
function canExternalizeFile(filePath) {
|
|
490
|
-
const ext =
|
|
445
|
+
const ext = path3.extname(filePath);
|
|
491
446
|
return !ext || ext === ".js" || ext === ".mjs" || ext === ".cjs";
|
|
492
447
|
}
|
|
493
448
|
|
|
@@ -524,10 +479,10 @@ function tryCleanFsResolve(file, options, tryIndex = true, skipPackageJson = fal
|
|
|
524
479
|
let res;
|
|
525
480
|
const possibleJsToTs = isPossibleTsOutput(file);
|
|
526
481
|
if (possibleJsToTs || options.extensions.length || tryPrefix) {
|
|
527
|
-
const dirPath =
|
|
482
|
+
const dirPath = path4.dirname(file);
|
|
528
483
|
if (isDirectory(dirPath)) {
|
|
529
484
|
if (possibleJsToTs) {
|
|
530
|
-
const fileExt =
|
|
485
|
+
const fileExt = path4.extname(file);
|
|
531
486
|
const fileName = file.slice(0, -fileExt.length);
|
|
532
487
|
if (res = tryResolveRealFile(
|
|
533
488
|
fileName + fileExt.replace("js", "ts"),
|
|
@@ -547,7 +502,7 @@ function tryCleanFsResolve(file, options, tryIndex = true, skipPackageJson = fal
|
|
|
547
502
|
return res;
|
|
548
503
|
}
|
|
549
504
|
if (tryPrefix) {
|
|
550
|
-
const prefixed = `${dirPath}/${options.tryPrefix}${
|
|
505
|
+
const prefixed = `${dirPath}/${options.tryPrefix}${path4.basename(file)}`;
|
|
551
506
|
if (res = tryResolveRealFile(prefixed, preserveSymlinks)) {
|
|
552
507
|
return res;
|
|
553
508
|
}
|
|
@@ -604,8 +559,8 @@ function tryNodeResolve(id, importer, options, depsOptimizer, externalize) {
|
|
|
604
559
|
let basedir;
|
|
605
560
|
if (dedupe.includes(pkgId)) {
|
|
606
561
|
basedir = root;
|
|
607
|
-
} else if (importer &&
|
|
608
|
-
basedir =
|
|
562
|
+
} else if (importer && path4.isAbsolute(importer) && (importer.endsWith("*") || fs3.existsSync(cleanUrl(importer)))) {
|
|
563
|
+
basedir = path4.dirname(importer);
|
|
609
564
|
} else {
|
|
610
565
|
basedir = root;
|
|
611
566
|
}
|
|
@@ -644,7 +599,7 @@ function tryNodeResolve(id, importer, options, depsOptimizer, externalize) {
|
|
|
644
599
|
return resolved2;
|
|
645
600
|
}
|
|
646
601
|
let resolvedId = id;
|
|
647
|
-
if (deepMatch && !pkg.data.exports &&
|
|
602
|
+
if (deepMatch && !pkg.data.exports && path4.extname(id) !== path4.extname(resolved2.id)) {
|
|
648
603
|
const index = resolved2.id.indexOf(id);
|
|
649
604
|
if (index > -1) {
|
|
650
605
|
resolvedId = resolved2.id.slice(index);
|
|
@@ -703,7 +658,7 @@ function resolvePackageEntry(id, { dir, data, setResolvedCache, getResolvedCache
|
|
|
703
658
|
const entryPoints = entryPoint ? [entryPoint] : ["index.js", "index.json", "index.node"];
|
|
704
659
|
for (let entry of entryPoints) {
|
|
705
660
|
let skipPackageJson = false;
|
|
706
|
-
if (options.mainFields[0] === "sass" && !options.extensions.includes(
|
|
661
|
+
if (options.mainFields[0] === "sass" && !options.extensions.includes(path4.extname(entry))) {
|
|
707
662
|
entry = "";
|
|
708
663
|
skipPackageJson = true;
|
|
709
664
|
} else {
|
|
@@ -712,7 +667,7 @@ function resolvePackageEntry(id, { dir, data, setResolvedCache, getResolvedCache
|
|
|
712
667
|
entry = mapWithBrowserField(entry, browserField) || entry;
|
|
713
668
|
}
|
|
714
669
|
}
|
|
715
|
-
const entryPointPath =
|
|
670
|
+
const entryPointPath = path4.join(dir, entry);
|
|
716
671
|
const resolvedEntryPoint = tryFsResolve(
|
|
717
672
|
entryPointPath,
|
|
718
673
|
options,
|
|
@@ -785,7 +740,7 @@ function resolveDeepImport(id, { setResolvedCache, getResolvedCache, dir, data }
|
|
|
785
740
|
}
|
|
786
741
|
if (!relativeId) {
|
|
787
742
|
throw new Error(
|
|
788
|
-
`Package subpath '${relativeId}' is not defined by "exports" in ${
|
|
743
|
+
`Package subpath '${relativeId}' is not defined by "exports" in ${path4.join(dir, "package.json")}.`
|
|
789
744
|
);
|
|
790
745
|
}
|
|
791
746
|
} else if (options.mainFields.includes("browser") && isObject(browserField)) {
|
|
@@ -800,7 +755,7 @@ function resolveDeepImport(id, { setResolvedCache, getResolvedCache, dir, data }
|
|
|
800
755
|
}
|
|
801
756
|
if (relativeId) {
|
|
802
757
|
const resolved = tryFsResolve(
|
|
803
|
-
|
|
758
|
+
path4.join(dir, relativeId),
|
|
804
759
|
options,
|
|
805
760
|
!exportsField
|
|
806
761
|
// try index only if no exports field
|
|
@@ -816,7 +771,7 @@ function tryResolveBrowserEntry(dir, data, options) {
|
|
|
816
771
|
if (browserEntry) {
|
|
817
772
|
if (!options.isRequire && options.mainFields.includes("module") && typeof data.module === "string" && data.module !== browserEntry) {
|
|
818
773
|
const resolvedBrowserEntry = tryFsResolve(
|
|
819
|
-
|
|
774
|
+
path4.join(dir, browserEntry),
|
|
820
775
|
options
|
|
821
776
|
);
|
|
822
777
|
if (resolvedBrowserEntry) {
|
|
@@ -833,16 +788,16 @@ function tryResolveBrowserEntry(dir, data, options) {
|
|
|
833
788
|
}
|
|
834
789
|
}
|
|
835
790
|
function mapWithBrowserField(relativePathInPkgDir, map) {
|
|
836
|
-
const normalizedPath =
|
|
791
|
+
const normalizedPath = path4.posix.normalize(relativePathInPkgDir);
|
|
837
792
|
for (const key in map) {
|
|
838
|
-
const normalizedKey =
|
|
793
|
+
const normalizedKey = path4.posix.normalize(key);
|
|
839
794
|
if (normalizedPath === normalizedKey || equalWithoutSuffix(normalizedPath, normalizedKey, ".js") || equalWithoutSuffix(normalizedPath, normalizedKey, "/index.js")) {
|
|
840
795
|
return map[key];
|
|
841
796
|
}
|
|
842
797
|
}
|
|
843
798
|
}
|
|
844
|
-
function equalWithoutSuffix(
|
|
845
|
-
return key.endsWith(suffix) && key.slice(0, -suffix.length) ===
|
|
799
|
+
function equalWithoutSuffix(path6, key, suffix) {
|
|
800
|
+
return key.endsWith(suffix) && key.slice(0, -suffix.length) === path6;
|
|
846
801
|
}
|
|
847
802
|
function tryResolveRealFile(file, preserveSymlinks) {
|
|
848
803
|
const stat = tryStatSync(file);
|
|
@@ -873,8 +828,8 @@ function getRealPath(resolved, preserveSymlinks) {
|
|
|
873
828
|
}
|
|
874
829
|
return normalizePath(resolved);
|
|
875
830
|
}
|
|
876
|
-
function isDirectory(
|
|
877
|
-
const stat = tryStatSync(
|
|
831
|
+
function isDirectory(path6) {
|
|
832
|
+
const stat = tryStatSync(path6);
|
|
878
833
|
return stat?.isDirectory() ?? false;
|
|
879
834
|
}
|
|
880
835
|
|
|
@@ -910,7 +865,7 @@ async function bundleFile(fileName, options) {
|
|
|
910
865
|
const { isESM } = options;
|
|
911
866
|
const isModuleSyncConditionEnabled = (await import(
|
|
912
867
|
// @ts-ignore
|
|
913
|
-
"
|
|
868
|
+
"#module-sync-enabled"
|
|
914
869
|
)).default;
|
|
915
870
|
const dirnameVarName = "__vite_injected_original_dirname";
|
|
916
871
|
const filenameVarName = "__vite_injected_original_filename";
|
|
@@ -939,7 +894,7 @@ async function bundleFile(fileName, options) {
|
|
|
939
894
|
const packageCache = /* @__PURE__ */ new Map();
|
|
940
895
|
const resolveByViteResolver = (id, importer, isRequire) => {
|
|
941
896
|
return tryNodeResolve(id, importer, {
|
|
942
|
-
root:
|
|
897
|
+
root: path5.dirname(fileName),
|
|
943
898
|
isBuild: true,
|
|
944
899
|
isProduction: true,
|
|
945
900
|
preferRelative: false,
|
|
@@ -965,7 +920,7 @@ async function bundleFile(fileName, options) {
|
|
|
965
920
|
resolveId: {
|
|
966
921
|
filter: { id: /^[^.#].*/ },
|
|
967
922
|
async handler(id, importer, { kind }) {
|
|
968
|
-
if (!importer ||
|
|
923
|
+
if (!importer || path5.isAbsolute(id) || isNodeBuiltin(id)) {
|
|
969
924
|
return;
|
|
970
925
|
}
|
|
971
926
|
if (isNodeLikeBuiltin(id)) {
|
|
@@ -1015,7 +970,7 @@ async function bundleFile(fileName, options) {
|
|
|
1015
970
|
transform: {
|
|
1016
971
|
filter: { id: /\.[cm]?[jt]s$/ },
|
|
1017
972
|
async handler(code, id) {
|
|
1018
|
-
const injectValues = `const ${dirnameVarName} = ${JSON.stringify(
|
|
973
|
+
const injectValues = `const ${dirnameVarName} = ${JSON.stringify(path5.dirname(id))};const ${filenameVarName} = ${JSON.stringify(id)};const ${importMetaUrlVarName} = ${JSON.stringify(
|
|
1019
974
|
pathToFileURL(id).href
|
|
1020
975
|
)};`;
|
|
1021
976
|
return { code: injectValues + code, map: null };
|
|
@@ -1030,7 +985,7 @@ async function bundleFile(fileName, options) {
|
|
|
1030
985
|
format: options.format,
|
|
1031
986
|
sourcemap: "inline",
|
|
1032
987
|
sourcemapPathTransform(relative) {
|
|
1033
|
-
return
|
|
988
|
+
return path5.resolve(fileName, relative);
|
|
1034
989
|
},
|
|
1035
990
|
// we want to generate a single chunk like esbuild does with `splitting: false`
|
|
1036
991
|
inlineDynamicImports: true
|
|
@@ -1054,10 +1009,10 @@ var _require2 = createRequire3(import.meta.url);
|
|
|
1054
1009
|
async function loadFromBundledFile(fileName, bundledCode, options) {
|
|
1055
1010
|
const { isESM } = options;
|
|
1056
1011
|
if (isESM) {
|
|
1057
|
-
let nodeModulesDir = typeof process4.versions.deno === "string" ? void 0 : findNearestNodeModules(
|
|
1012
|
+
let nodeModulesDir = typeof process4.versions.deno === "string" ? void 0 : findNearestNodeModules(path5.dirname(fileName));
|
|
1058
1013
|
if (nodeModulesDir) {
|
|
1059
1014
|
try {
|
|
1060
|
-
await
|
|
1015
|
+
await fsp.mkdir(path5.resolve(nodeModulesDir, ".vite-temp/"), {
|
|
1061
1016
|
recursive: true
|
|
1062
1017
|
});
|
|
1063
1018
|
} catch (e) {
|
|
@@ -1069,13 +1024,13 @@ async function loadFromBundledFile(fileName, bundledCode, options) {
|
|
|
1069
1024
|
}
|
|
1070
1025
|
}
|
|
1071
1026
|
const hash2 = `timestamp-${Date.now()}-${Math.random().toString(16).slice(2)}`;
|
|
1072
|
-
const tempFileName = nodeModulesDir ?
|
|
1027
|
+
const tempFileName = nodeModulesDir ? path5.resolve(
|
|
1073
1028
|
nodeModulesDir,
|
|
1074
|
-
`.vite-temp/${
|
|
1029
|
+
`.vite-temp/${path5.basename(fileName)}.${hash2}.${isESM ? "mjs" : "cjs"}`
|
|
1075
1030
|
) : `${fileName}.${hash2}.mjs`;
|
|
1076
1031
|
const getOutputFile = options.getOutputFile || defaultGetOutputFile;
|
|
1077
1032
|
const outfile = getOutputFile(tempFileName, options.format);
|
|
1078
|
-
await
|
|
1033
|
+
await fsp.writeFile(outfile, bundledCode);
|
|
1079
1034
|
let mod;
|
|
1080
1035
|
const req = options.require || dynamicImport;
|
|
1081
1036
|
try {
|
|
@@ -1091,7 +1046,7 @@ async function loadFromBundledFile(fileName, bundledCode, options) {
|
|
|
1091
1046
|
}
|
|
1092
1047
|
}
|
|
1093
1048
|
} else {
|
|
1094
|
-
const extension =
|
|
1049
|
+
const extension = path5.extname(fileName);
|
|
1095
1050
|
const realFileName = await promisifiedRealpath(fileName);
|
|
1096
1051
|
const loaderExt = extension in _require2.extensions ? extension : ".js";
|
|
1097
1052
|
const defaultLoader = _require2.extensions[loaderExt];
|
|
@@ -1110,7 +1065,7 @@ async function loadFromBundledFile(fileName, bundledCode, options) {
|
|
|
1110
1065
|
}
|
|
1111
1066
|
}
|
|
1112
1067
|
async function bundleRequire(options) {
|
|
1113
|
-
const resolvedPath =
|
|
1068
|
+
const resolvedPath = path5.isAbsolute(options.filepath) ? options.filepath : path5.resolve(options.cwd || process4.cwd(), options.filepath);
|
|
1114
1069
|
const isESM = typeof process4.versions.deno === "string" || isFilePathESM(resolvedPath);
|
|
1115
1070
|
if (options.tsconfig !== false) {
|
|
1116
1071
|
options.tsconfig = options.tsconfig ?? getTsconfig(options.cwd, "tsconfig.json")?.path ?? void 0;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rolldown-require",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.1",
|
|
5
5
|
"description": "bundle and require a file using rolldown!",
|
|
6
6
|
"author": "ice breaker <1324318532@qq.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -13,8 +13,17 @@
|
|
|
13
13
|
"bugs": {
|
|
14
14
|
"url": "https://github.com/weapp-vite/weapp-vite/issues"
|
|
15
15
|
},
|
|
16
|
-
"keywords": [
|
|
17
|
-
|
|
16
|
+
"keywords": [
|
|
17
|
+
"require",
|
|
18
|
+
"rolldown",
|
|
19
|
+
"runtime",
|
|
20
|
+
"node",
|
|
21
|
+
"cjs",
|
|
22
|
+
"commonjs",
|
|
23
|
+
"esm",
|
|
24
|
+
"typescript",
|
|
25
|
+
"bundle"
|
|
26
|
+
],
|
|
18
27
|
"imports": {
|
|
19
28
|
"#module-sync-enabled": {
|
|
20
29
|
"module-sync": "./misc/true.js",
|
package/dist/chunk-Q6XJHTDB.cjs
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
2
|
-
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
3
|
-
}) : x)(function(x) {
|
|
4
|
-
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
5
|
-
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
6
|
-
});
|
|
7
|
-
|
|
8
|
-
// ../../node_modules/.pnpm/tsup@8.5.0_@swc+core@1.12.0_jiti@2.4.2_postcss@8.5.4_tsx@4.20.1_typescript@5.8.3_yaml@2.8.0/node_modules/tsup/assets/cjs_shims.js
|
|
9
|
-
var getImportMetaUrl = () => typeof document === "undefined" ? new URL(`file:${__filename}`).href : document.currentScript && document.currentScript.src || new URL("main.js", document.baseURI).href;
|
|
10
|
-
var importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
exports.__require = __require; exports.importMetaUrl = importMetaUrl;
|
package/dist/chunk-WUKYLWAZ.mjs
DELETED
|
File without changes
|
package/dist/false-G5OFYI37.mjs
DELETED
package/dist/false-SI6OY5LO.cjs
DELETED