odoro 1.0.6 → 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.
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env node
2
+ export { buildProject, reportBuild } from './chunk-HW6IVYS2.js';
3
+ import './chunk-TLICCKYO.js';
4
+ import './chunk-ULSWLSQC.js';
5
+ import './chunk-JMEHF3KN.js';
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import { extractEntries, fournisseurDe } from './chunk-WPI53RD7.js';
3
- import { applyAlias, isBareSpecifier } from './chunk-LAMFWJB2.js';
2
+ import { extractEntries, fournisseurDe } from './chunk-TLICCKYO.js';
3
+ import { applyAlias, isBareSpecifier } from './chunk-ULSWLSQC.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,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { depFileName, INTERNAL_PREFIX, DEPS_PREFIX, urlToFile, hasExtension, STYLE_EXTENSIONS, feuilleDemandee, ASSET_EXTENSIONS, wrapAsset, estUneRessource, SOURCE_EXTENSIONS, fileToUrl, transformModule, wrapStyle, applyAlias, isBareSpecifier } from './chunk-LAMFWJB2.js';
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';
3
3
  import { info, error, success, duration, colors, warn } from './chunk-JMEHF3KN.js';
4
4
  import { existsSync, readFileSync, statSync, watch, createReadStream } from 'fs';
5
5
  import { readFile, rm, mkdir, writeFile } from 'fs/promises';
@@ -987,6 +987,15 @@ async function startDevServer(config) {
987
987
  await serveScript(response, file);
988
988
  return;
989
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
+ }
990
999
  serveFile(response, file);
991
1000
  return;
992
1001
  }
@@ -118,6 +118,73 @@ async function transformModule(file, config, env) {
118
118
  }
119
119
  return { code, dependencies: [...dependencies] };
120
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
+ }
121
188
  var DESTINATIONS_RESSOURCE = /* @__PURE__ */ new Set([
122
189
  "script",
123
190
  "style",
@@ -166,4 +233,4 @@ function wrapAsset(url) {
166
233
  `;
167
234
  }
168
235
 
169
- export { ASSET_EXTENSIONS, DEPS_PREFIX, INTERNAL_PREFIX, SOURCE_EXTENSIONS, STYLE_EXTENSIONS, applyAlias, depFileName, estUneRessource, feuilleDemandee, fileToUrl, hasExtension, isBareSpecifier, transformModule, urlToFile, wrapAsset, wrapStyle };
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,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { estUneRessource } from './chunk-LAMFWJB2.js';
2
+ import { estUneRessource } from './chunk-ULSWLSQC.js';
3
3
  import { success, info, colors } from './chunk-JMEHF3KN.js';
4
4
  import { existsSync, statSync, createReadStream } from 'fs';
5
5
  import { createServer } from 'http';
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-QDMDWXNK.js');
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-6FIQWINO.js');
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-FZU7PFRY.js');
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-ITT5BYZA.js');
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-ALGOUM4N.js');
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.6",
152
- "odoro": "1.0.6"
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,8 +1,8 @@
1
1
  #!/usr/bin/env node
2
- export { startPreviewServer } from './chunk-DYMXQBIO.js';
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-RZX7T3VG.js';
6
- export { ModuleGraph, detectSelfAccepting, optimizeDeps, scanDependencies, startDevServer } from './chunk-WPI53RD7.js';
7
- export { depFileName } from './chunk-LAMFWJB2.js';
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';
8
8
  import './chunk-JMEHF3KN.js';
@@ -2,7 +2,7 @@
2
2
  // package.json
3
3
  var package_default = {
4
4
  name: "odoro",
5
- version: "1.0.6",
5
+ version: "1.0.7",
6
6
  type: "module",
7
7
  license: "UNLICENSED",
8
8
  author: "BouBouw",
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env node
2
+ export { startPreviewServer } from './chunk-ZYIVJ7Y7.js';
3
+ import './chunk-ULSWLSQC.js';
4
+ import './chunk-JMEHF3KN.js';
@@ -1,4 +1,4 @@
1
1
  #!/usr/bin/env node
2
- export { extractEntries, injectClient, startDevServer } from './chunk-WPI53RD7.js';
3
- import './chunk-LAMFWJB2.js';
2
+ export { extractEntries, injectClient, startDevServer } from './chunk-TLICCKYO.js';
3
+ import './chunk-ULSWLSQC.js';
4
4
  import './chunk-JMEHF3KN.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "odoro",
3
- "version": "1.0.6",
3
+ "version": "1.0.7",
4
4
  "type": "module",
5
5
  "license": "UNLICENSED",
6
6
  "author": "BouBouw",
@@ -1,5 +0,0 @@
1
- #!/usr/bin/env node
2
- export { buildProject, reportBuild } from './chunk-RZX7T3VG.js';
3
- import './chunk-WPI53RD7.js';
4
- import './chunk-LAMFWJB2.js';
5
- import './chunk-JMEHF3KN.js';
@@ -1,4 +0,0 @@
1
- #!/usr/bin/env node
2
- export { startPreviewServer } from './chunk-DYMXQBIO.js';
3
- import './chunk-LAMFWJB2.js';
4
- import './chunk-JMEHF3KN.js';