@seip/bluebird-js 0.0.1 → 0.1.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/.env_example +53 -53
- package/AGENTS.md +426 -403
- package/LICENSE +1 -1
- package/README.md +292 -285
- package/app/routes/api.js +50 -50
- package/app/routes/web.js +55 -53
- package/app/views/about.js +63 -0
- package/app/views/dashboard.js +147 -0
- package/app/views/index.js +80 -0
- package/app/views/layouts/main/view.js +81 -0
- package/app/views/legal/terms.html +19 -0
- package/app/views/login.js +80 -0
- package/core/app.d.ts +18 -18
- package/core/app.js +684 -644
- package/core/auth.d.ts +13 -13
- package/core/auth.js +326 -326
- package/core/cache.d.ts +17 -17
- package/core/cache.js +475 -475
- package/core/cli/doctor.js +287 -287
- package/core/cli/ecosystem.js +162 -162
- package/core/cli/init.js +779 -779
- package/core/cli/migrate.js +541 -541
- package/core/cli/model.js +66 -66
- package/core/cli/nginx.js +199 -199
- package/core/cli/route.js +120 -120
- package/core/cli/view.js +55 -36
- package/core/config.d.ts +3 -3
- package/core/config.js +111 -111
- package/core/csrf.d.ts +3 -3
- package/core/csrf.js +114 -114
- package/core/database.d.ts +15 -15
- package/core/database.js +636 -636
- package/core/debug.d.ts +3 -3
- package/core/debug.js +249 -249
- package/core/hash.d.ts +3 -3
- package/core/hash.js +194 -194
- package/core/html.d.ts +42 -0
- package/core/html.js +217 -0
- package/core/index.d.ts +1176 -1071
- package/core/logger.d.ts +3 -3
- package/core/logger.js +127 -124
- package/core/middleware.d.ts +3 -3
- package/core/middleware.js +28 -28
- package/core/model.d.ts +19 -19
- package/core/model.js +600 -600
- package/core/queue.d.ts +13 -13
- package/core/queue.js +172 -172
- package/core/ratelimit.d.ts +3 -3
- package/core/ratelimit.js +145 -145
- package/core/redis.d.ts +21 -21
- package/core/redis.js +230 -230
- package/core/render-cache.js +212 -0
- package/core/render.d.ts +3 -3
- package/core/render.js +199 -555
- package/core/router.d.ts +3 -3
- package/core/router.js +171 -171
- package/core/seo.d.ts +3 -3
- package/core/seo.js +106 -106
- package/core/swagger.d.ts +3 -3
- package/core/swagger.js +60 -60
- package/core/upload.d.ts +13 -13
- package/core/upload.js +102 -102
- package/core/util/colors.js +82 -82
- package/core/validate.d.ts +15 -15
- package/core/validate.js +364 -364
- package/core/view-loader.js +162 -0
- package/core/vite.d.ts +3 -3
- package/core/vite.js +145 -145
- package/core/ws.d.ts +13 -13
- package/core/ws.js +245 -245
- package/index.js +18 -18
- package/jsconfig.json +15 -15
- package/package.json +85 -86
- package/production.md +273 -273
- package/public/css/bluebird.min.css +1 -1
- package/public/js/bluebird-client.js +1780 -1662
- package/public/js/bluebird.min.js +1072 -1072
- package/app/views/about.html +0 -161
- package/app/views/dashboard.html +0 -140
- package/app/views/index.html +0 -150
- package/app/views/login.html +0 -144
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { pathToFileURL } from "node:url";
|
|
4
|
+
import Config from "./config.js";
|
|
5
|
+
|
|
6
|
+
const props = Config.props();
|
|
7
|
+
const DEBUG = props.debug;
|
|
8
|
+
const VIEWS_DIR = path.resolve(process.cwd(), process.env.VIEWS_PATH || "app/views");
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Module and raw file cache for production mode.
|
|
12
|
+
* @type {Map<string, Object>}
|
|
13
|
+
*/
|
|
14
|
+
const moduleCache = new Map();
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Checks whether a candidate path safely resides inside the views directory.
|
|
18
|
+
* Prevents directory traversal attacks.
|
|
19
|
+
* @param {string} candidatePath
|
|
20
|
+
* @returns {boolean}
|
|
21
|
+
*/
|
|
22
|
+
function isSafePath(candidatePath) {
|
|
23
|
+
const resolved = path.resolve(VIEWS_DIR, candidatePath);
|
|
24
|
+
return resolved.startsWith(VIEWS_DIR);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Loads a JavaScript view module with development cache-busting or production memoization.
|
|
29
|
+
* @param {string} absolutePath
|
|
30
|
+
* @returns {Promise<Object>}
|
|
31
|
+
*/
|
|
32
|
+
async function importModule(absolutePath) {
|
|
33
|
+
if (!DEBUG && moduleCache.has(absolutePath)) {
|
|
34
|
+
return moduleCache.get(absolutePath);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const stats = fs.statSync(absolutePath);
|
|
38
|
+
const fileUrl = pathToFileURL(absolutePath).href;
|
|
39
|
+
const targetUrl = DEBUG ? `${fileUrl}?t=${stats.mtimeMs}` : fileUrl;
|
|
40
|
+
|
|
41
|
+
const mod = await import(targetUrl);
|
|
42
|
+
if (!DEBUG) {
|
|
43
|
+
moduleCache.set(absolutePath, mod);
|
|
44
|
+
}
|
|
45
|
+
return mod;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* View loader and resolver for Bluebird.js.
|
|
50
|
+
* Resolves modular directory views (e.g. "dashboard/view.js"), single-file views,
|
|
51
|
+
* components, and layouts.
|
|
52
|
+
*/
|
|
53
|
+
export class ViewLoader {
|
|
54
|
+
/**
|
|
55
|
+
* Returns the configured views base directory.
|
|
56
|
+
* @returns {string}
|
|
57
|
+
*/
|
|
58
|
+
static getViewsDir() {
|
|
59
|
+
return VIEWS_DIR;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Resolves and loads a view by name.
|
|
64
|
+
* Searches the modular convention first (<name>/view.js), then flat files,
|
|
65
|
+
* subdirectories, and finally static HTML files.
|
|
66
|
+
*
|
|
67
|
+
* @param {string} viewName - Logical view identifier.
|
|
68
|
+
* @returns {Promise<{type: "js"|"html", module?: Object, filePath: string, content?: string}|null>}
|
|
69
|
+
*/
|
|
70
|
+
static async load(viewName) {
|
|
71
|
+
if (!viewName || typeof viewName !== "string") {
|
|
72
|
+
return null;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
const clean = viewName.replace(/^\/+/, "").replace(/\.(js|html|ejs)$/, "");
|
|
76
|
+
|
|
77
|
+
const candidates = [
|
|
78
|
+
`${clean}.js`,
|
|
79
|
+
`${clean}/view.js`,
|
|
80
|
+
path.join("pages", `${clean}.js`),
|
|
81
|
+
path.join("pages", `${clean}/view.js`),
|
|
82
|
+
path.join("components", `${clean}.js`),
|
|
83
|
+
path.join("components", `${clean}/view.js`),
|
|
84
|
+
path.join("partials", `${clean}.js`),
|
|
85
|
+
path.join("partials", `${clean}/view.js`),
|
|
86
|
+
path.join("layouts", `${clean}/view.js`),
|
|
87
|
+
path.join("layouts", `${clean}.js`),
|
|
88
|
+
`${clean}.html`,
|
|
89
|
+
path.join("pages", `${clean}.html`),
|
|
90
|
+
path.join("components", `${clean}.html`),
|
|
91
|
+
path.join("partials", `${clean}.html`),
|
|
92
|
+
path.join("layouts", `${clean}.html`),
|
|
93
|
+
];
|
|
94
|
+
|
|
95
|
+
for (const candidate of candidates) {
|
|
96
|
+
if (!isSafePath(candidate)) continue;
|
|
97
|
+
|
|
98
|
+
const fullPath = path.resolve(VIEWS_DIR, candidate);
|
|
99
|
+
if (fs.existsSync(fullPath)) {
|
|
100
|
+
if (candidate.endsWith(".js")) {
|
|
101
|
+
const mod = await importModule(fullPath);
|
|
102
|
+
return { type: "js", module: mod, filePath: fullPath };
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
if (candidate.endsWith(".html")) {
|
|
106
|
+
const content = fs.readFileSync(fullPath, "utf-8");
|
|
107
|
+
return { type: "html", filePath: fullPath, content };
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
return null;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Resolves and loads a layout module by name.
|
|
117
|
+
* Defaults to searching in app/views/layouts/.
|
|
118
|
+
*
|
|
119
|
+
* @param {string} layoutName - Layout name (e.g. "main").
|
|
120
|
+
* @returns {Promise<{type: "js"|"html", module?: Object, filePath: string, content?: string}|null>}
|
|
121
|
+
*/
|
|
122
|
+
static async loadLayout(layoutName) {
|
|
123
|
+
if (!layoutName) return null;
|
|
124
|
+
const clean = layoutName.replace(/^\/+/, "").replace(/\.(js|html)$/, "");
|
|
125
|
+
|
|
126
|
+
const candidates = [
|
|
127
|
+
path.join("layouts", `${clean}/view.js`),
|
|
128
|
+
path.join("layouts", `${clean}.js`),
|
|
129
|
+
`${clean}/view.js`,
|
|
130
|
+
`${clean}.js`,
|
|
131
|
+
path.join("layouts", `${clean}.html`),
|
|
132
|
+
];
|
|
133
|
+
|
|
134
|
+
for (const candidate of candidates) {
|
|
135
|
+
if (!isSafePath(candidate)) continue;
|
|
136
|
+
|
|
137
|
+
const fullPath = path.resolve(VIEWS_DIR, candidate);
|
|
138
|
+
if (fs.existsSync(fullPath)) {
|
|
139
|
+
if (candidate.endsWith(".js")) {
|
|
140
|
+
const mod = await importModule(fullPath);
|
|
141
|
+
return { type: "js", module: mod, filePath: fullPath };
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
if (candidate.endsWith(".html")) {
|
|
145
|
+
const content = fs.readFileSync(fullPath, "utf-8");
|
|
146
|
+
return { type: "html", filePath: fullPath, content };
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
return null;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Clears in-memory module cache in production.
|
|
156
|
+
*/
|
|
157
|
+
static clearCache() {
|
|
158
|
+
moduleCache.clear();
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
export default ViewLoader;
|
package/core/vite.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { Vite, ViteOptions } from "./index.js";
|
|
2
|
-
export default Vite;
|
|
3
|
-
export { Vite, ViteOptions };
|
|
1
|
+
import { Vite, ViteOptions } from "./index.js";
|
|
2
|
+
export default Vite;
|
|
3
|
+
export { Vite, ViteOptions };
|
package/core/vite.js
CHANGED
|
@@ -1,145 +1,145 @@
|
|
|
1
|
-
import fs from "node:fs";
|
|
2
|
-
import path from "node:path";
|
|
3
|
-
import Config from "./config.js";
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Vite integration helper for Bluebird.js.
|
|
7
|
-
* Handles React Refresh preamble, Vite HMR client in development,
|
|
8
|
-
* and manifest.json asset resolution in production.
|
|
9
|
-
*/
|
|
10
|
-
class Vite {
|
|
11
|
-
/**
|
|
12
|
-
* Cached production manifest data.
|
|
13
|
-
* @type {Object|null}
|
|
14
|
-
* @private
|
|
15
|
-
*/
|
|
16
|
-
static _manifest = null;
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Cached production head tags string.
|
|
20
|
-
* @type {string|null}
|
|
21
|
-
* @private
|
|
22
|
-
*/
|
|
23
|
-
static _cachedProductionTags = null;
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Clears the in-memory manifest cache.
|
|
27
|
-
*/
|
|
28
|
-
static clearCache() {
|
|
29
|
-
this._manifest = null;
|
|
30
|
-
this._cachedProductionTags = null;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Resolves the manifest file path.
|
|
35
|
-
* @returns {string|null}
|
|
36
|
-
* @private
|
|
37
|
-
*/
|
|
38
|
-
static getManifestPath() {
|
|
39
|
-
const root = process.cwd();
|
|
40
|
-
const viteManifest = path.join(root, "public/dist/.vite/manifest.json");
|
|
41
|
-
if (fs.existsSync(viteManifest)) return viteManifest;
|
|
42
|
-
|
|
43
|
-
const legacyManifest = path.join(root, "public/dist/manifest.json");
|
|
44
|
-
if (fs.existsSync(legacyManifest)) return legacyManifest;
|
|
45
|
-
|
|
46
|
-
return null;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* Loads the manifest JSON.
|
|
51
|
-
* @returns {Object|null}
|
|
52
|
-
* @private
|
|
53
|
-
*/
|
|
54
|
-
static loadManifest() {
|
|
55
|
-
if (this._manifest) return this._manifest;
|
|
56
|
-
|
|
57
|
-
const manifestPath = this.getManifestPath();
|
|
58
|
-
if (!manifestPath) return null;
|
|
59
|
-
|
|
60
|
-
try {
|
|
61
|
-
const raw = fs.readFileSync(manifestPath, "utf-8");
|
|
62
|
-
this._manifest = JSON.parse(raw);
|
|
63
|
-
return this._manifest;
|
|
64
|
-
} catch {
|
|
65
|
-
return null;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* Returns HTML tags needed for Vite assets.
|
|
71
|
-
* In development: injects Vite client and entry script.
|
|
72
|
-
* In production: resolves hashed CSS and JS bundles from manifest.json.
|
|
73
|
-
* @param {Object} [options={}]
|
|
74
|
-
* @param {string} [options.entry="src/islands/main.jsx"] - Client entry point.
|
|
75
|
-
* @param {string} [options.viteUrl] - Custom Vite dev server URL.
|
|
76
|
-
* @param {boolean} [options.debug] - Development mode flag override.
|
|
77
|
-
* @returns {string} HTML markup to place in <head>.
|
|
78
|
-
*/
|
|
79
|
-
static tags(options = {}) {
|
|
80
|
-
const props = Config.props();
|
|
81
|
-
const isDebug = options.debug !== undefined ? Boolean(options.debug) : props.debug;
|
|
82
|
-
const entry = options.entry || "src/islands/main.jsx";
|
|
83
|
-
|
|
84
|
-
if (isDebug) {
|
|
85
|
-
const viteUrl =
|
|
86
|
-
options.viteUrl ||
|
|
87
|
-
process.env.VITE_URL ||
|
|
88
|
-
"http://localhost:5173";
|
|
89
|
-
const cleanEntry = entry.startsWith("/") ? entry : `/${entry}`;
|
|
90
|
-
|
|
91
|
-
return [
|
|
92
|
-
`<script type="module">`,
|
|
93
|
-
` import RefreshRuntime from "${viteUrl}/@react-refresh";`,
|
|
94
|
-
` RefreshRuntime.injectIntoGlobalHook(window);`,
|
|
95
|
-
` window.$RefreshReg$ = () => {};`,
|
|
96
|
-
` window.$RefreshSig$ = () => (type) => type;`,
|
|
97
|
-
` window.__vite_plugin_react_preamble_installed__ = true;`,
|
|
98
|
-
`</script>`,
|
|
99
|
-
`<script type="module" src="${viteUrl}/@vite/client"></script>`,
|
|
100
|
-
`<script type="module" src="${viteUrl}${cleanEntry}"></script>`,
|
|
101
|
-
].join("\n");
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
if (this._cachedProductionTags) {
|
|
105
|
-
return this._cachedProductionTags;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
const manifest = this.loadManifest();
|
|
109
|
-
if (!manifest) {
|
|
110
|
-
return "";
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
let entryChunk = manifest[entry];
|
|
114
|
-
if (!entryChunk) {
|
|
115
|
-
for (const key of Object.keys(manifest)) {
|
|
116
|
-
if (manifest[key].isEntry) {
|
|
117
|
-
entryChunk = manifest[key];
|
|
118
|
-
break;
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
if (!entryChunk) {
|
|
124
|
-
return "";
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
const tags = [];
|
|
128
|
-
|
|
129
|
-
if (Array.isArray(entryChunk.css)) {
|
|
130
|
-
for (const cssFile of entryChunk.css) {
|
|
131
|
-
tags.push(`<link rel="stylesheet" href="/dist/${cssFile}">`);
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
if (entryChunk.file) {
|
|
136
|
-
tags.push(`<script type="module" src="/dist/${entryChunk.file}"></script>`);
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
this._cachedProductionTags = tags.join("\n");
|
|
140
|
-
return this._cachedProductionTags;
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
export { Vite };
|
|
145
|
-
export default Vite;
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import Config from "./config.js";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Vite integration helper for Bluebird.js.
|
|
7
|
+
* Handles React Refresh preamble, Vite HMR client in development,
|
|
8
|
+
* and manifest.json asset resolution in production.
|
|
9
|
+
*/
|
|
10
|
+
class Vite {
|
|
11
|
+
/**
|
|
12
|
+
* Cached production manifest data.
|
|
13
|
+
* @type {Object|null}
|
|
14
|
+
* @private
|
|
15
|
+
*/
|
|
16
|
+
static _manifest = null;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Cached production head tags string.
|
|
20
|
+
* @type {string|null}
|
|
21
|
+
* @private
|
|
22
|
+
*/
|
|
23
|
+
static _cachedProductionTags = null;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Clears the in-memory manifest cache.
|
|
27
|
+
*/
|
|
28
|
+
static clearCache() {
|
|
29
|
+
this._manifest = null;
|
|
30
|
+
this._cachedProductionTags = null;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Resolves the manifest file path.
|
|
35
|
+
* @returns {string|null}
|
|
36
|
+
* @private
|
|
37
|
+
*/
|
|
38
|
+
static getManifestPath() {
|
|
39
|
+
const root = process.cwd();
|
|
40
|
+
const viteManifest = path.join(root, "public/dist/.vite/manifest.json");
|
|
41
|
+
if (fs.existsSync(viteManifest)) return viteManifest;
|
|
42
|
+
|
|
43
|
+
const legacyManifest = path.join(root, "public/dist/manifest.json");
|
|
44
|
+
if (fs.existsSync(legacyManifest)) return legacyManifest;
|
|
45
|
+
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Loads the manifest JSON.
|
|
51
|
+
* @returns {Object|null}
|
|
52
|
+
* @private
|
|
53
|
+
*/
|
|
54
|
+
static loadManifest() {
|
|
55
|
+
if (this._manifest) return this._manifest;
|
|
56
|
+
|
|
57
|
+
const manifestPath = this.getManifestPath();
|
|
58
|
+
if (!manifestPath) return null;
|
|
59
|
+
|
|
60
|
+
try {
|
|
61
|
+
const raw = fs.readFileSync(manifestPath, "utf-8");
|
|
62
|
+
this._manifest = JSON.parse(raw);
|
|
63
|
+
return this._manifest;
|
|
64
|
+
} catch {
|
|
65
|
+
return null;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Returns HTML tags needed for Vite assets.
|
|
71
|
+
* In development: injects Vite client and entry script.
|
|
72
|
+
* In production: resolves hashed CSS and JS bundles from manifest.json.
|
|
73
|
+
* @param {Object} [options={}]
|
|
74
|
+
* @param {string} [options.entry="src/islands/main.jsx"] - Client entry point.
|
|
75
|
+
* @param {string} [options.viteUrl] - Custom Vite dev server URL.
|
|
76
|
+
* @param {boolean} [options.debug] - Development mode flag override.
|
|
77
|
+
* @returns {string} HTML markup to place in <head>.
|
|
78
|
+
*/
|
|
79
|
+
static tags(options = {}) {
|
|
80
|
+
const props = Config.props();
|
|
81
|
+
const isDebug = options.debug !== undefined ? Boolean(options.debug) : props.debug;
|
|
82
|
+
const entry = options.entry || "src/islands/main.jsx";
|
|
83
|
+
|
|
84
|
+
if (isDebug) {
|
|
85
|
+
const viteUrl =
|
|
86
|
+
options.viteUrl ||
|
|
87
|
+
process.env.VITE_URL ||
|
|
88
|
+
"http://localhost:5173";
|
|
89
|
+
const cleanEntry = entry.startsWith("/") ? entry : `/${entry}`;
|
|
90
|
+
|
|
91
|
+
return [
|
|
92
|
+
`<script type="module">`,
|
|
93
|
+
` import RefreshRuntime from "${viteUrl}/@react-refresh";`,
|
|
94
|
+
` RefreshRuntime.injectIntoGlobalHook(window);`,
|
|
95
|
+
` window.$RefreshReg$ = () => {};`,
|
|
96
|
+
` window.$RefreshSig$ = () => (type) => type;`,
|
|
97
|
+
` window.__vite_plugin_react_preamble_installed__ = true;`,
|
|
98
|
+
`</script>`,
|
|
99
|
+
`<script type="module" src="${viteUrl}/@vite/client"></script>`,
|
|
100
|
+
`<script type="module" src="${viteUrl}${cleanEntry}"></script>`,
|
|
101
|
+
].join("\n");
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
if (this._cachedProductionTags) {
|
|
105
|
+
return this._cachedProductionTags;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
const manifest = this.loadManifest();
|
|
109
|
+
if (!manifest) {
|
|
110
|
+
return "";
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
let entryChunk = manifest[entry];
|
|
114
|
+
if (!entryChunk) {
|
|
115
|
+
for (const key of Object.keys(manifest)) {
|
|
116
|
+
if (manifest[key].isEntry) {
|
|
117
|
+
entryChunk = manifest[key];
|
|
118
|
+
break;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
if (!entryChunk) {
|
|
124
|
+
return "";
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
const tags = [];
|
|
128
|
+
|
|
129
|
+
if (Array.isArray(entryChunk.css)) {
|
|
130
|
+
for (const cssFile of entryChunk.css) {
|
|
131
|
+
tags.push(`<link rel="stylesheet" href="/dist/${cssFile}">`);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
if (entryChunk.file) {
|
|
136
|
+
tags.push(`<script type="module" src="/dist/${entryChunk.file}"></script>`);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
this._cachedProductionTags = tags.join("\n");
|
|
140
|
+
return this._cachedProductionTags;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
export { Vite };
|
|
145
|
+
export default Vite;
|
package/core/ws.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
WebSocketManager,
|
|
3
|
-
WebSocketOptions,
|
|
4
|
-
WebSocketClient,
|
|
5
|
-
WebSocketConnectionHandler,
|
|
6
|
-
} from "./index.js";
|
|
7
|
-
export default WebSocketManager;
|
|
8
|
-
export {
|
|
9
|
-
WebSocketManager,
|
|
10
|
-
WebSocketOptions,
|
|
11
|
-
WebSocketClient,
|
|
12
|
-
WebSocketConnectionHandler,
|
|
13
|
-
};
|
|
1
|
+
import {
|
|
2
|
+
WebSocketManager,
|
|
3
|
+
WebSocketOptions,
|
|
4
|
+
WebSocketClient,
|
|
5
|
+
WebSocketConnectionHandler,
|
|
6
|
+
} from "./index.js";
|
|
7
|
+
export default WebSocketManager;
|
|
8
|
+
export {
|
|
9
|
+
WebSocketManager,
|
|
10
|
+
WebSocketOptions,
|
|
11
|
+
WebSocketClient,
|
|
12
|
+
WebSocketConnectionHandler,
|
|
13
|
+
};
|