odoro 1.0.5 → 1.0.7
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/build-KVNA64HW.js +5 -0
- package/dist/{chunk-2PTB6WTD.js → chunk-HW6IVYS2.js} +2 -1
- package/dist/{chunk-7B4AJDBR.js → chunk-TLICCKYO.js} +13 -149
- package/dist/chunk-ULSWLSQC.js +236 -0
- package/dist/{chunk-MQHNERM5.js → chunk-ZYIVJ7Y7.js} +2 -1
- package/dist/cli.js +5 -5
- package/dist/{create-DN5UPR2T.js → create-2RO3XLAJ.js} +2 -2
- package/dist/index.js +4 -3
- package/dist/{package-S7VW4LMB.js → package-WSET42C6.js} +1 -1
- package/dist/preview-KSWIHRXG.js +4 -0
- package/dist/{server-ZGPOWXNK.js → server-U773M6G3.js} +2 -1
- package/package.json +1 -1
- package/dist/build-4VLCDMRV.js +0 -4
- package/dist/preview-GFGY6NS7.js +0 -3
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { extractEntries,
|
|
2
|
+
import { extractEntries, fournisseurDe } from './chunk-TLICCKYO.js';
|
|
3
|
+
import { applyAlias, isBareSpecifier } from './chunk-ULSWLSQC.js';
|
|
3
4
|
import { info, colors, size, success, duration } from './chunk-JMEHF3KN.js';
|
|
4
5
|
import { existsSync } from 'fs';
|
|
5
6
|
import { readFile, rm, mkdir, writeFile, cp, stat } from 'fs/promises';
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import { depFileName, INTERNAL_PREFIX, DEPS_PREFIX, urlToFile, hasExtension, STYLE_EXTENSIONS, feuilleDemandee, ASSET_EXTENSIONS, wrapAsset, estUneRessource, wrapJson, SOURCE_EXTENSIONS, fileToUrl, transformModule, wrapStyle, applyAlias, isBareSpecifier } from './chunk-ULSWLSQC.js';
|
|
2
3
|
import { info, error, success, duration, colors, warn } from './chunk-JMEHF3KN.js';
|
|
3
4
|
import { existsSync, readFileSync, statSync, watch, createReadStream } from 'fs';
|
|
4
5
|
import { readFile, rm, mkdir, writeFile } from 'fs/promises';
|
|
5
6
|
import { createServer, request } from 'http';
|
|
6
|
-
import { join, dirname, resolve, extname
|
|
7
|
+
import { join, dirname, resolve, extname } from 'path';
|
|
7
8
|
import { createRequire } from 'module';
|
|
8
9
|
import { pathToFileURL, fileURLToPath } from 'url';
|
|
9
10
|
import { createHash } from 'crypto';
|
|
@@ -296,152 +297,6 @@ function renderInteropProxy(info2) {
|
|
|
296
297
|
return `${lines.join("\n")}
|
|
297
298
|
`;
|
|
298
299
|
}
|
|
299
|
-
var DEPS_PREFIX = "/@deps/";
|
|
300
|
-
var INTERNAL_PREFIX = "/@odoro/";
|
|
301
|
-
var SOURCE_EXTENSIONS = [".ts", ".tsx", ".js", ".jsx", ".mjs", ".cjs"];
|
|
302
|
-
var STYLE_EXTENSIONS = [".css"];
|
|
303
|
-
var ASSET_EXTENSIONS = [
|
|
304
|
-
".svg",
|
|
305
|
-
".png",
|
|
306
|
-
".jpg",
|
|
307
|
-
".jpeg",
|
|
308
|
-
".gif",
|
|
309
|
-
".webp",
|
|
310
|
-
".avif",
|
|
311
|
-
".ico",
|
|
312
|
-
".woff",
|
|
313
|
-
".woff2",
|
|
314
|
-
".mp4",
|
|
315
|
-
".webm"
|
|
316
|
-
];
|
|
317
|
-
function depFileName(specifier) {
|
|
318
|
-
return `${specifier.replace(/^@/, "").split("/").join("_")}.js`;
|
|
319
|
-
}
|
|
320
|
-
function isBareSpecifier(specifier) {
|
|
321
|
-
return !specifier.startsWith(".") && !specifier.startsWith("/") && !specifier.startsWith("\\") && !/^[a-zA-Z]:[\\/]/.test(specifier) && !specifier.startsWith("data:") && !specifier.startsWith("http:") && !specifier.startsWith("https:");
|
|
322
|
-
}
|
|
323
|
-
function hasExtension(path, extensions) {
|
|
324
|
-
const clean = path.split("?")[0] ?? path;
|
|
325
|
-
return extensions.some((extension) => clean.toLowerCase().endsWith(extension));
|
|
326
|
-
}
|
|
327
|
-
function fileToUrl(file, root) {
|
|
328
|
-
const relativePath = relative(root, file).split("\\").join("/");
|
|
329
|
-
if (!relativePath.startsWith("..")) return `/${relativePath}`;
|
|
330
|
-
return `/@fs/${file.split("\\").join("/").replace(/^\//, "")}`;
|
|
331
|
-
}
|
|
332
|
-
function urlToFile(url, root) {
|
|
333
|
-
const path = (url.split("?")[0] ?? url).split("#")[0] ?? url;
|
|
334
|
-
if (path.startsWith("/@fs/")) {
|
|
335
|
-
const absolute = path.slice("/@fs/".length);
|
|
336
|
-
return /^[a-zA-Z]:/.test(absolute) ? absolute : `/${absolute}`;
|
|
337
|
-
}
|
|
338
|
-
return resolve(root, `.${path}`);
|
|
339
|
-
}
|
|
340
|
-
function applyAlias(specifier, config) {
|
|
341
|
-
for (const [prefix, target] of Object.entries(config.alias)) {
|
|
342
|
-
if (specifier === prefix || specifier.startsWith(`${prefix}/`)) {
|
|
343
|
-
return resolve(
|
|
344
|
-
config.root,
|
|
345
|
-
target,
|
|
346
|
-
specifier.slice(prefix.length).replace(/^\//, "")
|
|
347
|
-
);
|
|
348
|
-
}
|
|
349
|
-
}
|
|
350
|
-
return specifier;
|
|
351
|
-
}
|
|
352
|
-
function externalizeImports(config, dependencies) {
|
|
353
|
-
return {
|
|
354
|
-
name: "odoro-externalize",
|
|
355
|
-
setup(builder) {
|
|
356
|
-
builder.onResolve({ filter: /.*/ }, async (args) => {
|
|
357
|
-
if (args.kind === "entry-point") return null;
|
|
358
|
-
if (args.pluginData?.resolving === true) {
|
|
359
|
-
return null;
|
|
360
|
-
}
|
|
361
|
-
if (args.path.startsWith(INTERNAL_PREFIX) || args.path.startsWith(DEPS_PREFIX)) {
|
|
362
|
-
return { path: args.path, external: true };
|
|
363
|
-
}
|
|
364
|
-
const aliased = applyAlias(args.path, config);
|
|
365
|
-
const isFileLike = hasExtension(aliased, STYLE_EXTENSIONS) || hasExtension(aliased, ASSET_EXTENSIONS);
|
|
366
|
-
if (isBareSpecifier(aliased) && !isFileLike) {
|
|
367
|
-
return { path: `${DEPS_PREFIX}${depFileName(aliased)}`, external: true };
|
|
368
|
-
}
|
|
369
|
-
const resolved = await builder.resolve(aliased, {
|
|
370
|
-
kind: "import-statement",
|
|
371
|
-
resolveDir: args.resolveDir,
|
|
372
|
-
importer: args.importer,
|
|
373
|
-
pluginData: { resolving: true }
|
|
374
|
-
});
|
|
375
|
-
if (resolved.errors.length > 0) {
|
|
376
|
-
return { path: args.path, external: true };
|
|
377
|
-
}
|
|
378
|
-
dependencies.add(resolved.path);
|
|
379
|
-
const url = fileToUrl(resolved.path, config.root);
|
|
380
|
-
return {
|
|
381
|
-
path: hasExtension(url, ASSET_EXTENSIONS) ? `${url}?import` : url,
|
|
382
|
-
external: true
|
|
383
|
-
};
|
|
384
|
-
});
|
|
385
|
-
}
|
|
386
|
-
};
|
|
387
|
-
}
|
|
388
|
-
async function transformModule(file, config, env) {
|
|
389
|
-
const dependencies = /* @__PURE__ */ new Set();
|
|
390
|
-
const result = await build({
|
|
391
|
-
entryPoints: [file],
|
|
392
|
-
bundle: true,
|
|
393
|
-
write: false,
|
|
394
|
-
format: "esm",
|
|
395
|
-
platform: "browser",
|
|
396
|
-
target: "es2022",
|
|
397
|
-
sourcemap: "inline",
|
|
398
|
-
jsx: "automatic",
|
|
399
|
-
jsxDev: true,
|
|
400
|
-
logLevel: "silent",
|
|
401
|
-
absWorkingDir: config.root,
|
|
402
|
-
define: {
|
|
403
|
-
"import.meta.env": JSON.stringify(env),
|
|
404
|
-
"process.env.NODE_ENV": JSON.stringify("development"),
|
|
405
|
-
...config.define
|
|
406
|
-
},
|
|
407
|
-
plugins: [externalizeImports(config, dependencies)]
|
|
408
|
-
});
|
|
409
|
-
const code = result.outputFiles[0]?.text;
|
|
410
|
-
if (code === void 0) {
|
|
411
|
-
throw new Error(`[odoro] La compilation de "${file}" n'a produit aucun code.`);
|
|
412
|
-
}
|
|
413
|
-
return { code, dependencies: [...dependencies] };
|
|
414
|
-
}
|
|
415
|
-
function feuilleDemandee(entetes, url) {
|
|
416
|
-
if (url.includes("?direct")) return true;
|
|
417
|
-
if (entetes["sec-fetch-dest"] === "style") return true;
|
|
418
|
-
const accepte = entetes["accept"];
|
|
419
|
-
return typeof accepte === "string" && accepte.includes("text/css");
|
|
420
|
-
}
|
|
421
|
-
function wrapStyle(url, css) {
|
|
422
|
-
return `const id = ${JSON.stringify(`odoro-style:${url}`)}
|
|
423
|
-
const css = ${JSON.stringify(css)}
|
|
424
|
-
|
|
425
|
-
let element = document.querySelector(\`style[data-odoro-id="\${id}"]\`)
|
|
426
|
-
if (element === null) {
|
|
427
|
-
element = document.createElement('style')
|
|
428
|
-
element.setAttribute('data-odoro-id', id)
|
|
429
|
-
document.head.appendChild(element)
|
|
430
|
-
}
|
|
431
|
-
element.textContent = css
|
|
432
|
-
|
|
433
|
-
import.meta.hot?.accept()
|
|
434
|
-
import.meta.hot?.dispose(() => {
|
|
435
|
-
// La feuille suivante recreera l'element : le retirer evite d'empiler les
|
|
436
|
-
// regles mortes a chaque rechargement.
|
|
437
|
-
element?.remove()
|
|
438
|
-
})
|
|
439
|
-
`;
|
|
440
|
-
}
|
|
441
|
-
function wrapAsset(url) {
|
|
442
|
-
return `export default ${JSON.stringify(url)}
|
|
443
|
-
`;
|
|
444
|
-
}
|
|
445
300
|
|
|
446
301
|
// src/dev/deps.ts
|
|
447
302
|
var MANIFEST = "manifest.json";
|
|
@@ -1132,6 +987,15 @@ async function startDevServer(config) {
|
|
|
1132
987
|
await serveScript(response, file);
|
|
1133
988
|
return;
|
|
1134
989
|
}
|
|
990
|
+
if (hasExtension(path, [".json"])) {
|
|
991
|
+
if (estUneRessource(incoming.headers) || url2.includes("?import")) {
|
|
992
|
+
const json = await readFile(file, "utf8");
|
|
993
|
+
send(response, wrapJson(json), MIME[".js"] ?? "text/javascript");
|
|
994
|
+
} else {
|
|
995
|
+
serveFile(response, file);
|
|
996
|
+
}
|
|
997
|
+
return;
|
|
998
|
+
}
|
|
1135
999
|
serveFile(response, file);
|
|
1136
1000
|
return;
|
|
1137
1001
|
}
|
|
@@ -1145,7 +1009,7 @@ async function startDevServer(config) {
|
|
|
1145
1009
|
serveFile(response, index);
|
|
1146
1010
|
return;
|
|
1147
1011
|
}
|
|
1148
|
-
if (!extname(path)) {
|
|
1012
|
+
if (!extname(path) && !estUneRessource(incoming.headers)) {
|
|
1149
1013
|
await serveHtml(response);
|
|
1150
1014
|
return;
|
|
1151
1015
|
}
|
|
@@ -1223,4 +1087,4 @@ async function startDevServer(config) {
|
|
|
1223
1087
|
};
|
|
1224
1088
|
}
|
|
1225
1089
|
|
|
1226
|
-
export { ModuleGraph,
|
|
1090
|
+
export { ModuleGraph, detectSelfAccepting, extractEntries, fournisseurDe, injectClient, optimizeDeps, scanDependencies, startDevServer };
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { relative, resolve } from 'path';
|
|
3
|
+
import { build } from 'esbuild';
|
|
4
|
+
|
|
5
|
+
var DEPS_PREFIX = "/@deps/";
|
|
6
|
+
var INTERNAL_PREFIX = "/@odoro/";
|
|
7
|
+
var SOURCE_EXTENSIONS = [".ts", ".tsx", ".js", ".jsx", ".mjs", ".cjs"];
|
|
8
|
+
var STYLE_EXTENSIONS = [".css"];
|
|
9
|
+
var ASSET_EXTENSIONS = [
|
|
10
|
+
".svg",
|
|
11
|
+
".png",
|
|
12
|
+
".jpg",
|
|
13
|
+
".jpeg",
|
|
14
|
+
".gif",
|
|
15
|
+
".webp",
|
|
16
|
+
".avif",
|
|
17
|
+
".ico",
|
|
18
|
+
".woff",
|
|
19
|
+
".woff2",
|
|
20
|
+
".mp4",
|
|
21
|
+
".webm"
|
|
22
|
+
];
|
|
23
|
+
function depFileName(specifier) {
|
|
24
|
+
return `${specifier.replace(/^@/, "").split("/").join("_")}.js`;
|
|
25
|
+
}
|
|
26
|
+
function isBareSpecifier(specifier) {
|
|
27
|
+
return !specifier.startsWith(".") && !specifier.startsWith("/") && !specifier.startsWith("\\") && !/^[a-zA-Z]:[\\/]/.test(specifier) && !specifier.startsWith("data:") && !specifier.startsWith("http:") && !specifier.startsWith("https:");
|
|
28
|
+
}
|
|
29
|
+
function hasExtension(path, extensions) {
|
|
30
|
+
const clean = path.split("?")[0] ?? path;
|
|
31
|
+
return extensions.some((extension) => clean.toLowerCase().endsWith(extension));
|
|
32
|
+
}
|
|
33
|
+
function fileToUrl(file, root) {
|
|
34
|
+
const relativePath = relative(root, file).split("\\").join("/");
|
|
35
|
+
if (!relativePath.startsWith("..")) return `/${relativePath}`;
|
|
36
|
+
return `/@fs/${file.split("\\").join("/").replace(/^\//, "")}`;
|
|
37
|
+
}
|
|
38
|
+
function urlToFile(url, root) {
|
|
39
|
+
const path = (url.split("?")[0] ?? url).split("#")[0] ?? url;
|
|
40
|
+
if (path.startsWith("/@fs/")) {
|
|
41
|
+
const absolute = path.slice("/@fs/".length);
|
|
42
|
+
return /^[a-zA-Z]:/.test(absolute) ? absolute : `/${absolute}`;
|
|
43
|
+
}
|
|
44
|
+
return resolve(root, `.${path}`);
|
|
45
|
+
}
|
|
46
|
+
function applyAlias(specifier, config) {
|
|
47
|
+
for (const [prefix, target] of Object.entries(config.alias)) {
|
|
48
|
+
if (specifier === prefix || specifier.startsWith(`${prefix}/`)) {
|
|
49
|
+
return resolve(
|
|
50
|
+
config.root,
|
|
51
|
+
target,
|
|
52
|
+
specifier.slice(prefix.length).replace(/^\//, "")
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return specifier;
|
|
57
|
+
}
|
|
58
|
+
function externalizeImports(config, dependencies) {
|
|
59
|
+
return {
|
|
60
|
+
name: "odoro-externalize",
|
|
61
|
+
setup(builder) {
|
|
62
|
+
builder.onResolve({ filter: /.*/ }, async (args) => {
|
|
63
|
+
if (args.kind === "entry-point") return null;
|
|
64
|
+
if (args.pluginData?.resolving === true) {
|
|
65
|
+
return null;
|
|
66
|
+
}
|
|
67
|
+
if (args.path.startsWith(INTERNAL_PREFIX) || args.path.startsWith(DEPS_PREFIX)) {
|
|
68
|
+
return { path: args.path, external: true };
|
|
69
|
+
}
|
|
70
|
+
const aliased = applyAlias(args.path, config);
|
|
71
|
+
const isFileLike = hasExtension(aliased, STYLE_EXTENSIONS) || hasExtension(aliased, ASSET_EXTENSIONS);
|
|
72
|
+
if (isBareSpecifier(aliased) && !isFileLike) {
|
|
73
|
+
return { path: `${DEPS_PREFIX}${depFileName(aliased)}`, external: true };
|
|
74
|
+
}
|
|
75
|
+
const resolved = await builder.resolve(aliased, {
|
|
76
|
+
kind: "import-statement",
|
|
77
|
+
resolveDir: args.resolveDir,
|
|
78
|
+
importer: args.importer,
|
|
79
|
+
pluginData: { resolving: true }
|
|
80
|
+
});
|
|
81
|
+
if (resolved.errors.length > 0) {
|
|
82
|
+
return { path: args.path, external: true };
|
|
83
|
+
}
|
|
84
|
+
dependencies.add(resolved.path);
|
|
85
|
+
const url = fileToUrl(resolved.path, config.root);
|
|
86
|
+
return {
|
|
87
|
+
path: hasExtension(url, ASSET_EXTENSIONS) ? `${url}?import` : url,
|
|
88
|
+
external: true
|
|
89
|
+
};
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
async function transformModule(file, config, env) {
|
|
95
|
+
const dependencies = /* @__PURE__ */ new Set();
|
|
96
|
+
const result = await build({
|
|
97
|
+
entryPoints: [file],
|
|
98
|
+
bundle: true,
|
|
99
|
+
write: false,
|
|
100
|
+
format: "esm",
|
|
101
|
+
platform: "browser",
|
|
102
|
+
target: "es2022",
|
|
103
|
+
sourcemap: "inline",
|
|
104
|
+
jsx: "automatic",
|
|
105
|
+
jsxDev: true,
|
|
106
|
+
logLevel: "silent",
|
|
107
|
+
absWorkingDir: config.root,
|
|
108
|
+
define: {
|
|
109
|
+
"import.meta.env": JSON.stringify(env),
|
|
110
|
+
"process.env.NODE_ENV": JSON.stringify("development"),
|
|
111
|
+
...config.define
|
|
112
|
+
},
|
|
113
|
+
plugins: [externalizeImports(config, dependencies)]
|
|
114
|
+
});
|
|
115
|
+
const code = result.outputFiles[0]?.text;
|
|
116
|
+
if (code === void 0) {
|
|
117
|
+
throw new Error(`[odoro] La compilation de "${file}" n'a produit aucun code.`);
|
|
118
|
+
}
|
|
119
|
+
return { code, dependencies: [...dependencies] };
|
|
120
|
+
}
|
|
121
|
+
var IDENTIFIANT = /^[A-Za-z_$][A-Za-z0-9_$]*$/;
|
|
122
|
+
var RESERVES = /* @__PURE__ */ new Set([
|
|
123
|
+
"arguments",
|
|
124
|
+
"await",
|
|
125
|
+
"break",
|
|
126
|
+
"case",
|
|
127
|
+
"catch",
|
|
128
|
+
"class",
|
|
129
|
+
"const",
|
|
130
|
+
"continue",
|
|
131
|
+
"debugger",
|
|
132
|
+
"default",
|
|
133
|
+
"delete",
|
|
134
|
+
"do",
|
|
135
|
+
"else",
|
|
136
|
+
"enum",
|
|
137
|
+
"eval",
|
|
138
|
+
"export",
|
|
139
|
+
"extends",
|
|
140
|
+
"false",
|
|
141
|
+
"finally",
|
|
142
|
+
"for",
|
|
143
|
+
"function",
|
|
144
|
+
"if",
|
|
145
|
+
"implements",
|
|
146
|
+
"import",
|
|
147
|
+
"in",
|
|
148
|
+
"instanceof",
|
|
149
|
+
"interface",
|
|
150
|
+
"let",
|
|
151
|
+
"new",
|
|
152
|
+
"null",
|
|
153
|
+
"package",
|
|
154
|
+
"private",
|
|
155
|
+
"protected",
|
|
156
|
+
"public",
|
|
157
|
+
"return",
|
|
158
|
+
"static",
|
|
159
|
+
"super",
|
|
160
|
+
"switch",
|
|
161
|
+
"this",
|
|
162
|
+
"throw",
|
|
163
|
+
"true",
|
|
164
|
+
"try",
|
|
165
|
+
"typeof",
|
|
166
|
+
"var",
|
|
167
|
+
"void",
|
|
168
|
+
"while",
|
|
169
|
+
"with",
|
|
170
|
+
"yield"
|
|
171
|
+
]);
|
|
172
|
+
function wrapJson(json) {
|
|
173
|
+
let valeur;
|
|
174
|
+
try {
|
|
175
|
+
valeur = JSON.parse(json);
|
|
176
|
+
} catch {
|
|
177
|
+
return 'throw new SyntaxError("JSON illisible")';
|
|
178
|
+
}
|
|
179
|
+
const lignes = ["export default " + json.trim()];
|
|
180
|
+
if (typeof valeur === "object" && valeur !== null && !Array.isArray(valeur)) {
|
|
181
|
+
for (const [cle, contenu] of Object.entries(valeur)) {
|
|
182
|
+
if (!IDENTIFIANT.test(cle) || RESERVES.has(cle)) continue;
|
|
183
|
+
lignes.push("export const " + cle + " = " + JSON.stringify(contenu));
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
return lignes.join("\n");
|
|
187
|
+
}
|
|
188
|
+
var DESTINATIONS_RESSOURCE = /* @__PURE__ */ new Set([
|
|
189
|
+
"script",
|
|
190
|
+
"style",
|
|
191
|
+
"image",
|
|
192
|
+
"font",
|
|
193
|
+
"audio",
|
|
194
|
+
"video",
|
|
195
|
+
"track",
|
|
196
|
+
"manifest",
|
|
197
|
+
"worker",
|
|
198
|
+
"sharedworker",
|
|
199
|
+
"serviceworker"
|
|
200
|
+
]);
|
|
201
|
+
function estUneRessource(entetes) {
|
|
202
|
+
const destination = entetes["sec-fetch-dest"];
|
|
203
|
+
return typeof destination === "string" && DESTINATIONS_RESSOURCE.has(destination);
|
|
204
|
+
}
|
|
205
|
+
function feuilleDemandee(entetes, url) {
|
|
206
|
+
if (url.includes("?direct")) return true;
|
|
207
|
+
if (entetes["sec-fetch-dest"] === "style") return true;
|
|
208
|
+
const accepte = entetes["accept"];
|
|
209
|
+
return typeof accepte === "string" && accepte.includes("text/css");
|
|
210
|
+
}
|
|
211
|
+
function wrapStyle(url, css) {
|
|
212
|
+
return `const id = ${JSON.stringify(`odoro-style:${url}`)}
|
|
213
|
+
const css = ${JSON.stringify(css)}
|
|
214
|
+
|
|
215
|
+
let element = document.querySelector(\`style[data-odoro-id="\${id}"]\`)
|
|
216
|
+
if (element === null) {
|
|
217
|
+
element = document.createElement('style')
|
|
218
|
+
element.setAttribute('data-odoro-id', id)
|
|
219
|
+
document.head.appendChild(element)
|
|
220
|
+
}
|
|
221
|
+
element.textContent = css
|
|
222
|
+
|
|
223
|
+
import.meta.hot?.accept()
|
|
224
|
+
import.meta.hot?.dispose(() => {
|
|
225
|
+
// La feuille suivante recreera l'element : le retirer evite d'empiler les
|
|
226
|
+
// regles mortes a chaque rechargement.
|
|
227
|
+
element?.remove()
|
|
228
|
+
})
|
|
229
|
+
`;
|
|
230
|
+
}
|
|
231
|
+
function wrapAsset(url) {
|
|
232
|
+
return `export default ${JSON.stringify(url)}
|
|
233
|
+
`;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
export { ASSET_EXTENSIONS, DEPS_PREFIX, INTERNAL_PREFIX, SOURCE_EXTENSIONS, STYLE_EXTENSIONS, applyAlias, depFileName, estUneRessource, feuilleDemandee, fileToUrl, hasExtension, isBareSpecifier, transformModule, urlToFile, wrapAsset, wrapJson, wrapStyle };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import { estUneRessource } from './chunk-ULSWLSQC.js';
|
|
2
3
|
import { success, info, colors } from './chunk-JMEHF3KN.js';
|
|
3
4
|
import { existsSync, statSync, createReadStream } from 'fs';
|
|
4
5
|
import { createServer } from 'http';
|
|
@@ -30,7 +31,7 @@ async function startPreviewServer(config, port = config.server.port + 1) {
|
|
|
30
31
|
const candidate = join(config.outDir, relativePath);
|
|
31
32
|
const dansLeDossier = ["index.html", "index.md"].map((nom) => join(candidate, nom)).find((chemin) => existsSync(chemin) && statSync(chemin).isFile());
|
|
32
33
|
const existant = existsSync(candidate) && statSync(candidate).isFile() ? candidate : dansLeDossier;
|
|
33
|
-
if (existant === void 0 && extname(relativePath) !== "") {
|
|
34
|
+
if (existant === void 0 && (extname(relativePath) !== "" || estUneRessource(incoming.headers))) {
|
|
34
35
|
response.writeHead(404, { "Content-Type": "text/plain; charset=utf-8" });
|
|
35
36
|
response.end(`Introuvable : /${relativePath}`);
|
|
36
37
|
return;
|
package/dist/cli.js
CHANGED
|
@@ -131,7 +131,7 @@ function rootFrom(flags, positional) {
|
|
|
131
131
|
async function run(argv) {
|
|
132
132
|
const { command, positional, flags } = parseArgs(argv);
|
|
133
133
|
if (flags["version"] === true) {
|
|
134
|
-
const manifest = await import('./package-
|
|
134
|
+
const manifest = await import('./package-WSET42C6.js');
|
|
135
135
|
console.log(manifest.default.version);
|
|
136
136
|
return 0;
|
|
137
137
|
}
|
|
@@ -142,7 +142,7 @@ async function run(argv) {
|
|
|
142
142
|
switch (command) {
|
|
143
143
|
case "create":
|
|
144
144
|
case "new": {
|
|
145
|
-
const { createCommand } = await import('./create-
|
|
145
|
+
const { createCommand } = await import('./create-2RO3XLAJ.js');
|
|
146
146
|
const options = {};
|
|
147
147
|
if (positional[0] !== void 0) options.name = positional[0];
|
|
148
148
|
if (typeof flags["template"] === "string") options.template = flags["template"];
|
|
@@ -156,20 +156,20 @@ async function run(argv) {
|
|
|
156
156
|
return createCommand(options);
|
|
157
157
|
}
|
|
158
158
|
case "dev": {
|
|
159
|
-
const { startDevServer } = await import('./server-
|
|
159
|
+
const { startDevServer } = await import('./server-U773M6G3.js');
|
|
160
160
|
const config = await loadConfig(rootFrom(flags, positional), overridesFrom(flags));
|
|
161
161
|
await startDevServer(config);
|
|
162
162
|
return new Promise(() => void 0);
|
|
163
163
|
}
|
|
164
164
|
case "build": {
|
|
165
|
-
const { buildProject, reportBuild } = await import('./build-
|
|
165
|
+
const { buildProject, reportBuild } = await import('./build-KVNA64HW.js');
|
|
166
166
|
const config = await loadConfig(rootFrom(flags, positional), overridesFrom(flags));
|
|
167
167
|
const output = await buildProject(config);
|
|
168
168
|
reportBuild(output, process.cwd());
|
|
169
169
|
return 0;
|
|
170
170
|
}
|
|
171
171
|
case "preview": {
|
|
172
|
-
const { startPreviewServer } = await import('./preview-
|
|
172
|
+
const { startPreviewServer } = await import('./preview-KSWIHRXG.js');
|
|
173
173
|
const config = await loadConfig(rootFrom(flags, positional), overridesFrom(flags));
|
|
174
174
|
const port = numberFlag(flags, "port");
|
|
175
175
|
await startPreviewServer(config, port);
|
|
@@ -148,8 +148,8 @@ var VERSIONS_FAMILLE = {
|
|
|
148
148
|
"@odoro-cli/icons": "1.0.2",
|
|
149
149
|
"@odoro-cli/libs": "1.0.2",
|
|
150
150
|
"@odoro-cli/server": "1.0.2",
|
|
151
|
-
"create-odoro": "1.0.
|
|
152
|
-
"odoro": "1.0.
|
|
151
|
+
"create-odoro": "1.0.7",
|
|
152
|
+
"odoro": "1.0.7"
|
|
153
153
|
};
|
|
154
154
|
|
|
155
155
|
// src/scaffold/scaffold.ts
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
export { startPreviewServer } from './chunk-
|
|
2
|
+
export { startPreviewServer } from './chunk-ZYIVJ7Y7.js';
|
|
3
3
|
export { defineConfig, loadConfig } from './chunk-DL3NPC4H.js';
|
|
4
4
|
import './chunk-T6RLHSCW.js';
|
|
5
|
-
export { buildProject, reportBuild } from './chunk-
|
|
6
|
-
export { ModuleGraph,
|
|
5
|
+
export { buildProject, reportBuild } from './chunk-HW6IVYS2.js';
|
|
6
|
+
export { ModuleGraph, detectSelfAccepting, optimizeDeps, scanDependencies, startDevServer } from './chunk-TLICCKYO.js';
|
|
7
|
+
export { depFileName } from './chunk-ULSWLSQC.js';
|
|
7
8
|
import './chunk-JMEHF3KN.js';
|
package/package.json
CHANGED
package/dist/build-4VLCDMRV.js
DELETED
package/dist/preview-GFGY6NS7.js
DELETED