@plitzi/sdk-navigation 0.38.16 → 0.38.18

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/CHANGELOG.md CHANGED
@@ -1,5 +1,118 @@
1
1
  # @plitzi/sdk-navigation
2
2
 
3
+ ## 0.38.18
4
+
5
+ ### Patch Changes
6
+
7
+ - b3023c9: ## Security
8
+
9
+ - **A page of the same site on another origin is no longer this server's own** (`@plitzi/sdk-server`): the guard
10
+ against writes another page caused (`crossSiteWrites`, the sign-in's login-CSRF check and `createOriginGuardMiddleware`)
11
+ trusted `Sec-Fetch-Site: same-site` — and a site has no port and spans every sub-domain, so another port of the host
12
+ (where `createAuthoringHost` serves pages an agent wrote) or a sibling sub-domain (every space of a platform on one
13
+ domain) could write as if it were the server's own page. Now only `same-origin` (and `none`, a typed URL) is; `same-site`
14
+ is refused 403 `reason: 'foreign'` unless its origin is named (`crossSiteWrites.origins`, `identity.platformOrigins`),
15
+ and the `Origin` fallback compares host and port. In production an app and its spaces are already on different sites,
16
+ so a deployment that works there needs nothing; one that relied on a sibling sub-domain locally names it.
17
+ `createAuthoringHost`'s docs now say to serve on a host of its own — a cookie belongs to a host whatever its port.
18
+
19
+ ## Server
20
+ - **An open page takes a new version of its space where it stands** (`@plitzi/sdk-server`, `@plitzi/plitzi-sdk`):
21
+ `server.updatePages(documents, { draft? })` hands the pages showing that space — or that draft — its new documents,
22
+ and each swaps them in place, its state, scroll and focus kept (`replaceSpace` on what the SDK's `render` returns;
23
+ `false`, and the page loads again, for a page with elements the server draws). The development loop of a project uses
24
+ it: a save to the space no longer reloads the open page. `createAuthoringHost`'s `put` over an id that pages show
25
+ hands them the new version and answers how many took it (`updated`), so a page an agent keeps improving is seen to
26
+ grow instead of reloading — no second iframe needed.
27
+ - **`devReload` is `livePages`** (`@plitzi/sdk-server`): the channel the open pages listen on now carries the space,
28
+ not only "load again", and a host that is not developing uses it too. Its address is `/__plitzi/live`; a draft's page
29
+ listens for its own changes alone (`?__pt=`). A plugin swapped where it is drawn stays a development server's
30
+ (`devMode`). `plitzi upgrade migrations --write` renames the option in a project's code (`livePagesOption`).
31
+
32
+ ## Packages
33
+ - **`@plitzi/sdk-server` starts in half the time** (`@plitzi/sdk-shared`, `@plitzi/sdk-server`): importing it took
34
+ ~310 ms, ~200 of them `date-fns` — 108 modules nothing on the server uses, brought by `@plitzi/sdk-shared/helpers` —
35
+ and loaded the browser's hooks and contexts of every folder of `@plitzi/sdk-shared` it read, `@plitzi/nexus/react`
36
+ with them. Now ~150 ms (`@plitzi/sdk-shared` 139 → 113 modules, `@plitzi/nexus` 53 → 31). What moved, each
37
+ rewritten by `plitzi upgrade migrations --write` (`movedExports`):
38
+ - the dates — `formatDate`, `formatDateUTC`, `formatFromNow`, `formatUTCToLocal`, `getDurationMs`, `isDate`,
39
+ `isValidFormat`, `parseDate`, `toUnixSeconds`, `SupportedLocale` — from `@plitzi/sdk-shared/helpers` to
40
+ `@plitzi/sdk-shared/dates`;
41
+ - React's bindings to an entry of their own beside each area, as `@plitzi/nexus/react` is: `useDisplayMode`,
42
+ `useElementSize` → `@plitzi/sdk-shared/style/react`; `SchemaContext` → `schema/react`; `PluginsContext` →
43
+ `plugins/react`; `DevToolsContext` → `devTools/react`; `useFlagResolution` → `flags/react` (`flagUserFrom` stays
44
+ in `flags`);
45
+ - `PROJECT_DATA_PREFIX` from `@plitzi/sdk-shared/server` to `@plitzi/sdk-shared/project/paths` — the project's
46
+ layout names, an entry a browser imports too (`@plitzi/sdk-shared/project` stays Node only and re-exports them).
47
+ The theme cookie's helpers (`themeFromCookies`…) are also `@plitzi/sdk-shared/theme/cookie`, still exported by
48
+ `@plitzi/sdk-shared/theme`.
49
+
50
+ `yarn check:server-footprint` (in CI after the build) holds what the server's root loads, package by package — Plitzi's
51
+ and every other — to a budget: a heavy library or a folder of hooks coming back fails with what came in.
52
+
53
+ ## CLI
54
+ - **`plitzi upgrade migrations --write` writes a file import's new home when it has one** (`@plitzi/cli`): the
55
+ `folderImports` migration of 0.38.17 named every import of a package's FILE and wrote none. It now reads the installed
56
+ declarations with the project's own TypeScript and rewrites each `import` / `export … from` whose every name the folder
57
+ exports under one name — `import usePlitzi from '@plitzi/sdk-shared/hooks/usePlitzi'` →
58
+ `import { usePlitzi } from '@plitzi/sdk-shared/hooks'`, `type` modifiers and aliases kept. What has no one answer is
59
+ said with why (a namespace import, an `import()` or mock, a name the folder does not export, a project with no
60
+ TypeScript). The report says which places `--write` writes (`writable` in `--json`) instead of calling every one
61
+ "yours to change"; a migration now gives each place its own `edit` in place of a whole-file `rewrite`
62
+ (`docs/en/releases.md`).
63
+ - **`plitzi doctor` says an import of a path the installed package does not export** (`@plitzi/cli`):
64
+ `import-not-exported`, an error, at the importing file — what Node otherwise reports at start as an
65
+ `ERR_MODULE_NOT_FOUND` into the package's `dist`, which reads as a broken install rather than a changed API. For a
66
+ `@plitzi` package the fix names `plitzi upgrade migrations --write`; for any other, its `exports`. Asked only of a
67
+ package that is installed.
68
+
69
+ - Updated dependencies [b3023c9]
70
+ - @plitzi/sdk-shared@0.38.18
71
+
72
+ ## 0.38.17
73
+
74
+ ### Patch Changes
75
+
76
+ - 4f8dc37: ## Packages
77
+
78
+ - **A library package is imported by its root and its folders, never by a file** (`@plitzi/sdk-shared`, `sdk-schema`,
79
+ `sdk-style`, `sdk-elements`, `sdk-interactions`, `sdk-auth`, `sdk-dev-tools`, `sdk-event-bridge`, `sdk-navigation`,
80
+ `sdk-plugins`, `sdk-variables`): each `exports` is now `"."` and `"./*"`, the latter a folder's `index`.
81
+ `@plitzi/sdk-shared/helpers/isRecord` becomes `import { isRecord } from '@plitzi/sdk-shared/helpers'`, and a default
82
+ export by the name its folder gives it — almost always its file's (`import usePlitzi from '…/hooks/usePlitzi'` →
83
+ `import { usePlitzi } from '@plitzi/sdk-shared/hooks'`). A file-level specifier now fails with `ERR_MODULE_NOT_FOUND`.
84
+ New entries where a folder barrel would have brought more than was asked for: `@plitzi/sdk-shared/project` and
85
+ `@plitzi/sdk-shared/plugins/bundle` (Node only), `@plitzi/sdk-interactions/declarations` (the global callbacks and
86
+ utility specs, without React), and `@plitzi/sdk-elements/elements/declarations`, which now also carries the
87
+ declarations' attribute types and the constants they are checked with. `RuleGroup` is exported by `@plitzi/sdk-shared`
88
+ with the document types that use it. `plitzi upgrade migrations` names every such import in a project, with the folder to
89
+ import it from instead.
90
+ - **`@plitzi/sdk-shared`'s root exports the document types, and only them** (`@plitzi/sdk-shared`): what the package
91
+ does is imported from its folder — `formatDate` from `@plitzi/sdk-shared/helpers`, `ThemeProvider` from
92
+ `@plitzi/sdk-shared/theme`, a GraphQL operation's types from `@plitzi/sdk-shared/network/graphql` — so a module that
93
+ imports a type from the root no longer loads every area of the package.
94
+ - **What one package alone used lives in that package** (`@plitzi/sdk-shared`, `@plitzi/sdk-elements`): the data
95
+ source hooks moved from `@plitzi/sdk-shared/dataSource/hooks` to `@plitzi/sdk-elements/dataSource`
96
+ (`useRegisterSource`, `useResolvedVariables`), and the Apollo links the builder's client is built with into the
97
+ builder.
98
+ - **The builder's panels are an entry of their own** (`@plitzi/sdk-style`, `@plitzi/sdk-variables`,
99
+ `@plitzi/sdk-elements`): the style inspector, the advanced style editor and `BuilderStyleContextProvider` are imported
100
+ from `@plitzi/sdk-style/builder`; the variables' lists and forms from `@plitzi/sdk-variables/builder`; the elements'
101
+ settings panels (`defaultElementsSettings`) from `@plitzi/sdk-elements/builder`. Each package's root keeps what a page
102
+ and a server use — `generateCache` no longer loads the inspector, on a server 227 modules down to 21.
103
+
104
+ ## CLI
105
+ - **`plitzi upgrade`'s `renames` part is now `migrations`** (`@plitzi/cli`): what a version changed that a project's
106
+ own source must follow, one file per change in the CLI's `src/migrations/changes/` with the version it shipped in —
107
+ rewritten with `--write` when it has one right answer, said otherwise. The `--json` report carries `migrations` (each
108
+ with its `migration`, `since`, `file`, `line`, `what` and whether it was `written`) in place of `renames` and
109
+ `changes`. The changes of 0.38.0 (`canTemplate` → `canSnippet`, the `*Template` authoring names), 0.38.9 (a
110
+ `formControl` without `required` is optional) and 0.38.12 (`usePlitziServiceContext` → `usePlitzi`) are no longer
111
+ looked for: a project still on one of those versions makes them by hand.
112
+
113
+ - Updated dependencies [4f8dc37]
114
+ - @plitzi/sdk-shared@0.38.17
115
+
3
116
  ## 0.38.16
4
117
 
5
118
  ### Patch Changes
@@ -1,2 +1 @@
1
- import { getPageFullPath as e, getPaths as t, getRouteParams as n, isPageAuthored as r, matchPath as i, matchRoutePath as a, notFoundPageFor as o } from "@plitzi/sdk-shared/navigation";
2
- export { e as getPageFullPath, t as getPaths, n as getRouteParams, r as isPageAuthored, i as matchPath, a as matchRoutePath, o as notFoundPageFor };
1
+ export { getPageFullPath, getPaths, getRouteParams, isPageAuthored, matchPath, matchRoutePath, notFoundPageFor } from "@plitzi/sdk-shared/navigation";
@@ -1,6 +1,6 @@
1
1
  import { get as e } from "@plitzi/plitzi-ui/helpers";
2
2
  import { useMemo as t } from "react";
3
- import { ParamsFromURL as n } from "@plitzi/sdk-shared/helpers/utils";
3
+ import { ParamsFromURL as n } from "@plitzi/sdk-shared/helpers";
4
4
  //#region src/hooks/useNavigation.ts
5
5
  var r = ({ server: r, routerLocation: i }) => {
6
6
  let a = t(() => typeof window < "u" ? window.location : e(r, "location", { pathname: "/" }), [r]), o = t(() => {
package/package.json CHANGED
@@ -1,26 +1,20 @@
1
1
  {
2
2
  "name": "@plitzi/sdk-navigation",
3
- "version": "0.38.16",
3
+ "version": "0.38.18",
4
4
  "license": "AGPL-3.0",
5
5
  "files": [
6
6
  "dist"
7
7
  ],
8
8
  "exports": {
9
9
  ".": {
10
+ "@plitzi/source": "./src/index.ts",
10
11
  "types": "./dist/index.d.ts",
11
12
  "import": "./dist/index.mjs"
12
13
  },
13
- "./NavigationHelper": {
14
- "types": "./dist/NavigationHelper.d.ts",
15
- "import": "./dist/NavigationHelper.mjs"
16
- },
17
- "./hooks/useNavigation": {
18
- "types": "./dist/hooks/useNavigation.d.ts",
19
- "import": "./dist/hooks/useNavigation.mjs"
20
- },
21
- "./index": {
22
- "types": "./dist/index.d.ts",
23
- "import": "./dist/index.mjs"
14
+ "./*": {
15
+ "@plitzi/source": "./src/*/index.ts",
16
+ "types": "./dist/*/index.d.ts",
17
+ "import": "./dist/*/index.mjs"
24
18
  }
25
19
  },
26
20
  "scripts": {
@@ -30,20 +24,20 @@
30
24
  "test:coverage": "vitest --coverage",
31
25
  "test:watch": "vitest",
32
26
  "test:ui": "vitest --ui",
33
- "build:dev": "vite build --mode development --minify false && node ../sdk-shared/scripts/generate-exports.mjs",
27
+ "build:dev": "vite build --mode development --minify false",
34
28
  "build:dev-watch": "vite build --mode development --watch --minify false",
35
- "build:prod": "vite build && node ../sdk-shared/scripts/generate-exports.mjs"
29
+ "build:prod": "vite build"
36
30
  },
37
31
  "type": "module",
38
32
  "sideEffects": false,
39
33
  "devDependencies": {
40
34
  "eslint": "^9.39.5",
41
- "react": "^19.3.0",
42
- "react-dom": "^19.3.0",
35
+ "react": "^19.3.1",
36
+ "react-dom": "^19.3.1",
43
37
  "react-router-dom": "^7.18.4",
44
38
  "typescript": "^6.0.3",
45
- "vite": "^8.3.2",
46
- "vitest": "^5.0.3"
39
+ "vite": "^8.3.4",
40
+ "vitest": "^5.0.5"
47
41
  },
48
42
  "peerDependencies": {
49
43
  "react": "^19",
@@ -51,6 +45,6 @@
51
45
  },
52
46
  "dependencies": {
53
47
  "@plitzi/plitzi-ui": "^1.6.33",
54
- "@plitzi/sdk-shared": "0.38.16"
48
+ "@plitzi/sdk-shared": "0.38.18"
55
49
  }
56
50
  }