@protobase/cli 0.114.0 → 0.115.0

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.
@@ -15,10 +15,11 @@ const reactPackages = /* @__PURE__ */ new Set([
15
15
  /** Whether a module goes in the `react` chunk. */
16
16
  const isReactModule = (id) => reactPackages.has(npmPackage(id) ?? "");
17
17
  /**
18
- * Whether a module goes in the `vendor` chunk: a third-party one but React's and the icons'. The icons stay in `app`,
19
- * since the app picks up a new one on many releases, which would change `vendor` and every lazy chunk that imports it.
18
+ * Whether a module goes in `vendor` or its package's `lib-` chunk: a third-party one but React's and the icons'. The
19
+ * icons stay with the code that draws them, since the app picks up a new one on many releases, which would change the
20
+ * chunk they are in and every chunk that imports it.
20
21
  */
21
- const isVendorModule = (id) => {
22
+ const isLibModule = (id) => {
22
23
  const name = npmPackage(id);
23
24
  return name !== void 0 && !reactPackages.has(name) && name !== "lucide-react";
24
25
  };
@@ -27,34 +28,43 @@ const workflowsDir = path.resolve(path.dirname(createRequire(uiEntry).resolve("@
27
28
  const slashed = (file) => file.replaceAll("\\", "/");
28
29
  /** Whether a module is one of the workflow engine's, which go in the `workflows` chunk: inside its folder, not beside it. */
29
30
  const isWorkflowsModule = (id, dir = workflowsDir) => slashed(id).startsWith(`${slashed(dir).replace(/\/$/, "")}/`);
30
- /** The chunk name of a third-party module only lazy code loads: its package's, such as `lib-xyflow-react`. */
31
+ /**
32
+ * Whether a module is the app's own code: no third-party one, no virtual module, page, stylesheet or workflow engine's.
33
+ * index.html's own script stays in its entry chunk, which then only imports `app`.
34
+ */
35
+ const isAppModule = (id) => npmPackage(id) === void 0 && !id.startsWith("\0") && !/\.(css|html)(\?|$)/.test(id) && !isWorkflowsModule(id);
36
+ /** The chunk name of a third-party module: its package's, such as `lib-xyflow-react`. */
31
37
  const libChunkName = (id) => `lib-${npmPackage(id).replace("@", "").replace("/", "-")}`;
32
38
  /**
33
- * The shell build's `output.codeSplitting`. `react` comes first: without it, `vendor` would take React in as a
34
- * dependency of the libraries it holds, and lazy chunks would import it from there.
39
+ * The shell build's `output.codeSplitting`, by priority. `react` comes first: without it, `vendor` would take React in
40
+ * as a dependency of the libraries it holds, and lazy chunks would import it from there. `$initial` is what an entry
41
+ * imports statically. A `lib-` chunk takes in none of its package's dependencies, which may be another package's too:
42
+ * the charts' would otherwise hold a module the table's library imports, and a list would load the charts.
35
43
  */
36
44
  const shellCodeSplitting = { groups: [
37
45
  {
38
46
  name: "react",
39
47
  test: isReactModule,
40
- priority: 2
48
+ priority: 3
41
49
  },
42
50
  {
43
51
  name: "vendor",
44
- test: (id) => isVendorModule(id) || id === preloadHelper,
52
+ test: (id) => isLibModule(id) || id === preloadHelper,
45
53
  tags: ["$initial"],
46
- priority: 1
54
+ priority: 2
47
55
  },
48
56
  {
49
- name: libChunkName,
50
- debugName: "lib",
51
- test: isVendorModule
57
+ name: "app",
58
+ test: isAppModule,
59
+ tags: ["$initial"],
60
+ priority: 2
52
61
  },
53
62
  {
54
- name: "workflows-start",
55
- test: (id) => isWorkflowsModule(id),
56
- tags: ["$initial"],
57
- priority: 1
63
+ name: libChunkName,
64
+ debugName: "lib",
65
+ test: isLibModule,
66
+ priority: 1,
67
+ includeDependenciesRecursively: false
58
68
  },
59
69
  {
60
70
  name: "workflows",
@@ -62,4 +72,4 @@ const shellCodeSplitting = { groups: [
62
72
  }
63
73
  ] };
64
74
  //#endregion
65
- export { isReactModule, isVendorModule, isWorkflowsModule, libChunkName, npmPackage, shellCodeSplitting };
75
+ export { isAppModule, isLibModule, isReactModule, isWorkflowsModule, libChunkName, npmPackage, shellCodeSplitting };
@@ -50,7 +50,7 @@ const shellIdentity = async () => {
50
50
  * names, and links the project's theme at /protobase.theme.css and its favicon at /protobase.favicon.svg, and registers its service worker. The modules plugins share with it have entries of
51
51
  * their own, which index.html's import map names. With `sourceMapsDir`, each script ends with a `//# debugId=` comment
52
52
  * and names no map, and its source map, carrying the same debug id, goes to the same place under `sourceMapsDir`. The
53
- * scripts split into react, vendor and app chunks (./shell-chunks), so an update mostly downloads only the app's.
53
+ * start loads react, vendor and app chunks and the pages load lazily (./shell-chunks), so an update mostly downloads only the app's code.
54
54
  */
55
55
  const buildShell = async (outDir, sourceMapsDir) => {
56
56
  const sourceMaps = sourceMapsDir !== void 0;
@@ -1,4 +1,4 @@
1
1
  //#region package.json
2
- var version = "0.114.0";
2
+ var version = "0.115.0";
3
3
  //#endregion
4
4
  export { version };
@@ -66,7 +66,7 @@ const sharedModulesPlugin = () => {
66
66
  index: path.join(root, "index.html"),
67
67
  ...Object.fromEntries(sharedModules.map((name) => [entryName(name), facadeId(name)]))
68
68
  },
69
- preserveEntrySignatures: "exports-only"
69
+ preserveEntrySignatures: "allow-extension"
70
70
  } } };
71
71
  },
72
72
  configResolved: (config) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@protobase/cli",
3
- "version": "0.114.0",
3
+ "version": "0.115.0",
4
4
  "description": "The protobase command: scaffold, doctor, dev, build and serve a Protobase project.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -43,13 +43,13 @@
43
43
  "dependencies": {
44
44
  "@better-auth/core": "^1.7.12",
45
45
  "@hono/node-server": "^2.1.3",
46
- "@protobase/config": "0.114.0",
47
- "@protobase/layout": "0.114.0",
48
- "@protobase/query": "0.114.0",
49
- "@protobase/schema": "0.114.0",
50
- "@protobase/server": "0.114.0",
51
- "@protobase/ui": "0.114.0",
52
- "@protobase/workflows": "0.114.0",
46
+ "@protobase/config": "0.115.0",
47
+ "@protobase/layout": "0.115.0",
48
+ "@protobase/query": "0.115.0",
49
+ "@protobase/schema": "0.115.0",
50
+ "@protobase/server": "0.115.0",
51
+ "@protobase/ui": "0.115.0",
52
+ "@protobase/workflows": "0.115.0",
53
53
  "@react-email/render": "^2.1.0",
54
54
  "@scalar/hono-api-reference": "^0.12.10",
55
55
  "@sentry/vite-plugin": "^11.10.0",
@@ -395,6 +395,7 @@ From `@protobase/ui`:
395
395
  | `RouteLink`, `RouteTarget` | An ordinary link to a target's `href`, which a plain click follows in the app, as `useComponentSelect().linkTo(key)` gives it. |
396
396
  | `FieldBadge`, `ToneEdge` | A record's value of a field as a badge in its view's words and colour, and a card's left edge in that colour, as the app's related cards draw them. |
397
397
  | `AuthLayout`, `CodeForm`, `ResendCodeButton`, `Button`, `buttonClass`, `Input`, `Spinner`, `LogoMark` | The pieces of the app's sign-in pages, for a page of a plugin or a host's own that looks like them. Outside the app, `@protobase/ui/styles.css` is the stylesheet that draws them, for a Vite build with Tailwind. |
398
+ | `showTextsIn(locale)` | Loads the app's built-in texts in a language (`'en'` or `'nl'`), each language its own download, and draws the pieces above in it. A host's own page that draws them outside the app awaits it before it renders them; the app picks its language itself. |
398
399
  | `isFramed`, `useArmedAfterFocus`, `useGuardedPress`, `allowDelayMs` | The connect page's guard against clickjacking and click-through, for a host's own consent screen: it refuses to render when `isFramed()`, and its Allow button spreads `useGuardedPress(armed, onAllow)`, so a press counts only once the page has been in front for `allowDelayMs`, and a press anywhere on the page before then starts that wait again. |
399
400
  | `pluginApi` | The plugin API of the app's `@protobase/ui`. |
400
401
  | `protobaseVersion` | The Protobase version of the app's `@protobase/ui`. |