dinou 9.3.0 → 10.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.
Files changed (166) hide show
  1. package/CHANGELOG.md +196 -0
  2. package/README.md +157 -132
  3. package/dinou/adapters/bun.js +34 -5
  4. package/dinou/adapters/cloudflare.js +110 -17
  5. package/dinou/adapters/deno.js +46 -8
  6. package/dinou/adapters/netlify.js +86 -50
  7. package/dinou/adapters/node.js +8 -0
  8. package/dinou/assets.d.ts +32 -5
  9. package/dinou/bun/build.js +190 -106
  10. package/dinou/cli.js +992 -532
  11. package/dinou/cloudflare/build.js +187 -106
  12. package/dinou/compiled/autoprefixer/index.js +509 -517
  13. package/dinou/compiled/babel-core/index.js +738 -716
  14. package/dinou/compiled/babel-generator/index.js +341 -299
  15. package/dinou/compiled/babel-loader/index.js +766 -744
  16. package/dinou/compiled/babel-parser/index.js +2 -2
  17. package/dinou/compiled/babel-plugin-react-compiler/index.js +178 -178
  18. package/dinou/compiled/babel-plugin-syntax-import-meta/index.js +4 -4
  19. package/dinou/compiled/babel-preset-react/index.js +752 -730
  20. package/dinou/compiled/babel-preset-typescript/index.js +738 -716
  21. package/dinou/compiled/babel-traverse/index.js +463 -433
  22. package/dinou/compiled/babel-types/index.js +176 -176
  23. package/dinou/compiled/chokidar/index.js +4 -4
  24. package/dinou/compiled/commander/index.js +15 -15
  25. package/dinou/compiled/copy-webpack-plugin/index.js +433 -425
  26. package/dinou/compiled/css-loader/index.js +289 -289
  27. package/dinou/compiled/css-loader/runtime/api.js +85 -0
  28. package/dinou/compiled/css-loader/runtime/getUrl.js +26 -0
  29. package/dinou/compiled/css-loader/runtime/noSourceMaps.js +5 -0
  30. package/dinou/compiled/css-loader/runtime/package.json +3 -0
  31. package/dinou/compiled/css-loader/runtime/sourceMaps.js +16 -0
  32. package/dinou/compiled/fast-glob/index.js +5810 -0
  33. package/dinou/compiled/generic-names/index.js +16 -16
  34. package/dinou/compiled/mini-css-extract-plugin/{chunk-YYEJWYXE.js → chunk-R6DP5ZYM.js} +36 -36
  35. package/dinou/compiled/mini-css-extract-plugin/hmr/hotModuleReplacement.js +253 -0
  36. package/dinou/compiled/mini-css-extract-plugin/hmr/normalize-url.js +39 -0
  37. package/dinou/compiled/mini-css-extract-plugin/hmr/package.json +3 -0
  38. package/dinou/compiled/mini-css-extract-plugin/index.js +1 -1
  39. package/dinou/compiled/mini-css-extract-plugin/loader.js +5 -5
  40. package/dinou/compiled/postcss/index.js +83 -83
  41. package/dinou/compiled/postcss-import/index.js +147 -117
  42. package/dinou/compiled/postcss-modules/index.js +216 -216
  43. package/dinou/compiled/resolve/index.js +1224 -0
  44. package/dinou/compiled/rollup-plugin-babel/index.js +753 -731
  45. package/dinou/compiled/rollup-plugin-commonjs/index.js +43 -38
  46. package/dinou/compiled/rollup-plugin-delete/index.js +615 -253
  47. package/dinou/compiled/rollup-plugin-json/index.js +22 -18
  48. package/dinou/compiled/rollup-plugin-node-resolve/index.js +130 -100
  49. package/dinou/compiled/rollup-plugin-postcss/index.js +3299 -3277
  50. package/dinou/compiled/rollup-plugin-replace/index.js +34 -29
  51. package/dinou/compiled/tailwindcss-postcss/index.js +214 -211
  52. package/dinou/compiled/vendors-manifest.json +59 -83
  53. package/dinou/core/asset-extensions.js +482 -33
  54. package/dinou/core/bailout-proxy.js +21 -2
  55. package/dinou/core/build-static-pages.js +523 -371
  56. package/dinou/core/builtin-asset-extensions.js +63 -0
  57. package/dinou/core/cache-revalidate.js +449 -256
  58. package/dinou/core/cache-slot.js +289 -79
  59. package/dinou/core/client-webpack.jsx +470 -39
  60. package/dinou/core/client.jsx +402 -39
  61. package/dinou/core/config.js +3 -0
  62. package/dinou/core/copy-static-dirs.js +98 -0
  63. package/dinou/core/createScopedName.js +22 -4
  64. package/dinou/core/dinou-paths.js +1 -1
  65. package/dinou/core/discover-layouts.js +200 -0
  66. package/dinou/core/edge-ssr.js +1 -1
  67. package/dinou/core/ensure-vendor-mode.js +78 -19
  68. package/dinou/core/env.js +544 -0
  69. package/dinou/core/export-static.js +41 -9
  70. package/dinou/core/generate-route-types.js +989 -95
  71. package/dinou/core/generate-static-rsc.js +5 -6
  72. package/dinou/core/generate-static.js +45 -6
  73. package/dinou/core/get-abs-path-with-ext.js +217 -75
  74. package/dinou/core/get-asset-from-manifest.js +19 -8
  75. package/dinou/core/get-error-jsx.js +4 -5
  76. package/dinou/core/get-file-path-and-dynamic-params.js +561 -338
  77. package/dinou/core/get-jsx.js +220 -53
  78. package/dinou/core/handler.js +1647 -466
  79. package/dinou/core/import-module.js +7 -0
  80. package/dinou/core/layout-functions.js +72 -13
  81. package/dinou/core/link.jsx +34 -6
  82. package/dinou/core/load-dinou-config.js +520 -89
  83. package/dinou/core/manifest-provider.js +4 -14
  84. package/dinou/core/navigation-utils.js +141 -3
  85. package/dinou/core/navigation.js +134 -50
  86. package/dinou/core/node-middleware-runner.js +165 -0
  87. package/dinou/core/postcss-pipeline.js +236 -0
  88. package/dinou/core/ppr-context.js +114 -22
  89. package/dinou/core/ppr-runtime.js +391 -127
  90. package/dinou/core/redirect.jsx +1 -1
  91. package/dinou/core/render-jsx-to-client-jsx.js +216 -48
  92. package/dinou/core/request-context.js +59 -3
  93. package/dinou/core/resolve-contextual-dinou.js +523 -0
  94. package/dinou/core/resolve-setup-files.js +85 -27
  95. package/dinou/core/revalidating.js +10 -2
  96. package/dinou/core/route-generator.js +6 -2
  97. package/dinou/core/rsc-renderer.js +4 -1
  98. package/dinou/core/run-ssg.js +6 -0
  99. package/dinou/core/runtime-env.js +265 -0
  100. package/dinou/core/server-css-modules-plugin.js +155 -0
  101. package/dinou/core/server-function-proxy-webpack.js +27 -2
  102. package/dinou/core/server-function-proxy.js +27 -2
  103. package/dinou/core/slot.js +47 -2
  104. package/dinou/core/static-assets.js +503 -0
  105. package/dinou/core/storage-adapter.js +452 -24
  106. package/dinou/core/transform-server-functions.js +272 -24
  107. package/dinou/core/tsconfig-aliases.js +964 -0
  108. package/dinou/core/uneject.js +640 -0
  109. package/dinou/core/url-resolver.js +1 -1
  110. package/dinou/core/vfs.js +11 -2
  111. package/dinou/css.d.ts +4 -1
  112. package/dinou/deno/build.js +205 -153
  113. package/dinou/deno/seed-kv.js +4 -0
  114. package/dinou/env.d.ts +22 -2
  115. package/dinou/esbuild/build.js +40 -50
  116. package/dinou/esbuild/dev.js +33 -7
  117. package/dinou/esbuild/helpers-esbuild/get-config-esbuild-prod.js +41 -16
  118. package/dinou/esbuild/helpers-esbuild/get-config-esbuild.js +51 -49
  119. package/dinou/esbuild/helpers-esbuild/get-esbuild-entries.js +73 -60
  120. package/dinou/esbuild/helpers-esbuild/swc-disk-cache.js +35 -16
  121. package/dinou/esbuild/helpers-esbuild/write.js +13 -3
  122. package/dinou/esbuild/plugins-esbuild/assets-plugin.js +100 -238
  123. package/dinou/esbuild/plugins-esbuild/babel-react-compiler-plugin.js +73 -29
  124. package/dinou/esbuild/plugins-esbuild/css-processor-plugin.js +283 -91
  125. package/dinou/esbuild/plugins-esbuild/manifest-generator-plugin.js +3 -5
  126. package/dinou/esbuild/plugins-esbuild/react-client-manifest-plugin.js +9 -3
  127. package/dinou/esbuild/plugins-esbuild/server-functions-plugin.js +4 -3
  128. package/dinou/esbuild/plugins-esbuild/stable-chunk-names-and-maps-plugin.js +10 -1
  129. package/dinou/esbuild/plugins-postcss/postcss-extract-plugin.js +84 -21
  130. package/dinou/esbuild/react-refresh/esm-hmr/client.js +31 -10
  131. package/dinou/esbuild/react-refresh/esm-hmr-plugin.js +48 -18
  132. package/dinou/esbuild/react-refresh/is-react-refresh-boundary.js +9 -1
  133. package/dinou/esbuild/react-refresh/react-refresh-runtime.js +13 -7
  134. package/dinou/index.d.ts +1028 -88
  135. package/dinou/node/build.js +138 -74
  136. package/dinou/node/bundle-dual-engine.js +393 -131
  137. package/dinou/node/dev.js +1005 -275
  138. package/dinou/package.json +11 -34
  139. package/dinou/rollup/postcss.config.js +3 -4
  140. package/dinou/rollup/react-refresh/esm-hmr/client.js +31 -10
  141. package/dinou/rollup/react-refresh/react-refresh-wrap-modules.js +16 -13
  142. package/dinou/rollup/react-refresh/rollup-plugin-esm-hmr.js +53 -7
  143. package/dinou/rollup/rollup-plugins/dinou-asset-plugin.js +58 -20
  144. package/dinou/rollup/rollup-plugins/manifest-generator-plugin.js +16 -7
  145. package/dinou/rollup/rollup-plugins/rollup-plugin-react-client-manifest.js +118 -42
  146. package/dinou/rollup/rollup-plugins/rollup-plugin-server-functions.js +48 -36
  147. package/dinou/rollup/rollup.config.js +174 -101
  148. package/dinou/scripts/build-vendors.js +123 -33
  149. package/dinou/server.d.ts +126 -15
  150. package/dinou/webpack/helpers/get-webpack-entries.js +87 -41
  151. package/dinou/webpack/helpers/patch-webpack-internals.js +93 -1
  152. package/dinou/webpack/loaders/server-functions-loader.js +1 -1
  153. package/dinou/webpack/plugins/manifest-generator-plugin.js +27 -7
  154. package/dinou/webpack/plugins/server-functions-plugin.js +39 -12
  155. package/dinou/webpack/plugins/webpack-memory-plugin.js +25 -12
  156. package/dinou/webpack/postcss.config.js +3 -4
  157. package/dinou/webpack/webpack.config.js +408 -132
  158. package/eject.js +6 -224
  159. package/package.json +7 -9
  160. package/dinou/compiled/cross-env/index.js +0 -661
  161. package/dinou/compiled/dotenv/index.js +0 -375
  162. package/dinou/compiled/esbuild-copy-static-files/index.js +0 -63
  163. package/dinou/compiled/esbuild-tsconfig-paths/index.js +0 -1314
  164. package/dinou/compiled/rollup-plugin-copy/index.js +0 -12066
  165. package/dinou/compiled/rollup-plugin-tsconfig-paths/index.js +0 -569
  166. package/dinou/compiled/tsconfig-paths-webpack-plugin/index.js +0 -3956
@@ -1,569 +0,0 @@
1
- import { createRequire as __dinou_createRequire } from "node:module";
2
- import { fileURLToPath as __dinou_fileURLToPath } from "node:url";
3
- import __dinou_path from "node:path";
4
- const require = __dinou_createRequire(import.meta.url);
5
- const __filename = __dinou_fileURLToPath(import.meta.url);
6
- const __dirname = __dinou_path.dirname(__filename);
7
- var __create = Object.create;
8
- var __defProp = Object.defineProperty;
9
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
10
- var __getOwnPropNames = Object.getOwnPropertyNames;
11
- var __getProtoOf = Object.getPrototypeOf;
12
- var __hasOwnProp = Object.prototype.hasOwnProperty;
13
- var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
14
- get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
15
- }) : x)(function(x) {
16
- if (typeof require !== "undefined") return require.apply(this, arguments);
17
- throw Error('Dynamic require of "' + x + '" is not supported');
18
- });
19
- var __commonJS = (cb, mod) => function __require2() {
20
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
21
- };
22
- var __copyProps = (to, from, except, desc) => {
23
- if (from && typeof from === "object" || typeof from === "function") {
24
- for (let key of __getOwnPropNames(from))
25
- if (!__hasOwnProp.call(to, key) && key !== except)
26
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
27
- }
28
- return to;
29
- };
30
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
31
- // If the importer is in node compatibility mode or this is not an ESM
32
- // file that has been converted to a CommonJS file using a Babel-
33
- // compatible transform (i.e. "__esModule" has not been set), then set
34
- // "default" to the CommonJS "module.exports" for node compatibility.
35
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
36
- mod
37
- ));
38
-
39
- // ../node_modules/typescript-paths/lib/core.js
40
- var require_core = __commonJS({
41
- "../node_modules/typescript-paths/lib/core.js"(exports) {
42
- "use strict";
43
- var Module = __require("module");
44
- var path2 = __require("path");
45
- var ts2 = __require("typescript");
46
- var fs2 = __require("fs");
47
- var LogLevel2 = /* @__PURE__ */ (function(LogLevel3) {
48
- LogLevel3[LogLevel3["None"] = 0] = "None";
49
- LogLevel3[LogLevel3["Error"] = 1] = "Error";
50
- LogLevel3[LogLevel3["Warning"] = 2] = "Warning";
51
- LogLevel3[LogLevel3["Info"] = 3] = "Info";
52
- LogLevel3[LogLevel3["Debug"] = 4] = "Debug";
53
- LogLevel3[LogLevel3["Trace"] = 5] = "Trace";
54
- return LogLevel3;
55
- })({});
56
- function convertLogLevel2(level) {
57
- switch (level) {
58
- case "none":
59
- return LogLevel2.None;
60
- case "error":
61
- return LogLevel2.Error;
62
- case "warn":
63
- return LogLevel2.Warning;
64
- case "info":
65
- return LogLevel2.Info;
66
- case "debug":
67
- return LogLevel2.Debug;
68
- case "trace":
69
- return LogLevel2.Trace;
70
- default:
71
- return void 0;
72
- }
73
- }
74
- var Reset = "\x1B[0m";
75
- var FgRed = "\x1B[31m";
76
- var FgYellow = "\x1B[33m";
77
- var FgBlue = "\x1B[34m";
78
- var FgCyan = "\x1B[36m";
79
- var FgMagenta = "\x1B[35m";
80
- function fromTYPESCRIPT_PATHS_LOG_LEVEL() {
81
- const env = process.env["TYPESCRIPT_PATHS_LOG_LEVEL"];
82
- switch (env) {
83
- case "none":
84
- return LogLevel2.None;
85
- case "error":
86
- return LogLevel2.Error;
87
- case "warn":
88
- return LogLevel2.Warning;
89
- case "info":
90
- return LogLevel2.Info;
91
- case "debug":
92
- return LogLevel2.Debug;
93
- case "trace":
94
- return LogLevel2.Trace;
95
- default:
96
- return void 0;
97
- }
98
- }
99
- function createLogger2({
100
- logLevel = fromTYPESCRIPT_PATHS_LOG_LEVEL() || LogLevel2.Info,
101
- colors = true,
102
- ID = "typescript-paths"
103
- } = {}) {
104
- return function log(level, ...args) {
105
- if (logLevel < level) {
106
- return;
107
- }
108
- if (ID) {
109
- args.unshift(`[${ID}]:`);
110
- }
111
- if (colors) {
112
- args = args.map((a) => {
113
- if (typeof a !== "string") return a;
114
- switch (level) {
115
- case LogLevel2.Error:
116
- return FgRed + a + Reset;
117
- case LogLevel2.Warning:
118
- return FgYellow + a + Reset;
119
- case LogLevel2.Info:
120
- return FgBlue + a + Reset;
121
- case LogLevel2.Debug:
122
- return FgCyan + a + Reset;
123
- case LogLevel2.Trace:
124
- return FgMagenta + a + Reset;
125
- }
126
- });
127
- }
128
- switch (level) {
129
- case LogLevel2.Error:
130
- console.error(...args);
131
- break;
132
- case LogLevel2.Warning:
133
- console.warn(...args);
134
- break;
135
- case LogLevel2.Info:
136
- console.info(...args);
137
- break;
138
- case LogLevel2.Debug:
139
- console.log(...args);
140
- break;
141
- case LogLevel2.Trace:
142
- console.log(...args);
143
- break;
144
- }
145
- };
146
- }
147
- function getTsConfig({
148
- tsConfigPath,
149
- log = createLogger2(),
150
- host = ts2.sys
151
- }) {
152
- const {
153
- error,
154
- config
155
- } = ts2.readConfigFile(tsConfigPath, host.readFile);
156
- if (error) {
157
- let hasError = false;
158
- switch (error.category) {
159
- case ts2.DiagnosticCategory.Error:
160
- log(LogLevel2.Error, error.messageText);
161
- hasError = true;
162
- break;
163
- }
164
- if (hasError) return void 0;
165
- }
166
- let {
167
- options: compilerOptions,
168
- errors,
169
- fileNames,
170
- projectReferences
171
- } = ts2.parseJsonConfigFileContent(config, host, path2.resolve(path2.dirname(tsConfigPath)));
172
- if (errors.length > 0) {
173
- let hasError = false;
174
- for (const error2 of errors) {
175
- switch (error2.category) {
176
- case ts2.DiagnosticCategory.Error:
177
- log(LogLevel2.Error, error2.messageText);
178
- hasError = true;
179
- break;
180
- }
181
- }
182
- if (hasError) return void 0;
183
- }
184
- const ret = {
185
- filePath: path2.resolve(tsConfigPath),
186
- compilerOptions,
187
- fileNames: fileNames.map(path2.normalize),
188
- extends: config.extends
189
- };
190
- if (projectReferences) {
191
- ret.references = [];
192
- for (const r of projectReferences) {
193
- let tsConfigPath2 = r.path;
194
- try {
195
- const stat = fs2.lstatSync(tsConfigPath2);
196
- if (stat.isDirectory()) {
197
- tsConfigPath2 = path2.join(tsConfigPath2, "tsconfig.json");
198
- }
199
- } catch (err) {
200
- const error2 = err;
201
- log(LogLevel2.Error, error2.message);
202
- return void 0;
203
- }
204
- const cfg = getTsConfig({
205
- tsConfigPath: tsConfigPath2,
206
- log,
207
- host
208
- });
209
- if (cfg) ret.references.push(cfg);
210
- }
211
- }
212
- return ret;
213
- }
214
- function createMappings({
215
- paths,
216
- log = createLogger2(),
217
- respectCoreModule = true
218
- }) {
219
- const countWildcard = (value) => value.match(/\*/g)?.length ?? 0;
220
- const mappings = [];
221
- for (const pattern of Object.keys(paths)) {
222
- if (countWildcard(pattern) > 1) {
223
- log(LogLevel2.Warning, `Pattern '${pattern}' can have at most one '*' character.`);
224
- continue;
225
- }
226
- const wildcard = pattern.indexOf("*");
227
- if (respectCoreModule) {
228
- let skip = false;
229
- for (const key of Module.builtinModules) {
230
- if (pattern === key || pattern.startsWith(key + "/")) {
231
- log(LogLevel2.Warning, `path pattern '${pattern}' is ignored.`);
232
- log(LogLevel2.Info, `respect core module '${key}'.`);
233
- skip = true;
234
- }
235
- }
236
- if (skip) continue;
237
- }
238
- const targets = paths[pattern].filter((target) => {
239
- if (countWildcard(target) > 1) {
240
- log(LogLevel2.Warning, `Substitution '${target}' in pattern '${pattern}' can have at most one '*' character.`);
241
- return false;
242
- }
243
- return true;
244
- });
245
- if (targets.length === 0) {
246
- continue;
247
- }
248
- if (pattern === "*") {
249
- mappings.push({
250
- wildcard: true,
251
- pattern,
252
- prefix: "",
253
- suffix: "",
254
- targets
255
- });
256
- continue;
257
- }
258
- mappings.push({
259
- wildcard: wildcard !== -1,
260
- pattern,
261
- prefix: pattern.substring(0, wildcard),
262
- suffix: pattern.substring(wildcard + 1),
263
- targets
264
- });
265
- }
266
- for (const mapping of mappings) {
267
- log(LogLevel2.Debug, `pattern: '${mapping.pattern}' targets: '${mapping.targets}'`);
268
- }
269
- return mappings;
270
- }
271
- function isPatternMatch(prefix, suffix, candidate) {
272
- return candidate.length >= prefix.length + suffix.length && candidate.startsWith(prefix) && candidate.endsWith(suffix);
273
- }
274
- function findMatch(moduleName, mappings) {
275
- let longestMatchedPrefixLength = -1;
276
- let matched;
277
- for (const mapping of mappings) {
278
- const {
279
- wildcard,
280
- prefix,
281
- suffix,
282
- pattern
283
- } = mapping;
284
- if (wildcard && isPatternMatch(prefix, suffix, moduleName)) {
285
- if (longestMatchedPrefixLength < prefix.length) {
286
- longestMatchedPrefixLength = prefix.length;
287
- matched = mapping;
288
- }
289
- } else if (moduleName === pattern) {
290
- matched = mapping;
291
- break;
292
- }
293
- }
294
- return matched;
295
- }
296
- function resolveModuleName({
297
- mappings,
298
- request,
299
- importer,
300
- compilerOptions,
301
- host,
302
- falllback
303
- }) {
304
- const matched = findMatch(request, mappings);
305
- if (!matched) {
306
- return void 0;
307
- }
308
- const matchedWildcard = request.slice(matched.prefix.length, request.length - matched.suffix.length);
309
- for (const target of matched.targets) {
310
- const updated = matched.wildcard ? target.replace("*", matchedWildcard) : target;
311
- const base = compilerOptions.baseUrl ?? compilerOptions.pathsBasePath;
312
- const moduleName = path2.resolve(base, updated);
313
- const ext = path2.extname(moduleName);
314
- switch (ext) {
315
- case ".ts":
316
- case ".tsx":
317
- case ".json":
318
- return moduleName;
319
- case ".js":
320
- case ".jsx":
321
- if (compilerOptions.module === ts2.ModuleKind.NodeNext) {
322
- break;
323
- }
324
- return moduleName;
325
- }
326
- const result = ts2.resolveModuleName(moduleName, importer, compilerOptions, host);
327
- if (result?.resolvedModule) {
328
- return path2.normalize(result.resolvedModule.resolvedFileName);
329
- }
330
- if (falllback?.(moduleName)) return moduleName;
331
- }
332
- return void 0;
333
- }
334
- function fromTS_NODE_PROJECT() {
335
- const env = process.env["TS_NODE_PROJECT"];
336
- if (env) return env.split(path2.delimiter).filter(Boolean);
337
- return void 0;
338
- }
339
- function createHandler2({
340
- searchPath,
341
- tsConfigPath = fromTS_NODE_PROJECT(),
342
- respectCoreModule = true,
343
- log = createLogger2(),
344
- falllback
345
- } = {}) {
346
- if (!tsConfigPath) {
347
- if (searchPath && searchPath instanceof Array) {
348
- tsConfigPath = searchPath.map((p) => ts2.findConfigFile(p, ts2.sys.fileExists)).filter((v) => Boolean(v));
349
- } else {
350
- tsConfigPath = ts2.findConfigFile(searchPath || ts2.sys.getCurrentDirectory(), ts2.sys.fileExists) || [];
351
- }
352
- }
353
- const host = {
354
- ...ts2.sys,
355
- fileExists(filename) {
356
- if (filename.endsWith(ts2.Extension.Dts)) return false;
357
- return ts2.sys.fileExists(filename);
358
- }
359
- };
360
- const services = [];
361
- const configs = spreadTsConfig(tsConfigPath);
362
- if (!configs) {
363
- return void 0;
364
- }
365
- for (const config of configs) {
366
- addServices(config);
367
- }
368
- return (request, importer) => services.reduce((result, srv) => {
369
- if (result) {
370
- return result;
371
- }
372
- const {
373
- compilerOptions,
374
- cache,
375
- fileNames,
376
- mappings
377
- } = srv;
378
- const exist = cache.get(importer);
379
- if (exist !== void 0) {
380
- cache.delete(importer);
381
- cache.set(importer, exist);
382
- if (!exist) return void 0;
383
- } else if (fileNames.indexOf(importer) === -1) {
384
- if (cache.size === 1 << 8) cache.delete(cache.keys().next().value);
385
- cache.set(importer, false);
386
- return void 0;
387
- } else {
388
- if (cache.size === 1 << 8) cache.delete(cache.keys().next().value);
389
- cache.set(importer, true);
390
- }
391
- return resolveModuleName({
392
- compilerOptions,
393
- host,
394
- importer,
395
- request,
396
- mappings,
397
- falllback
398
- });
399
- }, void 0);
400
- function addServices(config) {
401
- const {
402
- compilerOptions,
403
- fileNames,
404
- references
405
- } = config;
406
- if (!compilerOptions.paths || compilerOptions.paths instanceof Array) return;
407
- services.push({
408
- compilerOptions,
409
- fileNames,
410
- mappings: createMappings({
411
- log,
412
- respectCoreModule,
413
- paths: compilerOptions.paths
414
- }),
415
- cache: /* @__PURE__ */ new Map()
416
- });
417
- if (references) {
418
- for (const config2 of references) {
419
- addServices(config2);
420
- }
421
- }
422
- }
423
- function spreadTsConfig(tsConfigPath2) {
424
- if (typeof tsConfigPath2 === "string") {
425
- tsConfigPath2 = [tsConfigPath2];
426
- } else if (!(tsConfigPath2 instanceof Array)) {
427
- tsConfigPath2 = [tsConfigPath2];
428
- }
429
- const configs2 = [];
430
- for (const configPayloadOrPath of tsConfigPath2) {
431
- if (typeof configPayloadOrPath === "string") {
432
- log(LogLevel2.Trace, `loading: ${configPayloadOrPath}`);
433
- }
434
- const config = typeof configPayloadOrPath === "string" ? getTsConfig({
435
- tsConfigPath: configPayloadOrPath,
436
- host: ts2.sys,
437
- log
438
- }) : configPayloadOrPath;
439
- if (!config) {
440
- return void 0;
441
- }
442
- configs2.push(config);
443
- }
444
- return configs2;
445
- }
446
- }
447
- function register({
448
- tsConfigPath,
449
- respectCoreModule,
450
- logLevel,
451
- colors,
452
- loggerID,
453
- falllback
454
- } = {}) {
455
- const log = createLogger2({
456
- logLevel: convertLogLevel2(logLevel),
457
- colors,
458
- ID: loggerID
459
- });
460
- const handler = createHandler2({
461
- tsConfigPath,
462
- respectCoreModule,
463
- log,
464
- falllback
465
- });
466
- if (!handler) {
467
- return () => {
468
- };
469
- }
470
- const originalResolveFilename = Module["_resolveFilename"];
471
- Module["_resolveFilename"] = function(request, parent, ...args) {
472
- if (!parent) return originalResolveFilename.apply(this, arguments);
473
- const moduleName = handler(request, parent.filename);
474
- if (moduleName) {
475
- log(LogLevel2.Debug, `${request} -> ${moduleName}`);
476
- return originalResolveFilename.apply(this, [moduleName, parent, ...args]);
477
- }
478
- return originalResolveFilename.apply(this, arguments);
479
- };
480
- return () => {
481
- Module["_resolveFilename"] = originalResolveFilename;
482
- };
483
- }
484
- exports.LogLevel = LogLevel2;
485
- exports.convertLogLevel = convertLogLevel2;
486
- exports.createHandler = createHandler2;
487
- exports.createLogger = createLogger2;
488
- exports.createMappings = createMappings;
489
- exports.findMatch = findMatch;
490
- exports.fromTS_NODE_PROJECT = fromTS_NODE_PROJECT;
491
- exports.fromTYPESCRIPT_PATHS_LOG_LEVEL = fromTYPESCRIPT_PATHS_LOG_LEVEL;
492
- exports.getTsConfig = getTsConfig;
493
- exports.isPatternMatch = isPatternMatch;
494
- exports.register = register;
495
- exports.resolveModuleName = resolveModuleName;
496
- }
497
- });
498
-
499
- // ../node_modules/typescript-paths/lib/index.js
500
- var require_lib = __commonJS({
501
- "../node_modules/typescript-paths/lib/index.js"(exports) {
502
- "use strict";
503
- var register = require_core();
504
- __require("module");
505
- __require("path");
506
- __require("typescript");
507
- __require("fs");
508
- exports.LogLevel = register.LogLevel;
509
- exports.convertLogLevel = register.convertLogLevel;
510
- exports.createHandler = register.createHandler;
511
- exports.createLogger = register.createLogger;
512
- exports.createMappings = register.createMappings;
513
- exports.findMatch = register.findMatch;
514
- exports.fromTS_NODE_PROJECT = register.fromTS_NODE_PROJECT;
515
- exports.fromTYPESCRIPT_PATHS_LOG_LEVEL = register.fromTYPESCRIPT_PATHS_LOG_LEVEL;
516
- exports.getTsConfig = register.getTsConfig;
517
- exports.isPatternMatch = register.isPatternMatch;
518
- exports.register = register.register;
519
- exports.resolveModuleName = register.resolveModuleName;
520
- }
521
- });
522
-
523
- // ../node_modules/rollup-plugin-tsconfig-paths/index.mjs
524
- var import_typescript_paths = __toESM(require_lib(), 1);
525
- import fs from "node:fs";
526
- import path from "node:path";
527
- import ts from "typescript";
528
- var PLUGIN_NAME = "tsconfig-paths";
529
- function tsConfigPaths({
530
- tsConfigPath,
531
- respectCoreModule,
532
- logLevel,
533
- colors = true
534
- } = {}) {
535
- let log;
536
- let handler;
537
- return {
538
- name: PLUGIN_NAME,
539
- buildStart() {
540
- log = (0, import_typescript_paths.createLogger)({ logLevel: (0, import_typescript_paths.convertLogLevel)(logLevel), colors, ID: PLUGIN_NAME });
541
- log(import_typescript_paths.LogLevel.Debug, `typescript version: ${ts.version}`);
542
- handler = (0, import_typescript_paths.createHandler)({
543
- log,
544
- tsConfigPath,
545
- respectCoreModule,
546
- falllback: (moduleName) => fs.existsSync(moduleName)
547
- });
548
- return;
549
- },
550
- async resolveId(request, importer, options) {
551
- if (!importer || request.startsWith("\0")) {
552
- return null;
553
- }
554
- const moduleName = handler == null ? void 0 : handler(request, importer);
555
- if (!moduleName) {
556
- return this.resolve(request, importer, { skipSelf: true, ...options });
557
- }
558
- log(import_typescript_paths.LogLevel.Debug, `${request} -> ${moduleName}`);
559
- if (!path.extname(moduleName)) {
560
- return this.resolve(moduleName, importer, { skipSelf: true, ...options });
561
- }
562
- return moduleName;
563
- }
564
- };
565
- }
566
- var src_default = tsConfigPaths;
567
- export {
568
- src_default as default
569
- };