@skaldapp/shared 1.2.49 → 1.2.50

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.d.ts CHANGED
@@ -25,6 +25,7 @@ export declare const sharedStore: {
25
25
  $nodes: TPage[];
26
26
  isRedirect: ({ $parent, $prev }: TPage) => unknown;
27
27
  kvNodes: Record<string, TPage>;
28
+ LEAD_TRAIL_SLASH_RE: RegExp;
28
29
  nodes: TPage[];
29
30
  add: (pId: string) => string | undefined;
30
31
  addChild: (pId: string) => string | undefined;
package/dist/index.js CHANGED
@@ -7,7 +7,7 @@ import Credential from "./schemas/credential.js";
7
7
  import Nodes from "./schemas/nodes.js";
8
8
  import Page from "./schemas/page.js";
9
9
  dynamicDefaults.DEFAULTS["uuid"] = () => generateSlug;
10
- const isRedirect = ({ $parent, $prev }) => $parent?.frontmatter["template"] && !$prev, removeHiddens = (pages) => pages.filter(({ frontmatter: { hidden }, path }) => path !== undefined && !hidden);
10
+ const removeHiddens = (pages) => pages.filter(({ frontmatter: { hidden }, path }) => path !== undefined && !hidden);
11
11
  const esm = true, code = { esm }, coerceTypes = true, keywords = [dynamicDefaults()], removeAdditional = true, schemas = [Nodes, Page], useDefaults = true, ajv = new AJV({
12
12
  code,
13
13
  coerceTypes,
@@ -15,7 +15,7 @@ const esm = true, code = { esm }, coerceTypes = true, keywords = [dynamicDefault
15
15
  removeAdditional,
16
16
  schemas,
17
17
  useDefaults,
18
- }), immediate = true, properties = {
18
+ }), immediate = true, isRedirect = ({ $parent, $prev }) => $parent?.frontmatter["template"] && !$prev, LEAD_TRAIL_SLASH_RE = /^\/?|\/?$/g, properties = {
19
19
  $branch: {
20
20
  get() {
21
21
  return removeHiddens(this.branch);
@@ -64,7 +64,8 @@ const esm = true, code = { esm }, coerceTypes = true, keywords = [dynamicDefault
64
64
  },
65
65
  to: {
66
66
  get() {
67
- return this.path?.replace(/^\/?/, "/").replace(/\/?$/, "/");
67
+ const { path } = [...this.$branch].reverse().find((node) => !isRedirect(node)) ?? this;
68
+ return path?.replace(LEAD_TRAIL_SLASH_RE, "/");
68
69
  },
69
70
  },
70
71
  }, tree = ref([]), validate = Object.fromEntries(schemas.map(({ $id }) => [$id, ajv.getSchema($id)])), { kvNodes, nodes, ...flatJsonTree } = useFlatJsonTree(tree);
@@ -75,6 +76,7 @@ export const sharedStore = reactive({
75
76
  $nodes,
76
77
  isRedirect,
77
78
  kvNodes: kvNodes,
79
+ LEAD_TRAIL_SLASH_RE,
78
80
  nodes: nodes,
79
81
  });
80
82
  watch(toRef(sharedStore, "nodes"), async (value) => {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://www.schemastore.org/package",
3
3
  "name": "@skaldapp/shared",
4
- "version": "1.2.49",
4
+ "version": "1.2.50",
5
5
  "description": "A TypeScript library providing reactive data structures, JSON schema validation, and tree utilities for Vue-based applications in the skald ecosystem.",
6
6
  "keywords": [
7
7
  "vue",
@@ -22,8 +22,12 @@
22
22
  },
23
23
  "license": "AGPL-3.0-or-later",
24
24
  "author": "Jerry Bruwes <jbruwes@gmail.com> (https://jbruwes.github.io)",
25
+ "sideEffects": false,
25
26
  "type": "module",
26
- "main": "dist/index.js",
27
+ "exports": {
28
+ ".": "./dist/index.js"
29
+ },
30
+ "main": "./dist/index.js",
27
31
  "files": [
28
32
  "dist"
29
33
  ],
@@ -33,16 +37,16 @@
33
37
  },
34
38
  "prettier": "@skaldapp/configs/prettierrc",
35
39
  "dependencies": {
36
- "@skaldapp/flat-json-tree": "^2.2.32",
40
+ "@skaldapp/flat-json-tree": "^2.2.34",
37
41
  "ajv": "^8.18.0",
38
42
  "ajv-keywords": "^5.1.0",
39
43
  "json-schema-to-ts": "^3.1.1",
40
44
  "random-word-slugs": "^0.1.7",
41
- "vue": "^3.5.28"
45
+ "vue": "^3.5.29"
42
46
  },
43
47
  "devDependencies": {
44
- "@skaldapp/configs": "^1.2.59",
48
+ "@skaldapp/configs": "^1.2.63",
45
49
  "@types/node": "^25.3.0",
46
- "eslint": "^9.39.2"
50
+ "eslint": "^9.39.3"
47
51
  }
48
52
  }