@salty-css/core 0.0.1-alpha.324 → 0.0.1-alpha.326

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.
@@ -5,9 +5,10 @@ const path = require("path");
5
5
  const compiler_helpers = require("../compiler/helpers.cjs");
6
6
  const resolveDynamicConfigCache = async () => {
7
7
  const corePackageRoot = compiler_helpers.getCorePackageRoot();
8
+ if (!corePackageRoot) throw new Error("Could not resolve core package root");
8
9
  const coreConfigDest = path.join(corePackageRoot, "cache/config-cache.json");
9
10
  const contents = await promises.readFile(coreConfigDest, "utf8");
10
- if (!contents) throw new Error("Could not find config cache file");
11
+ if (!contents) throw new Error(`Could not find config cache file at ${coreConfigDest}`);
11
12
  return JSON.parse(contents);
12
13
  };
13
14
  exports.resolveDynamicConfigCache = resolveDynamicConfigCache;
@@ -3,9 +3,10 @@ import { join } from "path";
3
3
  import { getCorePackageRoot } from "../compiler/helpers.js";
4
4
  const resolveDynamicConfigCache = async () => {
5
5
  const corePackageRoot = getCorePackageRoot();
6
+ if (!corePackageRoot) throw new Error("Could not resolve core package root");
6
7
  const coreConfigDest = join(corePackageRoot, "cache/config-cache.json");
7
8
  const contents = await readFile(coreConfigDest, "utf8");
8
- if (!contents) throw new Error("Could not find config cache file");
9
+ if (!contents) throw new Error(`Could not find config cache file at ${coreConfigDest}`);
9
10
  return JSON.parse(contents);
10
11
  };
11
12
  export {
@@ -3,11 +3,18 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const path = require("path");
4
4
  var _documentCurrentScript = typeof document !== "undefined" ? document.currentScript : null;
5
5
  const getCorePackageRoot = () => {
6
- let { pathname } = new URL(typeof document === "undefined" ? require("url").pathToFileURL(__filename).href : _documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === "SCRIPT" && _documentCurrentScript.src || new URL("compiler/helpers.cjs", document.baseURI).href);
7
- while (/core\/?(src\/)?$/.test(pathname) === false) {
8
- pathname = path.join(pathname, "../");
6
+ try {
7
+ console.log("getCorePackageRoot import.meta.url:", typeof document === "undefined" ? require("url").pathToFileURL(__filename).href : _documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === "SCRIPT" && _documentCurrentScript.src || new URL("compiler/helpers.cjs", document.baseURI).href);
8
+ let { pathname } = new URL(typeof document === "undefined" ? require("url").pathToFileURL(__filename).href : _documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === "SCRIPT" && _documentCurrentScript.src || new URL("compiler/helpers.cjs", document.baseURI).href);
9
+ console.log("getCorePackageRoot pathname start:", pathname);
10
+ while (/core\/?(src\/)?$/.test(pathname) === false) {
11
+ pathname = path.join(pathname, "../");
12
+ }
13
+ return pathname;
14
+ } catch (error) {
15
+ console.error("Error in getCorePackageRoot:", error);
16
+ return void 0;
9
17
  }
10
- return pathname;
11
18
  };
12
19
  const resolveExportValue = async (value, maxLevel = 10, _level = 0) => {
13
20
  if (_level >= maxLevel) return value;
@@ -1,4 +1,4 @@
1
- export declare const getCorePackageRoot: () => string;
1
+ export declare const getCorePackageRoot: () => string | undefined;
2
2
  export declare const resolveExportValue: <T>(value: unknown, maxLevel?: number, _level?: number) => Promise<T>;
3
3
  export declare const saltyFileExtensions: string[];
4
4
  export declare const saltyFileRegExp: (additional?: string[]) => RegExp;
@@ -1,10 +1,17 @@
1
1
  import { join } from "path";
2
2
  const getCorePackageRoot = () => {
3
- let { pathname } = new URL(import.meta.url);
4
- while (/core\/?(src\/)?$/.test(pathname) === false) {
5
- pathname = join(pathname, "../");
3
+ try {
4
+ console.log("getCorePackageRoot import.meta.url:", import.meta.url);
5
+ let { pathname } = new URL(import.meta.url);
6
+ console.log("getCorePackageRoot pathname start:", pathname);
7
+ while (/core\/?(src\/)?$/.test(pathname) === false) {
8
+ pathname = join(pathname, "../");
9
+ }
10
+ return pathname;
11
+ } catch (error) {
12
+ console.error("Error in getCorePackageRoot:", error);
13
+ return void 0;
6
14
  }
7
- return pathname;
8
15
  };
9
16
  const resolveExportValue = async (value, maxLevel = 10, _level = 0) => {
10
17
  if (_level >= maxLevel) return value;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salty-css/core",
3
- "version": "0.0.1-alpha.324",
3
+ "version": "0.0.1-alpha.326",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.mjs",
6
6
  "typings": "./dist/index.d.ts",