mage-obsidian 2.0.0 → 2.1.0

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 (113) hide show
  1. package/dist/cli/buildThemes.d.ts +3 -0
  2. package/dist/cli/buildThemes.d.ts.map +1 -0
  3. package/{src/cli/buildThemes.ts → dist/cli/buildThemes.js} +77 -121
  4. package/dist/cli/buildThemes.js.map +1 -0
  5. package/dist/config/default.d.ts +16 -0
  6. package/dist/config/default.d.ts.map +1 -0
  7. package/{src/config/default.ts → dist/config/default.js} +2 -11
  8. package/dist/config/default.js.map +1 -0
  9. package/dist/core/configResolver.d.ts +38 -0
  10. package/dist/core/configResolver.d.ts.map +1 -0
  11. package/{src/core/configResolver.ts → dist/core/configResolver.js} +21 -60
  12. package/dist/core/configResolver.js.map +1 -0
  13. package/dist/core/contractValidator.d.ts +16 -0
  14. package/dist/core/contractValidator.d.ts.map +1 -0
  15. package/{src/core/contractValidator.ts → dist/core/contractValidator.js} +3 -10
  16. package/dist/core/contractValidator.js.map +1 -0
  17. package/dist/core/cssResolver.d.ts +5 -0
  18. package/dist/core/cssResolver.d.ts.map +1 -0
  19. package/{src/core/cssResolver.ts → dist/core/cssResolver.js} +26 -53
  20. package/dist/core/cssResolver.js.map +1 -0
  21. package/dist/core/generateInterceptors.d.ts +10 -0
  22. package/dist/core/generateInterceptors.d.ts.map +1 -0
  23. package/{src/core/generateInterceptors.ts → dist/core/generateInterceptors.js} +55 -109
  24. package/dist/core/generateInterceptors.js.map +1 -0
  25. package/dist/core/generateJsconfig.d.ts +45 -0
  26. package/dist/core/generateJsconfig.d.ts.map +1 -0
  27. package/{src/core/generateJsconfig.ts → dist/core/generateJsconfig.js} +32 -55
  28. package/dist/core/generateJsconfig.js.map +1 -0
  29. package/dist/core/moduleResolver.d.ts +22 -0
  30. package/dist/core/moduleResolver.d.ts.map +1 -0
  31. package/{src/core/moduleResolver.ts → dist/core/moduleResolver.js} +28 -62
  32. package/dist/core/moduleResolver.js.map +1 -0
  33. package/dist/core/preCompileFiles.d.ts +6 -0
  34. package/dist/core/preCompileFiles.d.ts.map +1 -0
  35. package/{src/core/preCompileFiles.ts → dist/core/preCompileFiles.js} +22 -48
  36. package/dist/core/preCompileFiles.js.map +1 -0
  37. package/dist/core/preCompileMagentoFiles.d.ts +3 -0
  38. package/dist/core/preCompileMagentoFiles.d.ts.map +1 -0
  39. package/{src/core/preCompileMagentoFiles.ts → dist/core/preCompileMagentoFiles.js} +4 -10
  40. package/dist/core/preCompileMagentoFiles.js.map +1 -0
  41. package/dist/core/themeResolverSync.d.ts +6 -0
  42. package/dist/core/themeResolverSync.d.ts.map +1 -0
  43. package/{src/core/themeResolverSync.ts → dist/core/themeResolverSync.js} +25 -26
  44. package/dist/core/themeResolverSync.js.map +1 -0
  45. package/dist/runtime/i18nCore.d.ts +55 -0
  46. package/dist/runtime/i18nCore.d.ts.map +1 -0
  47. package/{src/runtime/i18nCore.ts → dist/runtime/i18nCore.js} +13 -49
  48. package/dist/runtime/i18nCore.js.map +1 -0
  49. package/dist/runtime/interceptorManager.d.ts +45 -0
  50. package/dist/runtime/interceptorManager.d.ts.map +1 -0
  51. package/{src/runtime/interceptorManager.ts → dist/runtime/interceptorManager.js} +14 -72
  52. package/dist/runtime/interceptorManager.js.map +1 -0
  53. package/dist/runtime/islands.d.ts +45 -0
  54. package/dist/runtime/islands.d.ts.map +1 -0
  55. package/{src/runtime/islands.ts → dist/runtime/islands.js} +5 -30
  56. package/dist/runtime/islands.js.map +1 -0
  57. package/dist/runtime/sectionStoreCore.d.ts +108 -0
  58. package/dist/runtime/sectionStoreCore.d.ts.map +1 -0
  59. package/{src/runtime/sectionStoreCore.ts → dist/runtime/sectionStoreCore.js} +23 -93
  60. package/dist/runtime/sectionStoreCore.js.map +1 -0
  61. package/dist/utils/findComponents.d.ts +17 -0
  62. package/dist/utils/findComponents.d.ts.map +1 -0
  63. package/dist/utils/findComponents.js +66 -0
  64. package/dist/utils/findComponents.js.map +1 -0
  65. package/dist/utils/runWithConcurrency.d.ts +10 -0
  66. package/dist/utils/runWithConcurrency.d.ts.map +1 -0
  67. package/{src/utils/runWithConcurrency.ts → dist/utils/runWithConcurrency.js} +3 -9
  68. package/dist/utils/runWithConcurrency.js.map +1 -0
  69. package/dist/vite/defaultNodeResolver.d.ts +9 -0
  70. package/dist/vite/defaultNodeResolver.d.ts.map +1 -0
  71. package/{src/vite/defaultNodeResolver.ts → dist/vite/defaultNodeResolver.js} +3 -1
  72. package/dist/vite/defaultNodeResolver.js.map +1 -0
  73. package/dist/vite/inheritAssetsModuleResolver.d.ts +8 -0
  74. package/dist/vite/inheritAssetsModuleResolver.d.ts.map +1 -0
  75. package/{src/vite/inheritAssetsModuleResolver.ts → dist/vite/inheritAssetsModuleResolver.js} +6 -20
  76. package/dist/vite/inheritAssetsModuleResolver.js.map +1 -0
  77. package/dist/vite/inheritModuleResolver.d.ts +8 -0
  78. package/dist/vite/inheritModuleResolver.d.ts.map +1 -0
  79. package/{src/vite/inheritModuleResolver.ts → dist/vite/inheritModuleResolver.js} +4 -9
  80. package/dist/vite/inheritModuleResolver.js.map +1 -0
  81. package/dist/vite/interceptorsPlugin.d.ts +10 -0
  82. package/dist/vite/interceptorsPlugin.d.ts.map +1 -0
  83. package/{src/vite/interceptorsPlugin.ts → dist/vite/interceptorsPlugin.js} +12 -29
  84. package/dist/vite/interceptorsPlugin.js.map +1 -0
  85. package/dist/vite/magentoHrmRewrite.d.ts +6 -0
  86. package/dist/vite/magentoHrmRewrite.d.ts.map +1 -0
  87. package/{src/vite/magentoHrmRewrite.ts → dist/vite/magentoHrmRewrite.js} +16 -15
  88. package/dist/vite/magentoHrmRewrite.js.map +1 -0
  89. package/dist/vite/sharedPlugins.d.ts +35 -0
  90. package/dist/vite/sharedPlugins.d.ts.map +1 -0
  91. package/{src/vite/sharedPlugins.ts → dist/vite/sharedPlugins.js} +7 -9
  92. package/dist/vite/sharedPlugins.js.map +1 -0
  93. package/dist/vite/themeSourceWatcher.d.ts +16 -0
  94. package/dist/vite/themeSourceWatcher.d.ts.map +1 -0
  95. package/{src/vite/themeSourceWatcher.ts → dist/vite/themeSourceWatcher.js} +19 -24
  96. package/dist/vite/themeSourceWatcher.js.map +1 -0
  97. package/dist/vite/unresolvedModuleGuard.d.ts +17 -0
  98. package/dist/vite/unresolvedModuleGuard.d.ts.map +1 -0
  99. package/{src/vite/unresolvedModuleGuard.ts → dist/vite/unresolvedModuleGuard.js} +27 -27
  100. package/dist/vite/unresolvedModuleGuard.js.map +1 -0
  101. package/package.json +60 -10
  102. package/.github/workflows/ci.yml +0 -38
  103. package/.github/workflows/publish.yml +0 -36
  104. package/.oxlintrc.json +0 -19
  105. package/.prettierignore +0 -7
  106. package/.prettierrc.json +0 -7
  107. package/eslint.config.js +0 -24
  108. package/pnpm-workspace.yaml +0 -4
  109. package/src/utils/findComponents.ts +0 -83
  110. package/tsconfig.json +0 -34
  111. package/vitest.config.js +0 -18
  112. /package/{src → dist}/config/eslint.js +0 -0
  113. /package/{src → dist}/templates/base_main_js_file.js +0 -0
@@ -0,0 +1,3 @@
1
+ #! /usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=buildThemes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"buildThemes.d.ts","sourceRoot":"","sources":["../../src/cli/buildThemes.ts"],"names":[],"mappings":""}
@@ -6,40 +6,33 @@ import readlineSync from "readline-sync";
6
6
  import fs from "fs";
7
7
  import path from "path";
8
8
  import chalk from "chalk";
9
- import configResolver from "../core/configResolver.ts";
10
- import preCompileMagentoFiles from "../core/preCompileMagentoFiles.ts";
11
- import runWithConcurrency from "../utils/runWithConcurrency.ts";
9
+ import configResolver from "../core/configResolver.js";
10
+ import preCompileMagentoFiles from "../core/preCompileMagentoFiles.js";
11
+ import runWithConcurrency from "../utils/runWithConcurrency.js";
12
12
  import dotenv from "dotenv";
13
13
  dotenv.config();
14
-
15
14
  const program = new Command();
16
-
17
15
  program
18
16
  .option("--theme <theme>", "Specify the active theme")
19
17
  .option("--dev-server", "Run the development server for a specific theme")
20
18
  .option("--typecheck", "Type-check theme sources with vue-tsc instead of building");
21
-
22
19
  program.parse(process.argv);
23
-
24
20
  const options = program.opts();
25
21
  const themesConfig = configResolver.getMagentoConfig().themes;
26
-
27
22
  if (options.devServer && !options.theme) {
28
23
  console.error(chalk.red("Error: The --theme option is required when using --dev-server."));
29
24
  process.exit(1);
30
25
  }
31
-
32
26
  const theme = options.theme || "all";
33
-
34
27
  const executeCommand = (command) => {
35
28
  try {
36
29
  execSync(command, { stdio: "inherit" });
37
- } catch (error) {
30
+ }
31
+ catch (error) {
38
32
  console.error(chalk.red(`Command failed: ${command}`), error);
39
33
  process.exit(1);
40
34
  }
41
35
  };
42
-
43
36
  function tryCreateEnvFile() {
44
37
  const defaultEnvVars = {
45
38
  VITE_SERVER_HOST: "phpfpm",
@@ -49,30 +42,22 @@ function tryCreateEnvFile() {
49
42
  MAGENTO_HOST: "magento.test",
50
43
  VITE_SERVER_ALLOWED_HOSTS: "magento.test,localhost",
51
44
  };
52
-
53
45
  console.log(chalk.blue("Creating `.env` file with default or user-provided values..."));
54
-
55
46
  const envFilePath = path.resolve(process.cwd(), ".env");
56
47
  if (fs.existsSync(envFilePath)) {
57
48
  console.log(chalk.green(".env file already exists."));
58
49
  return;
59
50
  }
60
-
61
51
  let envContent = "";
62
52
  for (const [key, defaultValue] of Object.entries(defaultEnvVars)) {
63
- const userInput = readlineSync.question(
64
- chalk.yellow(`Enter value for ${key} (default: ${defaultValue}): `),
65
- {
66
- defaultInput: defaultValue,
67
- },
68
- );
53
+ const userInput = readlineSync.question(chalk.yellow(`Enter value for ${key} (default: ${defaultValue}): `), {
54
+ defaultInput: defaultValue,
55
+ });
69
56
  envContent += `${key}=${userInput || defaultValue}\n`;
70
57
  }
71
-
72
58
  fs.writeFileSync(envFilePath, envContent);
73
59
  console.log(chalk.green(".env file created successfully."));
74
60
  }
75
-
76
61
  function validateEnv() {
77
62
  const requiredEnvVars = [
78
63
  "VITE_SERVER_HOST",
@@ -89,15 +74,12 @@ function validateEnv() {
89
74
  }
90
75
  }
91
76
  if (missingEnvVars.length > 0) {
92
- console.error(
93
- chalk.red(`Missing required environment variables: ${missingEnvVars.join(", ")}`),
94
- );
77
+ console.error(chalk.red(`Missing required environment variables: ${missingEnvVars.join(", ")}`));
95
78
  tryCreateEnvFile();
96
79
  console.log(chalk.green("Please restart the script after setting up the .env file."));
97
80
  process.exit(1);
98
81
  }
99
82
  }
100
-
101
83
  /**
102
84
  * Build a single theme in its own child process. Each child gets its own
103
85
  * CURRENT_THEME env so several themes can build concurrently without sharing
@@ -108,56 +90,42 @@ function validateEnv() {
108
90
  * @param {string} themeName
109
91
  * @returns {Promise<{ themeName: string, code: number }>}
110
92
  */
111
- const spawnBuild = (themeName) =>
112
- new Promise<{ themeName: string; code: number }>((resolve) => {
113
- const child = spawn("vite build", {
114
- shell: true,
115
- env: { ...process.env, CURRENT_THEME: themeName },
116
- });
117
- const chunks = [];
118
- child.stdout.on("data", (data) => chunks.push(data));
119
- child.stderr.on("data", (data) => chunks.push(data));
120
- const finish = (code) => {
121
- console.log(chalk.cyan(`\n=== ${themeName} ===`));
122
- process.stdout.write(Buffer.concat(chunks).toString());
123
- if (code === 0) {
124
- console.log(chalk.green(`✓ ${themeName} built`));
125
- } else {
126
- console.error(chalk.red(`✗ ${themeName} failed (exit ${code})`));
127
- }
128
- resolve({ themeName, code });
129
- };
130
- child.on("close", finish);
131
- child.on("error", (error) => {
132
- chunks.push(Buffer.from(String(error?.stack ?? error)));
133
- finish(1);
134
- });
93
+ const spawnBuild = (themeName) => new Promise((resolve) => {
94
+ const child = spawn("vite build", {
95
+ shell: true,
96
+ env: { ...process.env, CURRENT_THEME: themeName },
97
+ });
98
+ const chunks = [];
99
+ child.stdout.on("data", (data) => chunks.push(data));
100
+ child.stderr.on("data", (data) => chunks.push(data));
101
+ const finish = (code) => {
102
+ console.log(chalk.cyan(`\n=== ${themeName} ===`));
103
+ process.stdout.write(Buffer.concat(chunks).toString());
104
+ if (code === 0) {
105
+ console.log(chalk.green(`✓ ${themeName} built`));
106
+ }
107
+ else {
108
+ console.error(chalk.red(`✗ ${themeName} failed (exit ${code})`));
109
+ }
110
+ resolve({ themeName, code });
111
+ };
112
+ child.on("close", finish);
113
+ child.on("error", (error) => {
114
+ chunks.push(Buffer.from(String(error?.stack ?? error)));
115
+ finish(1);
135
116
  });
136
-
117
+ });
137
118
  const buildThemes = async (themeNames) => {
138
119
  const cores = os.cpus()?.length ?? 2;
139
120
  const limit = Math.max(1, Math.min(themeNames.length, cores - 1));
140
- console.log(
141
- chalk.cyan(
142
- `Building ${themeNames.length} theme(s) (concurrency ${limit}): ${themeNames.join(", ")}`,
143
- ),
144
- );
145
-
146
- const results = await runWithConcurrency(
147
- themeNames,
148
- (themeName) => spawnBuild(themeName),
149
- limit,
150
- );
151
-
121
+ console.log(chalk.cyan(`Building ${themeNames.length} theme(s) (concurrency ${limit}): ${themeNames.join(", ")}`));
122
+ const results = await runWithConcurrency(themeNames, (themeName) => spawnBuild(themeName), limit);
152
123
  const failed = results.filter((result) => result.code !== 0);
153
124
  if (failed.length > 0) {
154
- console.error(
155
- chalk.red(`Build failed for: ${failed.map((result) => result.themeName).join(", ")}`),
156
- );
125
+ console.error(chalk.red(`Build failed for: ${failed.map((result) => result.themeName).join(", ")}`));
157
126
  process.exit(1);
158
127
  }
159
128
  };
160
-
161
129
  /**
162
130
  * Type-check one assembled theme with vue-tsc. The theme's generated
163
131
  * tsconfig.typecheck.json (materialized by precompile) carries the full
@@ -169,59 +137,47 @@ const buildThemes = async (themeNames) => {
169
137
  * @param {string} themeName
170
138
  * @returns {Promise<{ themeName: string, code: number }>}
171
139
  */
172
- const spawnTypecheck = (themeName) =>
173
- new Promise<{ themeName: string; code: number }>((resolve) => {
174
- const themeDefinition = configResolver.getThemeDefinition(themeName);
175
- const tsconfigPath = path.join(themeDefinition.src, "tsconfig.typecheck.json");
176
- const child = spawn(`vue-tsc --noEmit -p "${tsconfigPath}"`, {
177
- shell: true,
178
- env: { ...process.env, CURRENT_THEME: themeName },
179
- });
180
- const chunks = [];
181
- child.stdout.on("data", (data) => chunks.push(data));
182
- child.stderr.on("data", (data) => chunks.push(data));
183
- const finish = (code) => {
184
- console.log(chalk.cyan(`\n=== ${themeName} (typecheck) ===`));
185
- process.stdout.write(Buffer.concat(chunks).toString());
186
- if (code === 0) {
187
- console.log(chalk.green(`✓ ${themeName} type-checks`));
188
- } else {
189
- console.error(chalk.red(`✗ ${themeName} has type errors (exit ${code})`));
190
- }
191
- resolve({ themeName, code });
192
- };
193
- child.on("close", finish);
194
- child.on("error", (error) => {
195
- chunks.push(Buffer.from(String(error?.stack ?? error)));
196
- finish(1);
197
- });
140
+ const spawnTypecheck = (themeName) => new Promise((resolve) => {
141
+ const themeDefinition = configResolver.getThemeDefinition(themeName);
142
+ const tsconfigPath = path.join(themeDefinition.src, "tsconfig.typecheck.json");
143
+ const child = spawn(`vue-tsc --noEmit -p "${tsconfigPath}"`, {
144
+ shell: true,
145
+ env: { ...process.env, CURRENT_THEME: themeName },
198
146
  });
199
-
147
+ const chunks = [];
148
+ child.stdout.on("data", (data) => chunks.push(data));
149
+ child.stderr.on("data", (data) => chunks.push(data));
150
+ const finish = (code) => {
151
+ console.log(chalk.cyan(`\n=== ${themeName} (typecheck) ===`));
152
+ process.stdout.write(Buffer.concat(chunks).toString());
153
+ if (code === 0) {
154
+ console.log(chalk.green(`✓ ${themeName} type-checks`));
155
+ }
156
+ else {
157
+ console.error(chalk.red(`✗ ${themeName} has type errors (exit ${code})`));
158
+ }
159
+ resolve({ themeName, code });
160
+ };
161
+ child.on("close", finish);
162
+ child.on("error", (error) => {
163
+ chunks.push(Buffer.from(String(error?.stack ?? error)));
164
+ finish(1);
165
+ });
166
+ });
200
167
  const typecheckThemes = async (themeNames) => {
201
168
  // Materialize each theme's tsconfig.typecheck.json + inheritance map in-process
202
169
  // (idempotent, cached by contract hash) before spawning vue-tsc against it.
203
170
  for (const themeName of themeNames) {
204
171
  await preCompileMagentoFiles(themeName);
205
172
  }
206
- console.log(
207
- chalk.cyan(`Type-checking ${themeNames.length} theme(s): ${themeNames.join(", ")}`),
208
- );
209
-
210
- const results = await runWithConcurrency(
211
- themeNames,
212
- (themeName) => spawnTypecheck(themeName),
213
- 1,
214
- );
215
-
173
+ console.log(chalk.cyan(`Type-checking ${themeNames.length} theme(s): ${themeNames.join(", ")}`));
174
+ const results = await runWithConcurrency(themeNames, (themeName) => spawnTypecheck(themeName), 1);
216
175
  const failed = results.filter((result) => result.code !== 0);
217
176
  if (failed.length > 0) {
218
- console.error(
219
- chalk.red(`Type check failed for: ${failed.map((r) => r.themeName).join(", ")}`),
220
- );
177
+ console.error(chalk.red(`Type check failed for: ${failed.map((r) => r.themeName).join(", ")}`));
221
178
  process.exit(1);
222
179
  }
223
180
  };
224
-
225
181
  const runDevServer = (themeName) => {
226
182
  console.log(chalk.cyan(`Starting development server for theme: ${themeName}`));
227
183
  try {
@@ -230,34 +186,34 @@ const runDevServer = (themeName) => {
230
186
  console.error(chalk.red(`Theme "${themeName}" does not exist.`));
231
187
  process.exit(1);
232
188
  }
233
-
234
189
  process.env.CURRENT_THEME = themeName;
235
190
  executeCommand("vite");
236
- } catch (error) {
237
- console.error(
238
- chalk.red(`Failed to start development server for theme "${themeName}":`),
239
- error,
240
- );
191
+ }
192
+ catch (error) {
193
+ console.error(chalk.red(`Failed to start development server for theme "${themeName}":`), error);
241
194
  }
242
195
  };
243
-
244
196
  validateEnv();
245
-
246
197
  if (options.devServer) {
247
198
  runDevServer(theme);
248
- } else {
199
+ }
200
+ else {
249
201
  let themeNames;
250
202
  if (theme === "all") {
251
203
  themeNames = Object.keys(themesConfig);
252
- } else if (themesConfig[theme]) {
204
+ }
205
+ else if (themesConfig[theme]) {
253
206
  themeNames = [theme];
254
- } else {
207
+ }
208
+ else {
255
209
  console.error(chalk.red(`Theme "${theme}" does not exist.`));
256
210
  process.exit(1);
257
211
  }
258
212
  if (options.typecheck) {
259
213
  await typecheckThemes(themeNames);
260
- } else {
214
+ }
215
+ else {
261
216
  await buildThemes(themeNames);
262
217
  }
263
218
  }
219
+ //# sourceMappingURL=buildThemes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"buildThemes.js","sourceRoot":"","sources":["../../src/cli/buildThemes.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,YAAY,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,cAAc,MAAM,2BAA2B,CAAC;AACvD,OAAO,sBAAsB,MAAM,mCAAmC,CAAC;AACvE,OAAO,kBAAkB,MAAM,gCAAgC,CAAC;AAChE,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,MAAM,CAAC,MAAM,EAAE,CAAC;AAEhB,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC;AAE9B,OAAO;KACF,MAAM,CAAC,iBAAiB,EAAE,0BAA0B,CAAC;KACrD,MAAM,CAAC,cAAc,EAAE,iDAAiD,CAAC;KACzE,MAAM,CAAC,aAAa,EAAE,2DAA2D,CAAC,CAAC;AAExF,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;AAE5B,MAAM,OAAO,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC;AAC/B,MAAM,YAAY,GAAG,cAAc,CAAC,gBAAgB,EAAE,CAAC,MAAM,CAAC;AAE9D,IAAI,OAAO,CAAC,SAAS,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;IACtC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,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CAAC,CAAC;IACpB,CAAC;IACD,IAAI,OAAO,CAAC,SAAS,EAAE,CAAC;QACpB,MAAM,eAAe,CAAC,UAAU,CAAC,CAAC;IACtC,CAAC;SAAM,CAAC;QACJ,MAAM,WAAW,CAAC,UAAU,CAAC,CAAC;IAClC,CAAC;AACL,CAAC"}
@@ -0,0 +1,16 @@
1
+ export declare const MAGENTO_ROOT: string;
2
+ export declare const DEPENDENCY_CONFIG_FILENAME = "mage_obsidian_frontend_modules.json";
3
+ export declare const MAGENTO_CONFIG_RELATIVE_PATH = "app/etc/";
4
+ export declare const DEPENDENCY_CONFIG_FILE_PATH: string;
5
+ export declare const MODULE_WEB_PATH = "view/frontend/web/";
6
+ export declare const MODULE_TEMPLATES_PATH = "view/frontend/templates";
7
+ export declare const THEME_MODULE_WEB_PATH = "web/";
8
+ export declare const MODULE_CSS_FOLDER = "css";
9
+ export declare const THEME_CSS_FOLDER = "css";
10
+ export declare const OUTPUT_THEME_DIR = "web/generated";
11
+ export declare const OUTPUT_JS_DIR = "js/";
12
+ export declare const OUTPUT_CSS_DIR = "css/";
13
+ export declare const PRECOMPILED_FOLDER = ".precompiled";
14
+ export declare const INTERCEPTORS_FOLDER = "interceptors";
15
+ export declare const ALL_JS_VUE_FILES_WITH_INHERITANCE_FILE_NAME = "allJsVueFilesWithInheritance.json";
16
+ //# sourceMappingURL=default.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"default.d.ts","sourceRoot":"","sources":["../../src/config/default.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,YAAY,QAEc,CAAC;AAExC,eAAO,MAAM,0BAA0B,wCAAwC,CAAC;AAChF,eAAO,MAAM,4BAA4B,aAAa,CAAC;AACvD,eAAO,MAAM,2BAA2B,QAIvC,CAAC;AAEF,eAAO,MAAM,eAAe,uBAAuB,CAAC;AACpD,eAAO,MAAM,qBAAqB,4BAA4B,CAAC;AAC/D,eAAO,MAAM,qBAAqB,SAAS,CAAC;AAC5C,eAAO,MAAM,iBAAiB,QAAQ,CAAC;AAEvC,eAAO,MAAM,gBAAgB,QAAQ,CAAC;AAEtC,eAAO,MAAM,gBAAgB,kBAAkB,CAAC;AAChD,eAAO,MAAM,aAAa,QAAQ,CAAC;AACnC,eAAO,MAAM,cAAc,SAAS,CAAC;AACrC,eAAO,MAAM,kBAAkB,iBAAiB,CAAC;AACjD,eAAO,MAAM,mBAAmB,iBAAiB,CAAC;AAElD,eAAO,MAAM,2CAA2C,sCAAsC,CAAC"}
@@ -1,31 +1,22 @@
1
1
  import path from "node:path";
2
-
3
2
  // The Vite harness runs from the `vite/` dir one level below the Magento root.
4
3
  // Allow an explicit root override so the engine is not tied to that cwd layout
5
4
  // (e.g. when invoked from elsewhere or in tests).
6
5
  export const MAGENTO_ROOT = process.env.MAGE_OBSIDIAN_MAGENTO_ROOT
7
6
  ? path.resolve(process.env.MAGE_OBSIDIAN_MAGENTO_ROOT)
8
7
  : path.resolve(process.cwd(), "..");
9
-
10
8
  export const DEPENDENCY_CONFIG_FILENAME = "mage_obsidian_frontend_modules.json";
11
9
  export const MAGENTO_CONFIG_RELATIVE_PATH = "app/etc/";
12
- export const DEPENDENCY_CONFIG_FILE_PATH = path.resolve(
13
- MAGENTO_ROOT,
14
- MAGENTO_CONFIG_RELATIVE_PATH,
15
- DEPENDENCY_CONFIG_FILENAME,
16
- );
17
-
10
+ export const DEPENDENCY_CONFIG_FILE_PATH = path.resolve(MAGENTO_ROOT, MAGENTO_CONFIG_RELATIVE_PATH, DEPENDENCY_CONFIG_FILENAME);
18
11
  export const MODULE_WEB_PATH = "view/frontend/web/";
19
12
  export const MODULE_TEMPLATES_PATH = "view/frontend/templates";
20
13
  export const THEME_MODULE_WEB_PATH = "web/";
21
14
  export const MODULE_CSS_FOLDER = "css";
22
-
23
15
  export const THEME_CSS_FOLDER = "css";
24
-
25
16
  export const OUTPUT_THEME_DIR = "web/generated";
26
17
  export const OUTPUT_JS_DIR = "js/";
27
18
  export const OUTPUT_CSS_DIR = "css/";
28
19
  export const PRECOMPILED_FOLDER = ".precompiled";
29
20
  export const INTERCEPTORS_FOLDER = "interceptors";
30
-
31
21
  export const ALL_JS_VUE_FILES_WITH_INHERITANCE_FILE_NAME = "allJsVueFilesWithInheritance.json";
22
+ //# sourceMappingURL=default.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"default.js","sourceRoot":"","sources":["../../src/config/default.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,+EAA+E;AAC/E,+EAA+E;AAC/E,kDAAkD;AAClD,MAAM,CAAC,MAAM,YAAY,GAAG,OAAO,CAAC,GAAG,CAAC,0BAA0B;IAC9D,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,0BAA0B,CAAC;IACtD,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,IAAI,CAAC,CAAC;AAExC,MAAM,CAAC,MAAM,0BAA0B,GAAG,qCAAqC,CAAC;AAChF,MAAM,CAAC,MAAM,4BAA4B,GAAG,UAAU,CAAC;AACvD,MAAM,CAAC,MAAM,2BAA2B,GAAG,IAAI,CAAC,OAAO,CACnD,YAAY,EACZ,4BAA4B,EAC5B,0BAA0B,CAC7B,CAAC;AAEF,MAAM,CAAC,MAAM,eAAe,GAAG,oBAAoB,CAAC;AACpD,MAAM,CAAC,MAAM,qBAAqB,GAAG,yBAAyB,CAAC;AAC/D,MAAM,CAAC,MAAM,qBAAqB,GAAG,MAAM,CAAC;AAC5C,MAAM,CAAC,MAAM,iBAAiB,GAAG,KAAK,CAAC;AAEvC,MAAM,CAAC,MAAM,gBAAgB,GAAG,KAAK,CAAC;AAEtC,MAAM,CAAC,MAAM,gBAAgB,GAAG,eAAe,CAAC;AAChD,MAAM,CAAC,MAAM,aAAa,GAAG,KAAK,CAAC;AACnC,MAAM,CAAC,MAAM,cAAc,GAAG,MAAM,CAAC;AACrC,MAAM,CAAC,MAAM,kBAAkB,GAAG,cAAc,CAAC;AACjD,MAAM,CAAC,MAAM,mBAAmB,GAAG,cAAc,CAAC;AAElD,MAAM,CAAC,MAAM,2CAA2C,GAAG,mCAAmC,CAAC"}
@@ -0,0 +1,38 @@
1
+ interface ModuleDefinition {
2
+ src: string;
3
+ [key: string]: any;
4
+ }
5
+ interface ThemeDefinition {
6
+ src: string;
7
+ parent?: string;
8
+ [key: string]: any;
9
+ }
10
+ export declare const getMagentoConfig: () => any;
11
+ export declare const getContractHash: () => any;
12
+ export declare const getModulesConfigArray: () => [string, ModuleDefinition][];
13
+ export declare const getThemesConfigArray: () => [string, ThemeDefinition][];
14
+ export declare const getAllMagentoModulesEnabled: () => any;
15
+ export declare const isDev: () => boolean;
16
+ export declare const getOutputDirFromTheme: (themePath: any) => string;
17
+ export declare const getModuleDefinition: (moduleName: any) => ModuleDefinition;
18
+ export declare const getThemeDefinition: (themeName: any) => ThemeDefinition;
19
+ export declare const MODE: string;
20
+ export declare function resolveLibPath(lib: any): string;
21
+ export declare function resolveNodePath(packageName: any): string;
22
+ export declare function resolveLibRealPath(lib: any): any;
23
+ declare const _default: {
24
+ getMagentoConfig: () => any;
25
+ getContractHash: () => any;
26
+ getModulesConfigArray: () => [string, ModuleDefinition][];
27
+ getThemesConfigArray: () => [string, ThemeDefinition][];
28
+ getAllMagentoModulesEnabled: () => any;
29
+ isDev: () => boolean;
30
+ getOutputDirFromTheme: (themePath: any) => string;
31
+ getModuleDefinition: (moduleName: any) => ModuleDefinition;
32
+ getThemeDefinition: (themeName: any) => ThemeDefinition;
33
+ resolveLibPath: typeof resolveLibPath;
34
+ resolveNodePath: typeof resolveNodePath;
35
+ resolveLibRealPath: typeof resolveLibRealPath;
36
+ };
37
+ export default _default;
38
+ //# sourceMappingURL=configResolver.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"configResolver.d.ts","sourceRoot":"","sources":["../../src/core/configResolver.ts"],"names":[],"mappings":"AAYA,UAAU,gBAAgB;IACtB,GAAG,EAAE,MAAM,CAAC;IACZ,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACtB;AAED,UAAU,eAAe;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACtB;AAmED,eAAO,MAAM,gBAAgB,WAAsB,CAAC;AACpD,eAAO,MAAM,eAAe,WAG3B,CAAC;AACF,eAAO,MAAM,qBAAqB,QACW,CAAC,MAAM,EAAE,gBAAgB,CAAC,EAAE,CAAC;AAC1E,eAAO,MAAM,oBAAoB,QACW,CAAC,MAAM,EAAE,eAAe,CAAC,EAAE,CAAC;AACxE,eAAO,MAAM,2BAA2B,WAAiC,CAAC;AAC1E,eAAO,MAAM,KAAK,eAA4C,CAAC;AAE/D,eAAO,MAAM,qBAAqB,GAAI,cAAS,WAA8C,CAAC;AAE9F,eAAO,MAAM,mBAAmB,GAAI,eAAU,KAAG,gBACZ,CAAC;AAEtC,eAAO,MAAM,kBAAkB,GAAI,cAAS,KAAG,eAAkD,CAAC;AAElG,eAAO,MAAM,IAAI,QAAuB,CAAC;AAEzC,wBAAgB,cAAc,CAAC,GAAG,KAAA,UAEjC;AAED,wBAAgB,eAAe,CAAC,WAAW,KAAA,UAQ1C;AAED,wBAAgB,kBAAkB,CAAC,GAAG,KAAA,OAErC;;;;iCA/B4C,CAAC,MAAM,EAAE,gBAAgB,CAAC,EAAE;gCAE7B,CAAC,MAAM,EAAE,eAAe,CAAC,EAAE;;;;8CAMtB,gBAAgB;4CAGlB,eAAe;;;;;AAsB9D,wBAaE"}
@@ -1,63 +1,39 @@
1
1
  import fs from "node:fs";
2
2
  import path from "node:path";
3
3
  import crypto from "node:crypto";
4
- import { DEPENDENCY_CONFIG_FILE_PATH, OUTPUT_THEME_DIR } from "../config/default.ts";
5
- import { validateContract } from "./contractValidator.ts";
6
-
7
- const REGENERATE_HINT =
8
- "Try running `bin/magento mage-obsidian:frontend:config --generate` to generate the configuration file.";
9
-
10
- // Minimal shapes for the generated contract entries. Only `src` (and the theme
11
- // `parent`) are typed today; the rest stays open as the engine is typed
12
- // progressively. The contract itself is validated at runtime by validateContract.
13
- interface ModuleDefinition {
14
- src: string;
15
- [key: string]: any;
16
- }
17
-
18
- interface ThemeDefinition {
19
- src: string;
20
- parent?: string;
21
- [key: string]: any;
22
- }
23
-
4
+ import { DEPENDENCY_CONFIG_FILE_PATH, OUTPUT_THEME_DIR } from "../config/default.js";
5
+ import { validateContract } from "./contractValidator.js";
6
+ const REGENERATE_HINT = "Try running `bin/magento mage-obsidian:frontend:config --generate` to generate the configuration file.";
24
7
  // Cached contract, invalidated by the file's mtime. A per-process `const` read
25
8
  // at import time never picked up a regenerated contract (e.g. a module enabled
26
9
  // while a long-lived dev server runs), so caches keyed only by theme served
27
10
  // stale results. Reloading on mtime change makes the contract — and the hash
28
11
  // derived from it — track the file.
29
12
  let cached = null; // { mtimeMs, config, hash }
30
-
31
13
  function fail(message, extra = []) {
32
14
  console.error(message);
33
15
  extra.forEach((line) => console.error(line));
34
16
  console.error(REGENERATE_HINT);
35
17
  process.exit(1);
36
18
  }
37
-
38
19
  function loadContract() {
39
20
  let stats;
40
21
  try {
41
22
  stats = fs.statSync(DEPENDENCY_CONFIG_FILE_PATH);
42
- } catch (error) {
43
- fail(
44
- `Error reading configuration file at ${DEPENDENCY_CONFIG_FILE_PATH}: ${error.message}`,
45
- );
46
23
  }
47
-
24
+ catch (error) {
25
+ fail(`Error reading configuration file at ${DEPENDENCY_CONFIG_FILE_PATH}: ${error.message}`);
26
+ }
48
27
  if (cached && cached.mtimeMs === stats.mtimeMs) {
49
28
  return cached.config;
50
29
  }
51
-
52
30
  let config;
53
31
  try {
54
32
  config = JSON.parse(fs.readFileSync(DEPENDENCY_CONFIG_FILE_PATH, "utf-8"));
55
- } catch (error) {
56
- fail(
57
- `Error reading or parsing configuration file at ${DEPENDENCY_CONFIG_FILE_PATH}: ${error.message}`,
58
- );
59
33
  }
60
-
34
+ catch (error) {
35
+ fail(`Error reading or parsing configuration file at ${DEPENDENCY_CONFIG_FILE_PATH}: ${error.message}`);
36
+ }
61
37
  const validation = validateContract(config);
62
38
  if (!validation.ok) {
63
39
  fail(`Invalid MageObsidian frontend contract at ${DEPENDENCY_CONFIG_FILE_PATH}:`, [
@@ -65,66 +41,50 @@ function loadContract() {
65
41
  "If the version differs, the PHP module and JS engine are out of sync — align their versions, then regenerate.",
66
42
  ]);
67
43
  }
68
-
69
44
  // Hash the parts that change the build graph (which modules/themes exist and
70
45
  // their resolution). Caches downstream key on this so a changed module set
71
46
  // invalidates them, rather than serving a result keyed only by theme name.
72
47
  const hash = crypto
73
48
  .createHash("sha1")
74
- .update(
75
- JSON.stringify({
76
- modules: config.modules,
77
- themes: config.themes,
78
- allModules: config.allModules,
79
- }),
80
- )
49
+ .update(JSON.stringify({
50
+ modules: config.modules,
51
+ themes: config.themes,
52
+ allModules: config.allModules,
53
+ }))
81
54
  .digest("hex");
82
-
83
55
  cached = { mtimeMs: stats.mtimeMs, config, hash };
84
56
  return config;
85
57
  }
86
-
87
58
  const getContract = () => loadContract();
88
-
89
59
  export const getMagentoConfig = () => getContract();
90
60
  export const getContractHash = () => {
91
61
  getContract();
92
62
  return cached.hash;
93
63
  };
94
- export const getModulesConfigArray = () =>
95
- Object.entries(getContract().modules) as [string, ModuleDefinition][];
96
- export const getThemesConfigArray = () =>
97
- Object.entries(getContract().themes) as [string, ThemeDefinition][];
64
+ export const getModulesConfigArray = () => Object.entries(getContract().modules);
65
+ export const getThemesConfigArray = () => Object.entries(getContract().themes);
98
66
  export const getAllMagentoModulesEnabled = () => getContract().allModules;
99
67
  export const isDev = () => getContract().mode !== "production";
100
-
101
68
  export const getOutputDirFromTheme = (themePath) => path.resolve(themePath, OUTPUT_THEME_DIR);
102
-
103
- export const getModuleDefinition = (moduleName): ModuleDefinition =>
104
- getContract().modules[moduleName];
105
-
106
- export const getThemeDefinition = (themeName): ThemeDefinition => getContract().themes[themeName];
107
-
69
+ export const getModuleDefinition = (moduleName) => getContract().modules[moduleName];
70
+ export const getThemeDefinition = (themeName) => getContract().themes[themeName];
108
71
  export const MODE = process.env.NODE_ENV;
109
-
110
72
  export function resolveLibPath(lib) {
111
73
  return path.join(getContract().LIB_PATH, lib);
112
74
  }
113
-
114
75
  export function resolveNodePath(packageName) {
115
76
  try {
116
77
  const resolvedPath = import.meta.resolve(packageName);
117
78
  return resolvedPath.replace("file://", "");
118
- } catch (error) {
79
+ }
80
+ catch (error) {
119
81
  console.error(`The package ${packageName} can't be resolved.`);
120
82
  throw error;
121
83
  }
122
84
  }
123
-
124
85
  export function resolveLibRealPath(lib) {
125
86
  return MODE === "production" ? lib : resolveNodePath(lib);
126
87
  }
127
-
128
88
  export default {
129
89
  getMagentoConfig,
130
90
  getContractHash,
@@ -139,3 +99,4 @@ export default {
139
99
  resolveNodePath,
140
100
  resolveLibRealPath,
141
101
  };
102
+ //# sourceMappingURL=configResolver.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"configResolver.js","sourceRoot":"","sources":["../../src/core/configResolver.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,MAAM,MAAM,aAAa,CAAC;AACjC,OAAO,EAAE,2BAA2B,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACrF,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE1D,MAAM,eAAe,GACjB,wGAAwG,CAAC;AAgB7G,+EAA+E;AAC/E,+EAA+E;AAC/E,4EAA4E;AAC5E,6EAA6E;AAC7E,oCAAoC;AACpC,IAAI,MAAM,GAAG,IAAI,CAAC,CAAC,4BAA4B;AAE/C,SAAS,IAAI,CAAC,OAAO,EAAE,KAAK,GAAG,EAAE;IAC7B,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IACvB,KAAK,CA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EAAE,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;AAEtC,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,SAAS,EAAmB,EAAE,CAAC,WAAW,EAAE,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;AAElG,MAAM,CAAC,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC;AAEzC,MAAM,UAAU,cAAc,CAAC,GAAG;IAC9B,OAAO,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;AAClD,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,WAAW;IACvC,IAAI,CAAC;QACD,MAAM,YAAY,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;QACtD,OAAO,YAAY,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;IAC/C,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACb,OAAO,CAAC,KAAK,CAAC,eAAe,WAAW,qBAAqB,CAAC,CAAC;QAC/D,MAAM,KAAK,CAAC;IAChB,CAAC;AACL,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAC,GAAG;IAClC,OAAO,IAAI,KAAK,YAAY,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC;AAC9D,CAAC;AAED,eAAe;IACX,gBAAgB;IAChB,eAAe;IACf,qBAAqB;IACrB,oBAAoB;IACpB,2BAA2B;IAC3B,KAAK;IACL,qBAAqB;IACrB,mBAAmB;IACnB,kBAAkB;IAClB,cAAc;IACd,eAAe;IACf,kBAAkB;CACrB,CAAC"}
@@ -0,0 +1,16 @@
1
+ export declare const EXPECTED_SCHEMA_VERSION = "1.0.0";
2
+ export declare const REQUIRED_CONTRACT_KEYS: string[];
3
+ /**
4
+ * Validate the parsed frontend contract.
5
+ *
6
+ * Pure: no IO, no process exit. The caller decides how to react to errors.
7
+ *
8
+ * @param {unknown} config Parsed contract object.
9
+ * @param {string} [expectedVersion] Schema version the caller expects.
10
+ * @returns {{ ok: boolean, errors: string[] }}
11
+ */
12
+ export declare function validateContract(config: any, expectedVersion?: string): {
13
+ ok: boolean;
14
+ errors: any[];
15
+ };
16
+ //# sourceMappingURL=contractValidator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contractValidator.d.ts","sourceRoot":"","sources":["../../src/core/contractValidator.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,uBAAuB,UAAU,CAAC;AAI/C,eAAO,MAAM,sBAAsB,UAgBlC,CAAC;AAEF;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,KAAA,EAAE,eAAe,SAA0B;;;EAqBjF"}