@mpfrontend/access-react 0.1.0 → 1.1.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/README.md +8 -6
- package/dist/server.js +4 -0
- package/dist/server.js.map +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
# @mpfrontend/access-react
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
Part of [MP Frontend](https://github.com/panahister/mpfrontend), released to the public npm registry as one cohort: every `@mpfrontend`
|
|
4
|
+
package at the same exact version. Runtime: client, with a server-only entry. Install it through a workspace that `mpfrontend init`
|
|
5
|
+
created, which pins the cohort and binds the scope to the registry in `.npmrc`. [Versioning](https://github.com/panahister/mpfrontend#versioning)
|
|
6
|
+
states the compatibility policy and [Implementation status](https://github.com/panahister/mpfrontend/blob/main/docs/IMPLEMENTATION-STATUS.md) the
|
|
7
|
+
evidence.
|
|
7
8
|
|
|
8
9
|
React bindings for an access snapshot of `@mpfrontend/access-core`. The consumer's server decides what each
|
|
9
10
|
person may see and do: it resolves its own rules into an explicit snapshot (context reference, revision, expiry,
|
|
@@ -22,8 +23,9 @@ A malformed, expired or mismatched snapshot, a failed load and a slow one grant
|
|
|
22
23
|
`clientSnapshot(result, keys)` keeps only the keys a provider's components need (`pageKeys` and `navigationKeys`
|
|
23
24
|
of the page manifest), never identity or token data, and is `null` when nothing is granted.
|
|
24
25
|
|
|
25
|
-
The entry is
|
|
26
|
-
`ACCESS_SERVER_ENTRY_IN_BROWSER`.
|
|
26
|
+
The entry is kept out of a browser bundle by its `browser` export condition, which resolves to a module that throws
|
|
27
|
+
`ACCESS_SERVER_ENTRY_IN_BROWSER`. That holds for a bundler that reads export conditions; a bundler that does not reaches the
|
|
28
|
+
server entry itself, which throws the same error when a `document` exists.
|
|
27
29
|
|
|
28
30
|
## Client entry: `@mpfrontend/access-react`
|
|
29
31
|
|
package/dist/server.js
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import { parsePageAccess, pickPageAccess } from '@mpfrontend/access-core';
|
|
2
|
+
// A bundler that does not read the "browser" export condition still reaches this module: where a document exists it
|
|
3
|
+
// refuses as well, so the loader never runs in a browser, whatever resolved the entry.
|
|
4
|
+
if (typeof globalThis.document !== 'undefined')
|
|
5
|
+
throw new Error('ACCESS_SERVER_ENTRY_IN_BROWSER: import @mpfrontend/access-react/server only from server code');
|
|
2
6
|
/**
|
|
3
7
|
* A server-only loader. It loads, validates (shape, revision, expiry, context reference, known keys) and memoizes the
|
|
4
8
|
* snapshot once per request object: pass the same object for one request, for example the headers of a server
|
package/dist/server.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,eAAe,EAAC,cAAc,EAAoD,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,eAAe,EAAC,cAAc,EAAoD,MAAM,yBAAyB,CAAC;AAE1H,oHAAoH;AACpH,uFAAuF;AACvF,IAAG,OAAQ,UAAkC,CAAC,QAAQ,KAAG,WAAW;IAClE,MAAM,IAAI,KAAK,CAAC,8FAA8F,CAAC,CAAC;AAmBlH;;;;GAIG;AACH,MAAM,UAAU,kBAAkB,CAAyB,OAAoC;IAC7F,IAAG,CAAC,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC,SAAS,CAAC,IAAE,OAAO,CAAC,SAAS,IAAE,CAAC;QAAC,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;IAC9G,MAAM,IAAI,GAAC,IAAI,OAAO,EAAiC,CAAC;IACxD,MAAM,IAAI,GAAC,KAAK,EAAC,OAAe,EAAuB,EAAE;QACvD,MAAM,MAAM,GAAC,WAAW,CAAC,OAAO,CA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CAAC,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,cAAc,CAAC,MAAmB,EAAC,IAAe;IAChE,OAAO,MAAM,CAAC,EAAE,CAAA,CAAC,CAAA,cAAc,CAAC,MAAM,CAAC,MAAM,EAAC,IAAI,CAAC,CAAA,CAAC,CAAA,IAAI,CAAC;AAC3D,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mpfrontend/access-react",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -34,11 +34,11 @@
|
|
|
34
34
|
"provenance": true
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@mpfrontend/access-core": "
|
|
37
|
+
"@mpfrontend/access-core": "1.1.0"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@happy-dom/global-registrator": "
|
|
41
|
-
"happy-dom": "
|
|
40
|
+
"@happy-dom/global-registrator": "21.0.4",
|
|
41
|
+
"happy-dom": "21.0.4"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
44
|
"react": "^19.3.0"
|