@karmaniverous/jeeves 0.1.1 → 0.1.2

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.
@@ -920,13 +920,22 @@ async function updateManagedSection(filePath, content, options = {}) {
920
920
  /**
921
921
  * Resolve the package's content directory.
922
922
  *
923
+ * @remarks
924
+ * Uses `package-directory` to locate the package root regardless of
925
+ * whether this code runs from `src/platform/` (dev) or `dist/` (bundled).
926
+ * Rollup flattens all source into `dist/index.js`, so static relative
927
+ * paths like `../../content/` break when consumed as a dependency.
928
+ *
923
929
  * @returns Absolute path to the content/ directory.
924
930
  */
925
931
  function getContentDir() {
926
- const thisFile = fileURLToPath(import.meta.url);
927
- // From src/platform/refreshPlatformContent.ts → ../../content/
928
- // From dist/platform/refreshPlatformContent.js → ../../content/
929
- return join(dirname(thisFile), '..', '..', 'content');
932
+ const pkgDir = packageDirectorySync({
933
+ cwd: fileURLToPath(import.meta.url),
934
+ });
935
+ if (!pkgDir) {
936
+ throw new Error('Could not find package root from ' + fileURLToPath(import.meta.url));
937
+ }
938
+ return join(pkgDir, 'content');
930
939
  }
931
940
  /**
932
941
  * Read a content file from the package's content/ directory.
package/dist/index.js CHANGED
@@ -892,13 +892,22 @@ function checkRegistryVersion(packageName, cacheDir, ttlSeconds = 3600) {
892
892
  /**
893
893
  * Resolve the package's content directory.
894
894
  *
895
+ * @remarks
896
+ * Uses `package-directory` to locate the package root regardless of
897
+ * whether this code runs from `src/platform/` (dev) or `dist/` (bundled).
898
+ * Rollup flattens all source into `dist/index.js`, so static relative
899
+ * paths like `../../content/` break when consumed as a dependency.
900
+ *
895
901
  * @returns Absolute path to the content/ directory.
896
902
  */
897
903
  function getContentDir() {
898
- const thisFile = fileURLToPath(import.meta.url);
899
- // From src/platform/refreshPlatformContent.ts → ../../content/
900
- // From dist/platform/refreshPlatformContent.js → ../../content/
901
- return join(dirname(thisFile), '..', '..', 'content');
904
+ const pkgDir = packageDirectorySync({
905
+ cwd: fileURLToPath(import.meta.url),
906
+ });
907
+ if (!pkgDir) {
908
+ throw new Error('Could not find package root from ' + fileURLToPath(import.meta.url));
909
+ }
910
+ return join(pkgDir, 'content');
902
911
  }
903
912
  /**
904
913
  * Read a content file from the package's content/ directory.
package/package.json CHANGED
@@ -138,5 +138,5 @@
138
138
  },
139
139
  "type": "module",
140
140
  "types": "dist/index.d.ts",
141
- "version": "0.1.1"
141
+ "version": "0.1.2"
142
142
  }