@zachhandley/ez-i18n 0.1.8 → 0.1.9

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/index.js CHANGED
@@ -152,8 +152,7 @@ function toRelativeImport(absolutePath, projectRoot) {
152
152
  }
153
153
  function toGlobPattern(baseDir, projectRoot) {
154
154
  const relativePath = path.relative(projectRoot, baseDir).replace(/\\/g, "/");
155
- const normalized = relativePath.startsWith(".") ? relativePath : "./" + relativePath;
156
- return `${normalized}/**/*.json`;
155
+ return `/${relativePath}/**/*.json`;
157
156
  }
158
157
  function getNamespaceFromPath(filePath, localeDir) {
159
158
  const relative2 = path.relative(localeDir, filePath);
@@ -52,7 +52,8 @@ declare function isCacheValid(cache: TranslationCache, projectRoot: string): boo
52
52
  */
53
53
  declare function toRelativeImport(absolutePath: string, projectRoot: string): string;
54
54
  /**
55
- * Generate a glob pattern for import.meta.glob from a base directory
55
+ * Generate a glob pattern for import.meta.glob from a base directory.
56
+ * In virtual modules, globs must start with '/' (project root relative).
56
57
  */
57
58
  declare function toGlobPattern(baseDir: string, projectRoot: string): string;
58
59
  /**
@@ -173,8 +173,7 @@ function toRelativeImport(absolutePath, projectRoot) {
173
173
  }
174
174
  function toGlobPattern(baseDir, projectRoot) {
175
175
  const relativePath = path.relative(projectRoot, baseDir).replace(/\\/g, "/");
176
- const normalized = relativePath.startsWith(".") ? relativePath : "./" + relativePath;
177
- return `${normalized}/**/*.json`;
176
+ return `/${relativePath}/**/*.json`;
178
177
  }
179
178
  function getNamespaceFromPath(filePath, localeDir) {
180
179
  const relative2 = path.relative(localeDir, filePath);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zachhandley/ez-i18n",
3
- "version": "0.1.8",
3
+ "version": "0.1.9",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -302,12 +302,13 @@ export function toRelativeImport(absolutePath: string, projectRoot: string): str
302
302
  }
303
303
 
304
304
  /**
305
- * Generate a glob pattern for import.meta.glob from a base directory
305
+ * Generate a glob pattern for import.meta.glob from a base directory.
306
+ * In virtual modules, globs must start with '/' (project root relative).
306
307
  */
307
308
  export function toGlobPattern(baseDir: string, projectRoot: string): string {
308
309
  const relativePath = path.relative(projectRoot, baseDir).replace(/\\/g, '/');
309
- const normalized = relativePath.startsWith('.') ? relativePath : './' + relativePath;
310
- return `${normalized}/**/*.json`;
310
+ // Virtual modules require globs to start with '/' (project root relative)
311
+ return `/${relativePath}/**/*.json`;
311
312
  }
312
313
 
313
314
  /**