@arcote.tech/platform 0.6.1 → 0.7.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.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@arcote.tech/platform",
3
3
  "type": "module",
4
- "version": "0.6.1",
4
+ "version": "0.7.0",
5
5
  "private": false,
6
6
  "author": "Przemysław Krasiński [arcote.tech]",
7
7
  "description": "Arc Platform — module system, router, layout, theme, i18n, platform app shell",
@@ -10,19 +10,25 @@
10
10
  "exports": {
11
11
  ".": {
12
12
  "types": "./src/index.ts",
13
- "import": "./src/index.ts",
13
+ "bun": "./src/index.server.ts",
14
+ "node": "./src/index.server.ts",
15
+ "browser": "./src/index.ts",
14
16
  "default": "./src/index.ts"
17
+ },
18
+ "./server": {
19
+ "types": "./src/index.server.ts",
20
+ "default": "./src/index.server.ts"
15
21
  }
16
22
  },
17
23
  "scripts": {
18
24
  "type-check": "tsc --noEmit"
19
25
  },
20
26
  "dependencies": {
21
- "@arcote.tech/arc-ds": "^0.6.1",
22
- "@arcote.tech/arc-react": "^0.6.1"
27
+ "@arcote.tech/arc-ds": "^0.7.0",
28
+ "@arcote.tech/arc-react": "^0.7.0"
23
29
  },
24
30
  "peerDependencies": {
25
- "@arcote.tech/arc": "^0.6.1",
31
+ "@arcote.tech/arc": "^0.7.0",
26
32
  "@lingui/core": "^5.0.0",
27
33
  "@lingui/react": "^5.0.0",
28
34
  "framer-motion": "^12.0.0",
@@ -0,0 +1,84 @@
1
+ // Arc Platform — server entry (bun/node runtime)
2
+ //
3
+ // Subset of the public API that is safe to import in a server context:
4
+ // pure data + functions, no React, no DOM, no JSX runtime imports at top
5
+ // level. Used by:
6
+ // - access-extractor subprocess (PRE-bundle discovery of protectedBy rules)
7
+ // - server bundles per context package (resolve @arcote.tech/platform
8
+ // through Bun's `bun` export condition)
9
+ //
10
+ // Shares the same `registry` module instance with the browser entry — both
11
+ // reference the SAME ./registry file, so `module().build()` in user code
12
+ // and `getAllModuleAccess()` in extractor observe a single source of truth.
13
+
14
+ // Module system
15
+ export {
16
+ module,
17
+ page,
18
+ wrapper,
19
+ slot,
20
+ contextElement,
21
+ contextFragments,
22
+ } from "./arc";
23
+ /** @deprecated Use module() instead */
24
+ export { arc } from "./arc";
25
+
26
+ // Registry
27
+ export {
28
+ clearModules,
29
+ clearRegistry,
30
+ forceRegisterModule,
31
+ getAllFragments,
32
+ getAllModuleAccess,
33
+ getAllModules,
34
+ getAllRegisteredModules,
35
+ getContext,
36
+ getModuleAccess,
37
+ getContextElementFragments,
38
+ getDefaultLayout,
39
+ getModule,
40
+ getPageByPath,
41
+ getPlatformConfig,
42
+ getPageFragments,
43
+ getSlotFragments,
44
+ getVariantOverrides,
45
+ getWrapperFragments,
46
+ registerModule,
47
+ setContext,
48
+ setDefaultLayout,
49
+ setPlatformConfig,
50
+ setVariantOverrides,
51
+ subscribe,
52
+ subscribeContext,
53
+ unregisterModule,
54
+ } from "./registry";
55
+
56
+ export type { PlatformConfig, PlatformStorageConfig } from "./registry";
57
+
58
+ // Types
59
+ export type {
60
+ ArcComponent,
61
+ ArcFactory,
62
+ ArcFactoryMethods,
63
+ ArcFragment,
64
+ ArcLayoutComponent,
65
+ ArcModule,
66
+ BuildManifest,
67
+ BuiltModule,
68
+ ContextElementFragment,
69
+ ModuleAccess,
70
+ ModuleAccessRule,
71
+ ModuleDescriptor,
72
+ ExtractPages,
73
+ FragmentOrdering,
74
+ PageFragment,
75
+ PageOptions,
76
+ PageShellProps,
77
+ PublicArcFragment,
78
+ PublicPaths,
79
+ SlotFragment,
80
+ SlotId,
81
+ SlotOptions,
82
+ WrapperFragment,
83
+ WrapperOptions,
84
+ } from "./types";
@@ -11,9 +11,15 @@ export type ModuleLoaderState = "loading" | "ready" | "error";
11
11
  * URL for a module's JS file with cache-bust based on its content hash.
12
12
  * When a module's bytes change, hash changes → URL changes → ES module cache invalidated.
13
13
  * For explicit full reloads, pass `bust` (e.g. timestamp) to override.
14
+ *
15
+ * Server-filtered descriptors carry a signed `mod.url` (chunk-aware HMAC) for
16
+ * non-public chunks. Otherwise the path is `/modules/<chunk>/<file>` — public
17
+ * chunks are served without a signature.
14
18
  */
15
19
  function moduleUrl(baseUrl: string, mod: ModuleDescriptor, bust?: string): string {
16
- const base = mod.url ?? `${baseUrl}/modules/${mod.file}`;
20
+ const base = mod.url
21
+ ? `${baseUrl}${mod.url}`
22
+ : `${baseUrl}/modules/${mod.chunk}/${mod.file}`;
17
23
  const busterKey = bust ? "t" : "v";
18
24
  const busterVal = bust ?? mod.hash;
19
25
  if (!busterVal) return base;
package/src/types.ts CHANGED
@@ -100,16 +100,26 @@ export interface ModuleAccess {
100
100
  }
101
101
 
102
102
  export interface ModuleDescriptor {
103
+ /** Filename within the chunk directory, e.g. `myapp.js`. */
103
104
  readonly file: string;
104
105
  readonly name: string;
106
+ /**
107
+ * Chunk group this module belongs to. `"public"` for anonymous-accessible
108
+ * modules; any other value matches a `token.name` from `protectedBy(...)`.
109
+ * Physical layout: `.arc/platform/modules/<chunk>/<file>`.
110
+ */
111
+ readonly chunk: string;
105
112
  /** sha256 hex of the bundled .js content — used by deploy diff and client cache-bust. */
106
113
  readonly hash: string;
114
+ /** Signed URL — server fills this for non-public modules when filtering manifest per request. */
107
115
  readonly url?: string;
108
116
  }
109
117
 
110
118
  /** Build manifest written to .arc/platform/modules/manifest.json. */
111
119
  export interface BuildManifest {
112
120
  readonly modules: readonly ModuleDescriptor[];
121
+ /** All chunk group names present in this build (sorted). Always includes `"public"`. */
122
+ readonly chunks: readonly string[];
113
123
  /** sha256 hex over all shell bundle outputs concatenated. */
114
124
  readonly shellHash: string;
115
125
  /** sha256 hex over styles.css (+ theme.css if present). */