@tanstack/start-plugin-core 1.166.12 → 1.166.14
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/esm/build-sitemap.js +94 -123
- package/dist/esm/build-sitemap.js.map +1 -1
- package/dist/esm/constants.js +15 -20
- package/dist/esm/constants.js.map +1 -1
- package/dist/esm/dev-server-plugin/dev-styles.js +137 -150
- package/dist/esm/dev-server-plugin/dev-styles.js.map +1 -1
- package/dist/esm/dev-server-plugin/extract-html-scripts.js +16 -15
- package/dist/esm/dev-server-plugin/extract-html-scripts.js.map +1 -1
- package/dist/esm/dev-server-plugin/plugin.js +125 -195
- package/dist/esm/dev-server-plugin/plugin.js.map +1 -1
- package/dist/esm/import-protection-plugin/ast.js +6 -5
- package/dist/esm/import-protection-plugin/ast.js.map +1 -1
- package/dist/esm/import-protection-plugin/constants.js +20 -22
- package/dist/esm/import-protection-plugin/constants.js.map +1 -1
- package/dist/esm/import-protection-plugin/defaults.js +35 -25
- package/dist/esm/import-protection-plugin/defaults.js.map +1 -1
- package/dist/esm/import-protection-plugin/extensionlessAbsoluteIdResolver.js +93 -92
- package/dist/esm/import-protection-plugin/extensionlessAbsoluteIdResolver.js.map +1 -1
- package/dist/esm/import-protection-plugin/matchers.js +23 -24
- package/dist/esm/import-protection-plugin/matchers.js.map +1 -1
- package/dist/esm/import-protection-plugin/plugin.js +1045 -1361
- package/dist/esm/import-protection-plugin/plugin.js.map +1 -1
- package/dist/esm/import-protection-plugin/postCompileUsage.js +58 -55
- package/dist/esm/import-protection-plugin/postCompileUsage.js.map +1 -1
- package/dist/esm/import-protection-plugin/rewriteDeniedImports.js +187 -259
- package/dist/esm/import-protection-plugin/rewriteDeniedImports.js.map +1 -1
- package/dist/esm/import-protection-plugin/sourceLocation.js +238 -248
- package/dist/esm/import-protection-plugin/sourceLocation.js.map +1 -1
- package/dist/esm/import-protection-plugin/trace.js +173 -184
- package/dist/esm/import-protection-plugin/trace.js.map +1 -1
- package/dist/esm/import-protection-plugin/utils.js +132 -111
- package/dist/esm/import-protection-plugin/utils.js.map +1 -1
- package/dist/esm/import-protection-plugin/virtualModules.js +216 -196
- package/dist/esm/import-protection-plugin/virtualModules.js.map +1 -1
- package/dist/esm/index.js +2 -7
- package/dist/esm/load-env-plugin/plugin.js +12 -11
- package/dist/esm/load-env-plugin/plugin.js.map +1 -1
- package/dist/esm/output-directory.js +10 -10
- package/dist/esm/output-directory.js.map +1 -1
- package/dist/esm/plugin.js +275 -355
- package/dist/esm/plugin.js.map +1 -1
- package/dist/esm/post-server-build.js +39 -53
- package/dist/esm/post-server-build.js.map +1 -1
- package/dist/esm/prerender.js +177 -239
- package/dist/esm/prerender.js.map +1 -1
- package/dist/esm/preview-server-plugin/plugin.js +41 -44
- package/dist/esm/preview-server-plugin/plugin.js.map +1 -1
- package/dist/esm/queue.js +115 -126
- package/dist/esm/queue.js.map +1 -1
- package/dist/esm/resolve-entries.js +31 -32
- package/dist/esm/resolve-entries.js.map +1 -1
- package/dist/esm/schema.js +156 -179
- package/dist/esm/schema.js.map +1 -1
- package/dist/esm/start-compiler-plugin/compiler.js +655 -812
- package/dist/esm/start-compiler-plugin/compiler.js.map +1 -1
- package/dist/esm/start-compiler-plugin/handleClientOnlyJSX.js +25 -8
- package/dist/esm/start-compiler-plugin/handleClientOnlyJSX.js.map +1 -1
- package/dist/esm/start-compiler-plugin/handleCreateIsomorphicFn.js +22 -19
- package/dist/esm/start-compiler-plugin/handleCreateIsomorphicFn.js.map +1 -1
- package/dist/esm/start-compiler-plugin/handleCreateMiddleware.js +20 -22
- package/dist/esm/start-compiler-plugin/handleCreateMiddleware.js.map +1 -1
- package/dist/esm/start-compiler-plugin/handleCreateServerFn.js +187 -255
- package/dist/esm/start-compiler-plugin/handleCreateServerFn.js.map +1 -1
- package/dist/esm/start-compiler-plugin/handleEnvOnly.js +23 -33
- package/dist/esm/start-compiler-plugin/handleEnvOnly.js.map +1 -1
- package/dist/esm/start-compiler-plugin/plugin.js +247 -291
- package/dist/esm/start-compiler-plugin/plugin.js.map +1 -1
- package/dist/esm/start-compiler-plugin/utils.js +27 -27
- package/dist/esm/start-compiler-plugin/utils.js.map +1 -1
- package/dist/esm/start-manifest-plugin/manifestBuilder.js +272 -378
- package/dist/esm/start-manifest-plugin/manifestBuilder.js.map +1 -1
- package/dist/esm/start-manifest-plugin/plugin.js +35 -44
- package/dist/esm/start-manifest-plugin/plugin.js.map +1 -1
- package/dist/esm/start-router-plugin/constants.js +6 -5
- package/dist/esm/start-router-plugin/constants.js.map +1 -1
- package/dist/esm/start-router-plugin/generator-plugins/prerender-routes-plugin.js +24 -19
- package/dist/esm/start-router-plugin/generator-plugins/prerender-routes-plugin.js.map +1 -1
- package/dist/esm/start-router-plugin/generator-plugins/routes-manifest-plugin.js +28 -29
- package/dist/esm/start-router-plugin/generator-plugins/routes-manifest-plugin.js.map +1 -1
- package/dist/esm/start-router-plugin/plugin.js +146 -199
- package/dist/esm/start-router-plugin/plugin.js.map +1 -1
- package/dist/esm/start-router-plugin/pruneServerOnlySubtrees.js +32 -31
- package/dist/esm/start-router-plugin/pruneServerOnlySubtrees.js.map +1 -1
- package/dist/esm/utils.js +14 -14
- package/dist/esm/utils.js.map +1 -1
- package/package.json +7 -7
- package/dist/esm/index.js.map +0 -1
package/dist/esm/queue.js
CHANGED
|
@@ -1,128 +1,117 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
//#region src/queue.ts
|
|
2
|
+
var defaultConfig = {
|
|
3
|
+
concurrency: 5,
|
|
4
|
+
started: false,
|
|
5
|
+
tasks: []
|
|
5
6
|
};
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
getPending() {
|
|
113
|
-
return this.pending;
|
|
114
|
-
}
|
|
115
|
-
getAll() {
|
|
116
|
-
return [...this.active, ...this.pending];
|
|
117
|
-
}
|
|
118
|
-
isRunning() {
|
|
119
|
-
return this.running;
|
|
120
|
-
}
|
|
121
|
-
isSettled() {
|
|
122
|
-
return !this.active.length && !this.pending.length;
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
export {
|
|
126
|
-
Queue
|
|
7
|
+
var Queue = class {
|
|
8
|
+
onSettles = [];
|
|
9
|
+
onErrors = [];
|
|
10
|
+
onSuccesses = [];
|
|
11
|
+
running;
|
|
12
|
+
active = [];
|
|
13
|
+
pending;
|
|
14
|
+
currentConcurrency;
|
|
15
|
+
constructor(config = defaultConfig) {
|
|
16
|
+
const { concurrency, started, tasks } = {
|
|
17
|
+
...defaultConfig,
|
|
18
|
+
...config
|
|
19
|
+
};
|
|
20
|
+
this.running = started;
|
|
21
|
+
this.pending = tasks;
|
|
22
|
+
this.currentConcurrency = concurrency;
|
|
23
|
+
}
|
|
24
|
+
tick() {
|
|
25
|
+
if (!this.running) return;
|
|
26
|
+
while (this.active.length < this.currentConcurrency && this.pending.length) {
|
|
27
|
+
const nextFn = this.pending.shift();
|
|
28
|
+
if (!nextFn) throw new Error("Found task that is not a function");
|
|
29
|
+
this.active.push(nextFn);
|
|
30
|
+
(async () => {
|
|
31
|
+
let success = false;
|
|
32
|
+
let res;
|
|
33
|
+
let error;
|
|
34
|
+
try {
|
|
35
|
+
res = await nextFn();
|
|
36
|
+
success = true;
|
|
37
|
+
} catch (e) {
|
|
38
|
+
error = e;
|
|
39
|
+
}
|
|
40
|
+
this.active = this.active.filter((d) => d !== nextFn);
|
|
41
|
+
if (success) this.onSuccesses.forEach((d) => d(res, nextFn));
|
|
42
|
+
else this.onErrors.forEach((d) => d(error, nextFn));
|
|
43
|
+
this.onSettles.forEach((d) => d(res, error));
|
|
44
|
+
this.tick();
|
|
45
|
+
})();
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
add(fn, { priority } = {}) {
|
|
49
|
+
return new Promise((resolve, reject) => {
|
|
50
|
+
const task = () => Promise.resolve(fn()).then((res) => {
|
|
51
|
+
resolve(res);
|
|
52
|
+
return res;
|
|
53
|
+
}).catch((err) => {
|
|
54
|
+
reject(err);
|
|
55
|
+
throw err;
|
|
56
|
+
});
|
|
57
|
+
if (priority) this.pending.unshift(task);
|
|
58
|
+
else this.pending.push(task);
|
|
59
|
+
this.tick();
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
throttle(n) {
|
|
63
|
+
this.currentConcurrency = n;
|
|
64
|
+
}
|
|
65
|
+
onSettled(cb) {
|
|
66
|
+
this.onSettles.push(cb);
|
|
67
|
+
return () => {
|
|
68
|
+
this.onSettles = this.onSettles.filter((d) => d !== cb);
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
onError(cb) {
|
|
72
|
+
this.onErrors.push(cb);
|
|
73
|
+
return () => {
|
|
74
|
+
this.onErrors = this.onErrors.filter((d) => d !== cb);
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
onSuccess(cb) {
|
|
78
|
+
this.onSuccesses.push(cb);
|
|
79
|
+
return () => {
|
|
80
|
+
this.onSuccesses = this.onSuccesses.filter((d) => d !== cb);
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
stop() {
|
|
84
|
+
this.running = false;
|
|
85
|
+
}
|
|
86
|
+
start() {
|
|
87
|
+
this.running = true;
|
|
88
|
+
this.tick();
|
|
89
|
+
return new Promise((resolve) => {
|
|
90
|
+
this.onSettled(() => {
|
|
91
|
+
if (this.isSettled()) resolve();
|
|
92
|
+
});
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
clear() {
|
|
96
|
+
this.pending = [];
|
|
97
|
+
}
|
|
98
|
+
getActive() {
|
|
99
|
+
return this.active;
|
|
100
|
+
}
|
|
101
|
+
getPending() {
|
|
102
|
+
return this.pending;
|
|
103
|
+
}
|
|
104
|
+
getAll() {
|
|
105
|
+
return [...this.active, ...this.pending];
|
|
106
|
+
}
|
|
107
|
+
isRunning() {
|
|
108
|
+
return this.running;
|
|
109
|
+
}
|
|
110
|
+
isSettled() {
|
|
111
|
+
return !this.active.length && !this.pending.length;
|
|
112
|
+
}
|
|
127
113
|
};
|
|
128
|
-
//#
|
|
114
|
+
//#endregion
|
|
115
|
+
export { Queue };
|
|
116
|
+
|
|
117
|
+
//# sourceMappingURL=queue.js.map
|
package/dist/esm/queue.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"queue.js","sources":["../../src/queue.ts"],"sourcesContent":["interface PoolConfig {\n concurrency?: number\n started?: boolean\n tasks?: Array<() => Promise<any>>\n}\n\nconst defaultConfig: PoolConfig = {\n concurrency: 5,\n started: false,\n tasks: [],\n}\n\nexport class Queue<T> {\n private onSettles: Array<(res: any, error: any) => void> = []\n private onErrors: Array<(error: any, task: () => Promise<any>) => void> = []\n private onSuccesses: Array<(result: any, task: () => Promise<any>) => void> =\n []\n private running: boolean\n private active: Array<() => Promise<any>> = []\n private pending: Array<() => Promise<any>>\n private currentConcurrency: number\n\n constructor(config: PoolConfig = defaultConfig) {\n const { concurrency, started, tasks } = {\n ...defaultConfig,\n ...config,\n }\n this.running = started!\n this.pending = tasks as Array<() => Promise<any>>\n this.currentConcurrency = concurrency!\n }\n\n private tick() {\n if (!this.running) {\n return\n }\n while (\n this.active.length < this.currentConcurrency &&\n this.pending.length\n ) {\n const nextFn = this.pending.shift()\n if (!nextFn) {\n throw new Error('Found task that is not a function')\n }\n this.active.push(nextFn)\n ;(async () => {\n let success = false\n let res!: T\n let error: any\n try {\n res = await nextFn()\n success = true\n } catch (e) {\n error = e\n }\n this.active = this.active.filter((d) => d !== nextFn)\n if (success) {\n this.onSuccesses.forEach((d) => d(res, nextFn))\n } else {\n this.onErrors.forEach((d) => d(error, nextFn))\n }\n this.onSettles.forEach((d) => d(res, error))\n this.tick()\n })()\n }\n }\n\n add(fn: () => Promise<T> | T, { priority }: { priority?: boolean } = {}) {\n return new Promise<any>((resolve, reject) => {\n const task = () =>\n Promise.resolve(fn())\n .then((res) => {\n resolve(res)\n return res\n })\n .catch((err) => {\n reject(err)\n throw err\n })\n if (priority) {\n this.pending.unshift(task)\n } else {\n this.pending.push(task)\n }\n this.tick()\n })\n }\n\n throttle(n: number) {\n this.currentConcurrency = n\n }\n\n onSettled(cb: () => void) {\n this.onSettles.push(cb)\n return () => {\n this.onSettles = this.onSettles.filter((d) => d !== cb)\n }\n }\n\n onError(cb: (error: any, task: () => Promise<any>) => void) {\n this.onErrors.push(cb)\n return () => {\n this.onErrors = this.onErrors.filter((d) => d !== cb)\n }\n }\n\n onSuccess(cb: (result: any, task: () => Promise<any>) => void) {\n this.onSuccesses.push(cb)\n return () => {\n this.onSuccesses = this.onSuccesses.filter((d) => d !== cb)\n }\n }\n\n stop() {\n this.running = false\n }\n\n start() {\n this.running = true\n this.tick()\n return new Promise<void>((resolve) => {\n this.onSettled(() => {\n if (this.isSettled()) {\n resolve()\n }\n })\n })\n }\n\n clear() {\n this.pending = []\n }\n\n getActive() {\n return this.active\n }\n\n getPending() {\n return this.pending\n }\n\n getAll() {\n return [...this.active, ...this.pending]\n }\n\n isRunning() {\n return this.running\n }\n\n isSettled() {\n return !this.active.length && !this.pending.length\n }\n}\n"],"
|
|
1
|
+
{"version":3,"file":"queue.js","names":[],"sources":["../../src/queue.ts"],"sourcesContent":["interface PoolConfig {\n concurrency?: number\n started?: boolean\n tasks?: Array<() => Promise<any>>\n}\n\nconst defaultConfig: PoolConfig = {\n concurrency: 5,\n started: false,\n tasks: [],\n}\n\nexport class Queue<T> {\n private onSettles: Array<(res: any, error: any) => void> = []\n private onErrors: Array<(error: any, task: () => Promise<any>) => void> = []\n private onSuccesses: Array<(result: any, task: () => Promise<any>) => void> =\n []\n private running: boolean\n private active: Array<() => Promise<any>> = []\n private pending: Array<() => Promise<any>>\n private currentConcurrency: number\n\n constructor(config: PoolConfig = defaultConfig) {\n const { concurrency, started, tasks } = {\n ...defaultConfig,\n ...config,\n }\n this.running = started!\n this.pending = tasks as Array<() => Promise<any>>\n this.currentConcurrency = concurrency!\n }\n\n private tick() {\n if (!this.running) {\n return\n }\n while (\n this.active.length < this.currentConcurrency &&\n this.pending.length\n ) {\n const nextFn = this.pending.shift()\n if (!nextFn) {\n throw new Error('Found task that is not a function')\n }\n this.active.push(nextFn)\n ;(async () => {\n let success = false\n let res!: T\n let error: any\n try {\n res = await nextFn()\n success = true\n } catch (e) {\n error = e\n }\n this.active = this.active.filter((d) => d !== nextFn)\n if (success) {\n this.onSuccesses.forEach((d) => d(res, nextFn))\n } else {\n this.onErrors.forEach((d) => d(error, nextFn))\n }\n this.onSettles.forEach((d) => d(res, error))\n this.tick()\n })()\n }\n }\n\n add(fn: () => Promise<T> | T, { priority }: { priority?: boolean } = {}) {\n return new Promise<any>((resolve, reject) => {\n const task = () =>\n Promise.resolve(fn())\n .then((res) => {\n resolve(res)\n return res\n })\n .catch((err) => {\n reject(err)\n throw err\n })\n if (priority) {\n this.pending.unshift(task)\n } else {\n this.pending.push(task)\n }\n this.tick()\n })\n }\n\n throttle(n: number) {\n this.currentConcurrency = n\n }\n\n onSettled(cb: () => void) {\n this.onSettles.push(cb)\n return () => {\n this.onSettles = this.onSettles.filter((d) => d !== cb)\n }\n }\n\n onError(cb: (error: any, task: () => Promise<any>) => void) {\n this.onErrors.push(cb)\n return () => {\n this.onErrors = this.onErrors.filter((d) => d !== cb)\n }\n }\n\n onSuccess(cb: (result: any, task: () => Promise<any>) => void) {\n this.onSuccesses.push(cb)\n return () => {\n this.onSuccesses = this.onSuccesses.filter((d) => d !== cb)\n }\n }\n\n stop() {\n this.running = false\n }\n\n start() {\n this.running = true\n this.tick()\n return new Promise<void>((resolve) => {\n this.onSettled(() => {\n if (this.isSettled()) {\n resolve()\n }\n })\n })\n }\n\n clear() {\n this.pending = []\n }\n\n getActive() {\n return this.active\n }\n\n getPending() {\n return this.pending\n }\n\n getAll() {\n return [...this.active, ...this.pending]\n }\n\n isRunning() {\n return this.running\n }\n\n isSettled() {\n return !this.active.length && !this.pending.length\n }\n}\n"],"mappings":";AAMA,IAAM,gBAA4B;CAChC,aAAa;CACb,SAAS;CACT,OAAO,EAAE;CACV;AAED,IAAa,QAAb,MAAsB;CACpB,YAA2D,EAAE;CAC7D,WAA0E,EAAE;CAC5E,cACE,EAAE;CACJ;CACA,SAA4C,EAAE;CAC9C;CACA;CAEA,YAAY,SAAqB,eAAe;EAC9C,MAAM,EAAE,aAAa,SAAS,UAAU;GACtC,GAAG;GACH,GAAG;GACJ;AACD,OAAK,UAAU;AACf,OAAK,UAAU;AACf,OAAK,qBAAqB;;CAG5B,OAAe;AACb,MAAI,CAAC,KAAK,QACR;AAEF,SACE,KAAK,OAAO,SAAS,KAAK,sBAC1B,KAAK,QAAQ,QACb;GACA,MAAM,SAAS,KAAK,QAAQ,OAAO;AACnC,OAAI,CAAC,OACH,OAAM,IAAI,MAAM,oCAAoC;AAEtD,QAAK,OAAO,KAAK,OAAO;AACvB,IAAC,YAAY;IACZ,IAAI,UAAU;IACd,IAAI;IACJ,IAAI;AACJ,QAAI;AACF,WAAM,MAAM,QAAQ;AACpB,eAAU;aACH,GAAG;AACV,aAAQ;;AAEV,SAAK,SAAS,KAAK,OAAO,QAAQ,MAAM,MAAM,OAAO;AACrD,QAAI,QACF,MAAK,YAAY,SAAS,MAAM,EAAE,KAAK,OAAO,CAAC;QAE/C,MAAK,SAAS,SAAS,MAAM,EAAE,OAAO,OAAO,CAAC;AAEhD,SAAK,UAAU,SAAS,MAAM,EAAE,KAAK,MAAM,CAAC;AAC5C,SAAK,MAAM;OACT;;;CAIR,IAAI,IAA0B,EAAE,aAAqC,EAAE,EAAE;AACvE,SAAO,IAAI,SAAc,SAAS,WAAW;GAC3C,MAAM,aACJ,QAAQ,QAAQ,IAAI,CAAC,CAClB,MAAM,QAAQ;AACb,YAAQ,IAAI;AACZ,WAAO;KACP,CACD,OAAO,QAAQ;AACd,WAAO,IAAI;AACX,UAAM;KACN;AACN,OAAI,SACF,MAAK,QAAQ,QAAQ,KAAK;OAE1B,MAAK,QAAQ,KAAK,KAAK;AAEzB,QAAK,MAAM;IACX;;CAGJ,SAAS,GAAW;AAClB,OAAK,qBAAqB;;CAG5B,UAAU,IAAgB;AACxB,OAAK,UAAU,KAAK,GAAG;AACvB,eAAa;AACX,QAAK,YAAY,KAAK,UAAU,QAAQ,MAAM,MAAM,GAAG;;;CAI3D,QAAQ,IAAoD;AAC1D,OAAK,SAAS,KAAK,GAAG;AACtB,eAAa;AACX,QAAK,WAAW,KAAK,SAAS,QAAQ,MAAM,MAAM,GAAG;;;CAIzD,UAAU,IAAqD;AAC7D,OAAK,YAAY,KAAK,GAAG;AACzB,eAAa;AACX,QAAK,cAAc,KAAK,YAAY,QAAQ,MAAM,MAAM,GAAG;;;CAI/D,OAAO;AACL,OAAK,UAAU;;CAGjB,QAAQ;AACN,OAAK,UAAU;AACf,OAAK,MAAM;AACX,SAAO,IAAI,SAAe,YAAY;AACpC,QAAK,gBAAgB;AACnB,QAAI,KAAK,WAAW,CAClB,UAAS;KAEX;IACF;;CAGJ,QAAQ;AACN,OAAK,UAAU,EAAE;;CAGnB,YAAY;AACV,SAAO,KAAK;;CAGd,aAAa;AACX,SAAO,KAAK;;CAGd,SAAS;AACP,SAAO,CAAC,GAAG,KAAK,QAAQ,GAAG,KAAK,QAAQ;;CAG1C,YAAY;AACV,SAAO,KAAK;;CAGd,YAAY;AACV,SAAO,CAAC,KAAK,OAAO,UAAU,CAAC,KAAK,QAAQ"}
|
|
@@ -1,37 +1,36 @@
|
|
|
1
1
|
import { resolveModulePath } from "exsolve";
|
|
2
|
+
//#region src/resolve-entries.ts
|
|
2
3
|
function resolveModule(opts) {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
4
|
+
let baseName = opts.baseName;
|
|
5
|
+
if (!baseName.startsWith("./")) baseName = `./${baseName}`;
|
|
6
|
+
return resolveModulePath(baseName, {
|
|
7
|
+
from: opts.from,
|
|
8
|
+
extensions: [
|
|
9
|
+
".ts",
|
|
10
|
+
".js",
|
|
11
|
+
".mts",
|
|
12
|
+
".mjs",
|
|
13
|
+
".tsx",
|
|
14
|
+
".jsx"
|
|
15
|
+
],
|
|
16
|
+
try: true
|
|
17
|
+
});
|
|
12
18
|
}
|
|
13
19
|
function resolveEntry(opts) {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
const resolvedEntry = resolveModule(resolveOptions);
|
|
27
|
-
if (opts.required && !resolvedEntry) {
|
|
28
|
-
throw new Error(
|
|
29
|
-
`Could not resolve entry for ${opts.type}: ${resolveOptions.baseName} in ${resolveOptions.from}`
|
|
30
|
-
);
|
|
31
|
-
}
|
|
32
|
-
return resolvedEntry;
|
|
20
|
+
let resolveOptions;
|
|
21
|
+
if (!opts.configuredEntry) resolveOptions = {
|
|
22
|
+
baseName: opts.defaultEntry,
|
|
23
|
+
from: opts.resolvedSrcDirectory
|
|
24
|
+
};
|
|
25
|
+
else resolveOptions = {
|
|
26
|
+
baseName: opts.configuredEntry,
|
|
27
|
+
from: opts.resolvedSrcDirectory
|
|
28
|
+
};
|
|
29
|
+
const resolvedEntry = resolveModule(resolveOptions);
|
|
30
|
+
if (opts.required && !resolvedEntry) throw new Error(`Could not resolve entry for ${opts.type}: ${resolveOptions.baseName} in ${resolveOptions.from}`);
|
|
31
|
+
return resolvedEntry;
|
|
33
32
|
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
//# sourceMappingURL=resolve-entries.js.map
|
|
33
|
+
//#endregion
|
|
34
|
+
export { resolveEntry };
|
|
35
|
+
|
|
36
|
+
//# sourceMappingURL=resolve-entries.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolve-entries.js","sources":["../../src/resolve-entries.ts"],"sourcesContent":["import { resolveModulePath } from 'exsolve'\n\ninterface ResolveModuleOptions {\n baseName: string\n from: string\n}\nfunction resolveModule(opts: ResolveModuleOptions): string | undefined {\n let baseName = opts.baseName\n if (!baseName.startsWith('./')) {\n baseName = `./${baseName}`\n }\n return resolveModulePath(baseName, {\n from: opts.from,\n extensions: ['.ts', '.js', '.mts', '.mjs', '.tsx', '.jsx'],\n try: true,\n })\n}\n\nexport function resolveEntry<\n TRequired extends boolean,\n TReturn = TRequired extends true ? string : string | undefined,\n>(opts: {\n type: string\n configuredEntry?: string\n defaultEntry: string\n resolvedSrcDirectory: string\n required: TRequired\n}): TReturn {\n let resolveOptions: ResolveModuleOptions\n\n // if entry was not configured, use default relative to srcDirectory\n if (!opts.configuredEntry) {\n resolveOptions = {\n baseName: opts.defaultEntry,\n from: opts.resolvedSrcDirectory,\n }\n } else {\n resolveOptions = {\n baseName: opts.configuredEntry,\n from: opts.resolvedSrcDirectory,\n }\n }\n\n const resolvedEntry = resolveModule(resolveOptions)\n if (opts.required && !resolvedEntry) {\n throw new Error(\n `Could not resolve entry for ${opts.type}: ${resolveOptions.baseName} in ${resolveOptions.from}`,\n )\n }\n return resolvedEntry as TReturn\n}\n"],"
|
|
1
|
+
{"version":3,"file":"resolve-entries.js","names":[],"sources":["../../src/resolve-entries.ts"],"sourcesContent":["import { resolveModulePath } from 'exsolve'\n\ninterface ResolveModuleOptions {\n baseName: string\n from: string\n}\nfunction resolveModule(opts: ResolveModuleOptions): string | undefined {\n let baseName = opts.baseName\n if (!baseName.startsWith('./')) {\n baseName = `./${baseName}`\n }\n return resolveModulePath(baseName, {\n from: opts.from,\n extensions: ['.ts', '.js', '.mts', '.mjs', '.tsx', '.jsx'],\n try: true,\n })\n}\n\nexport function resolveEntry<\n TRequired extends boolean,\n TReturn = TRequired extends true ? string : string | undefined,\n>(opts: {\n type: string\n configuredEntry?: string\n defaultEntry: string\n resolvedSrcDirectory: string\n required: TRequired\n}): TReturn {\n let resolveOptions: ResolveModuleOptions\n\n // if entry was not configured, use default relative to srcDirectory\n if (!opts.configuredEntry) {\n resolveOptions = {\n baseName: opts.defaultEntry,\n from: opts.resolvedSrcDirectory,\n }\n } else {\n resolveOptions = {\n baseName: opts.configuredEntry,\n from: opts.resolvedSrcDirectory,\n }\n }\n\n const resolvedEntry = resolveModule(resolveOptions)\n if (opts.required && !resolvedEntry) {\n throw new Error(\n `Could not resolve entry for ${opts.type}: ${resolveOptions.baseName} in ${resolveOptions.from}`,\n )\n }\n return resolvedEntry as TReturn\n}\n"],"mappings":";;AAMA,SAAS,cAAc,MAAgD;CACrE,IAAI,WAAW,KAAK;AACpB,KAAI,CAAC,SAAS,WAAW,KAAK,CAC5B,YAAW,KAAK;AAElB,QAAO,kBAAkB,UAAU;EACjC,MAAM,KAAK;EACX,YAAY;GAAC;GAAO;GAAO;GAAQ;GAAQ;GAAQ;GAAO;EAC1D,KAAK;EACN,CAAC;;AAGJ,SAAgB,aAGd,MAMU;CACV,IAAI;AAGJ,KAAI,CAAC,KAAK,gBACR,kBAAiB;EACf,UAAU,KAAK;EACf,MAAM,KAAK;EACZ;KAED,kBAAiB;EACf,UAAU,KAAK;EACf,MAAM,KAAK;EACZ;CAGH,MAAM,gBAAgB,cAAc,eAAe;AACnD,KAAI,KAAK,YAAY,CAAC,cACpB,OAAM,IAAI,MACR,+BAA+B,KAAK,KAAK,IAAI,eAAe,SAAS,MAAM,eAAe,OAC3F;AAEH,QAAO"}
|