create-lumen 1.1.0 → 1.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.
Files changed (2) hide show
  1. package/package.json +8 -7
  2. package/register.js +18 -0
package/package.json CHANGED
@@ -1,18 +1,19 @@
1
1
  {
2
2
  "name": "create-lumen",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "description": "Scaffold a React + Vite project with architecture choice: feature-based or component-based.",
5
5
  "type": "module",
6
6
  "bin": {
7
7
  "create-lumen": "bin/cli.js"
8
8
  },
9
9
  "files": [
10
- "bin/",
11
- "src/",
12
- "templates/",
13
- "README.md",
14
- "LICENSE"
15
- ],
10
+ "bin/",
11
+ "register.js",
12
+ "src/",
13
+ "templates/",
14
+ "README.md",
15
+ "LICENSE"
16
+ ],
16
17
  "scripts": {
17
18
  "test": "node --import ./register.js --test \"tests/unit/*.test.mjs\" \"tests/smoke/*.test.mjs\""
18
19
  },
package/register.js ADDED
@@ -0,0 +1,18 @@
1
+ import { registerHooks } from "node:module";
2
+ import path from "node:path";
3
+ import { fileURLToPath, pathToFileURL } from "node:url";
4
+
5
+ const SRC_DIR = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "src");
6
+
7
+ if (!globalThis.__lumenAliasRegistered) {
8
+ globalThis.__lumenAliasRegistered = true;
9
+ registerHooks({
10
+ resolve(specifier, context, nextResolve) {
11
+ if (specifier.startsWith("@/")) {
12
+ const resolvedPath = path.resolve(SRC_DIR, specifier.slice(2));
13
+ return nextResolve(pathToFileURL(resolvedPath).href, context);
14
+ }
15
+ return nextResolve(specifier, context);
16
+ },
17
+ });
18
+ }