odoro 1.0.7 → 1.0.8
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-JFQHODAT.js +5 -0
- package/dist/{chunk-HW6IVYS2.js → chunk-22KJTV2R.js} +2 -2
- package/dist/{chunk-TLICCKYO.js → chunk-LHZGX5ML.js} +21 -7
- package/dist/{chunk-ULSWLSQC.js → chunk-TQUJ3MFS.js} +33 -1
- package/dist/{chunk-ZYIVJ7Y7.js → chunk-ZVL7EXJO.js} +7 -7
- package/dist/cli.js +5 -5
- package/dist/{create-2RO3XLAJ.js → create-CDKS7KZ3.js} +2 -2
- package/dist/index.js +4 -4
- package/dist/{package-WSET42C6.js → package-NBP5NDX6.js} +1 -1
- package/dist/preview-7DKEAQOQ.js +4 -0
- package/dist/{server-U773M6G3.js → server-4UGN3SFS.js} +2 -2
- package/package.json +1 -1
- package/dist/build-KVNA64HW.js +0 -5
- package/dist/preview-KSWIHRXG.js +0 -4
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { extractEntries, fournisseurDe } from './chunk-
|
|
3
|
-
import { applyAlias, isBareSpecifier } from './chunk-
|
|
2
|
+
import { extractEntries, fournisseurDe } from './chunk-LHZGX5ML.js';
|
|
3
|
+
import { applyAlias, isBareSpecifier } from './chunk-TQUJ3MFS.js';
|
|
4
4
|
import { info, colors, size, success, duration } from './chunk-JMEHF3KN.js';
|
|
5
5
|
import { existsSync } from 'fs';
|
|
6
6
|
import { readFile, rm, mkdir, writeFile, cp, stat } from 'fs/promises';
|
|
@@ -1,6 +1,6 @@
|
|
|
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-
|
|
3
|
-
import { info, error, success, duration, colors
|
|
2
|
+
import { depFileName, INTERNAL_PREFIX, DEPS_PREFIX, urlToFile, hasExtension, STYLE_EXTENSIONS, feuilleDemandee, ASSET_EXTENSIONS, wrapAsset, estUneRessource, wrapJson, SOURCE_EXTENSIONS, ecouter, fileToUrl, transformModule, wrapStyle, applyAlias, isBareSpecifier } from './chunk-TQUJ3MFS.js';
|
|
3
|
+
import { info, error, warn, success, duration, colors } from './chunk-JMEHF3KN.js';
|
|
4
4
|
import { existsSync, readFileSync, statSync, watch, createReadStream } from 'fs';
|
|
5
5
|
import { readFile, rm, mkdir, writeFile } from 'fs/promises';
|
|
6
6
|
import { createServer, request } from 'http';
|
|
@@ -339,6 +339,20 @@ async function scanDependencies(config, entries) {
|
|
|
339
339
|
return [...found].sort();
|
|
340
340
|
}
|
|
341
341
|
async function optimizeDeps(config, specifiers, force = false) {
|
|
342
|
+
try {
|
|
343
|
+
return await compilerDeps(config, specifiers, force);
|
|
344
|
+
} catch (cause) {
|
|
345
|
+
if (!estUneCourse(cause)) throw cause;
|
|
346
|
+
await new Promise((suite) => setTimeout(suite, DELAI_COURSE));
|
|
347
|
+
return compilerDeps(config, specifiers, force);
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
var DELAI_COURSE = 400;
|
|
351
|
+
function estUneCourse(cause) {
|
|
352
|
+
const code = cause?.code;
|
|
353
|
+
return code === "ENOENT" || code === "EPERM" || code === "EBUSY";
|
|
354
|
+
}
|
|
355
|
+
async function compilerDeps(config, specifiers, force) {
|
|
342
356
|
const directory = join(config.root, "node_modules", ".odoro", "deps");
|
|
343
357
|
const sorted = [...specifiers].sort();
|
|
344
358
|
const hash = createHash("sha256").update(JSON.stringify(sorted)).update(await lockfileFingerprint(config.root)).update(entriesFingerprint(config.root, sorted)).update(engineVersion()).digest("hex").slice(0, 16);
|
|
@@ -1067,11 +1081,11 @@ async function startDevServer(config) {
|
|
|
1067
1081
|
}
|
|
1068
1082
|
}, 40);
|
|
1069
1083
|
});
|
|
1070
|
-
await
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
}
|
|
1074
|
-
const url = `http://${config.server.host}:${
|
|
1084
|
+
const { port, demande } = await ecouter(server, config.server.port, config.server.host);
|
|
1085
|
+
if (demande !== void 0) {
|
|
1086
|
+
warn(`port ${String(demande)} occupe \u2014 le serveur ecoute sur ${String(port)}`);
|
|
1087
|
+
}
|
|
1088
|
+
const url = `http://${config.server.host}:${String(port)}${config.base}`;
|
|
1075
1089
|
success(`pret en ${duration(Date.now() - started)}`);
|
|
1076
1090
|
info(` ${colors.cyan(url)}`);
|
|
1077
1091
|
return {
|
|
@@ -2,6 +2,38 @@
|
|
|
2
2
|
import { relative, resolve } from 'path';
|
|
3
3
|
import { build } from 'esbuild';
|
|
4
4
|
|
|
5
|
+
// src/shared/ecouter.ts
|
|
6
|
+
var ESSAIS = 10;
|
|
7
|
+
async function ecouter(server, port, host, essais = ESSAIS) {
|
|
8
|
+
for (let decalage = 0; decalage < essais; decalage += 1) {
|
|
9
|
+
const candidat = port + decalage;
|
|
10
|
+
const pris = await new Promise((resolve2, reject) => {
|
|
11
|
+
const surErreur = (cause) => {
|
|
12
|
+
server.removeListener("listening", surEcoute);
|
|
13
|
+
if (cause.code === "EADDRINUSE") {
|
|
14
|
+
resolve2(true);
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
reject(cause);
|
|
18
|
+
};
|
|
19
|
+
const surEcoute = () => {
|
|
20
|
+
server.removeListener("error", surErreur);
|
|
21
|
+
resolve2(false);
|
|
22
|
+
};
|
|
23
|
+
server.once("error", surErreur);
|
|
24
|
+
server.once("listening", surEcoute);
|
|
25
|
+
server.listen(candidat, host);
|
|
26
|
+
});
|
|
27
|
+
if (!pris) {
|
|
28
|
+
const adresse = server.address();
|
|
29
|
+
const obtenu = typeof adresse === "object" && adresse !== null ? adresse.port : candidat;
|
|
30
|
+
return decalage === 0 ? { port: obtenu } : { port: obtenu, demande: port };
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
throw new Error(
|
|
34
|
+
`[odoro] Aucun port libre entre ${String(port)} et ${String(port + essais - 1)}.`
|
|
35
|
+
);
|
|
36
|
+
}
|
|
5
37
|
var DEPS_PREFIX = "/@deps/";
|
|
6
38
|
var INTERNAL_PREFIX = "/@odoro/";
|
|
7
39
|
var SOURCE_EXTENSIONS = [".ts", ".tsx", ".js", ".jsx", ".mjs", ".cjs"];
|
|
@@ -233,4 +265,4 @@ function wrapAsset(url) {
|
|
|
233
265
|
`;
|
|
234
266
|
}
|
|
235
267
|
|
|
236
|
-
export { ASSET_EXTENSIONS, DEPS_PREFIX, INTERNAL_PREFIX, SOURCE_EXTENSIONS, STYLE_EXTENSIONS, applyAlias, depFileName, estUneRessource, feuilleDemandee, fileToUrl, hasExtension, isBareSpecifier, transformModule, urlToFile, wrapAsset, wrapJson, wrapStyle };
|
|
268
|
+
export { ASSET_EXTENSIONS, DEPS_PREFIX, INTERNAL_PREFIX, SOURCE_EXTENSIONS, STYLE_EXTENSIONS, applyAlias, depFileName, ecouter, estUneRessource, feuilleDemandee, fileToUrl, hasExtension, isBareSpecifier, transformModule, urlToFile, wrapAsset, wrapJson, wrapStyle };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { estUneRessource } from './chunk-
|
|
3
|
-
import { success, info, colors } from './chunk-JMEHF3KN.js';
|
|
2
|
+
import { estUneRessource, ecouter } from './chunk-TQUJ3MFS.js';
|
|
3
|
+
import { warn, success, info, colors } from './chunk-JMEHF3KN.js';
|
|
4
4
|
import { existsSync, statSync, createReadStream } from 'fs';
|
|
5
5
|
import { createServer } from 'http';
|
|
6
6
|
import { normalize, join, extname } from 'path';
|
|
@@ -50,11 +50,11 @@ async function startPreviewServer(config, port = config.server.port + 1) {
|
|
|
50
50
|
});
|
|
51
51
|
createReadStream(file).pipe(response);
|
|
52
52
|
});
|
|
53
|
-
await
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}
|
|
57
|
-
const url = `http://${config.server.host}:${
|
|
53
|
+
const { port: obtenu, demande } = await ecouter(server, port, config.server.host);
|
|
54
|
+
if (demande !== void 0) {
|
|
55
|
+
warn(`port ${String(demande)} occupe \u2014 l apercu ecoute sur ${String(obtenu)}`);
|
|
56
|
+
}
|
|
57
|
+
const url = `http://${config.server.host}:${String(obtenu)}${config.base}`;
|
|
58
58
|
success("previsualisation du build de production");
|
|
59
59
|
info(` ${colors.cyan(url)}`);
|
|
60
60
|
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-NBP5NDX6.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-CDKS7KZ3.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-4UGN3SFS.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-JFQHODAT.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-7DKEAQOQ.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.8",
|
|
152
|
+
"odoro": "1.0.8"
|
|
153
153
|
};
|
|
154
154
|
|
|
155
155
|
// src/scaffold/scaffold.ts
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
export { startPreviewServer } from './chunk-
|
|
2
|
+
export { startPreviewServer } from './chunk-ZVL7EXJO.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, detectSelfAccepting, optimizeDeps, scanDependencies, startDevServer } from './chunk-
|
|
7
|
-
export { depFileName } from './chunk-
|
|
5
|
+
export { buildProject, reportBuild } from './chunk-22KJTV2R.js';
|
|
6
|
+
export { ModuleGraph, detectSelfAccepting, optimizeDeps, scanDependencies, startDevServer } from './chunk-LHZGX5ML.js';
|
|
7
|
+
export { depFileName } from './chunk-TQUJ3MFS.js';
|
|
8
8
|
import './chunk-JMEHF3KN.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
export { extractEntries, injectClient, startDevServer } from './chunk-
|
|
3
|
-
import './chunk-
|
|
2
|
+
export { extractEntries, injectClient, startDevServer } from './chunk-LHZGX5ML.js';
|
|
3
|
+
import './chunk-TQUJ3MFS.js';
|
|
4
4
|
import './chunk-JMEHF3KN.js';
|
package/package.json
CHANGED
package/dist/build-KVNA64HW.js
DELETED
package/dist/preview-KSWIHRXG.js
DELETED