@_linked/server 2.13.7 → 2.14.1
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 +38 -0
- package/lib/esm/backend.js.map +1 -1
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/ontologies/lincd-server.js.map +1 -1
- package/lib/esm/ontologies/lincd-server.register.js.map +1 -1
- package/lib/esm/package.js.map +1 -1
- package/lib/esm/shapes/LincdAPI.js +4 -1
- package/lib/esm/shapes/LincdAPI.js.map +1 -1
- package/lib/esm/shapes/LincdWebApp.js +4 -1
- package/lib/esm/shapes/LincdWebApp.js.map +1 -1
- package/lib/esm/shapes/LinkedServer.d.ts +6 -1
- package/lib/esm/shapes/LinkedServer.js +71 -47
- package/lib/esm/shapes/LinkedServer.js.map +1 -1
- package/lib/esm/shapes/filestores/LocalFileStore.js.map +1 -1
- package/lib/esm/shapes/quadstores/BackendAPIStore.js.map +1 -1
- package/lib/esm/types/RouteConfig.js.map +1 -1
- package/lib/esm/types.js.map +1 -1
- package/lib/esm/utils/NodeQuadStore.js.map +1 -1
- package/lib/esm/utils/Shapes.js.map +1 -1
- package/lib/esm/utils/accessUrl.js.map +1 -1
- package/lib/esm/utils/bootstrapEntry.d.ts +30 -2
- package/lib/esm/utils/bootstrapEntry.js +32 -2
- package/lib/esm/utils/bootstrapEntry.js.map +1 -1
- package/lib/esm/utils/releaseManifest.js.map +1 -1
- package/lib/esm/utils/resizeSource.js.map +1 -1
- package/lib/esm/utils/resizedImagesPurpose.js.map +1 -1
- package/lib/esm/utils/routeAssets.js.map +1 -1
- package/lib/esm/utils/spaFallback.js.map +1 -1
- package/lib/esm/utils/ssrCss.d.ts +3 -0
- package/lib/esm/utils/ssrCss.js +48 -0
- package/lib/esm/utils/ssrCss.js.map +1 -0
- package/lib/esm/utils/syncShapes.js.map +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,43 @@
|
|
|
1
1
|
# @\_linked/server
|
|
2
2
|
|
|
3
|
+
## 2.14.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#103](https://github.com/linked-fw/server/pull/103) [`96504ef`](https://github.com/linked-fw/server/commit/96504ef9485b1a193c757fdbcc5a923c1a799fb9) Thanks [@flyon](https://github.com/flyon)! - Dev SSR styling fixes. A development server no longer reads a build manifest left on disk by an
|
|
8
|
+
earlier `vite build`, so it stops linking that stale built CSS next to Vite's live styles. The SSR
|
|
9
|
+
CSS collector skips `?direct` ids and files under Vite's `publicDir` (which failed with "Parse
|
|
10
|
+
failure" when loaded as a module) and loads each stylesheet once. The collected CSS is no longer
|
|
11
|
+
serialised into `assetManifest` as well as the inline `<style>`; that copy was about half of a dev page.
|
|
12
|
+
|
|
13
|
+
- [#103](https://github.com/linked-fw/server/pull/103) [`277e01a`](https://github.com/linked-fw/server/commit/277e01a979d14535e8edcdfc0a84d3ce50c72c82) Thanks [@flyon](https://github.com/flyon)! - Name the `LincdAPI`, `LinkedServer` and `LincdWebApp` shapes explicitly. Their IRIs were derived
|
|
14
|
+
from the class name, which an esbuild pass over the compiled JS (Vite's dev-SSR `define` step)
|
|
15
|
+
renames to `LincdAPI2` / `LinkedServer2`, so dev and production minted different IRIs.
|
|
16
|
+
|
|
17
|
+
- [#103](https://github.com/linked-fw/server/pull/103) [`1332aae`](https://github.com/linked-fw/server/commit/1332aaec4eba795bd0d132252ca4f156d6517bd2) Thanks [@flyon](https://github.com/flyon)! - Embed the TypeScript sources in the published sourcemaps (`inlineSources`). The maps pointed at
|
|
18
|
+
`src/*.ts`, which the tarball does not contain, so Vite dev warned that each sourcemap "points to
|
|
19
|
+
missing source files".
|
|
20
|
+
|
|
21
|
+
- [#103](https://github.com/linked-fw/server/pull/103) [`ecb97e6`](https://github.com/linked-fw/server/commit/ecb97e6aba759e6ee39841069fe2d272ba293257) Thanks [@flyon](https://github.com/flyon)! - The render path now reuses the dev/build decision `start()` makes instead of re-deriving it from a
|
|
22
|
+
manifest field that was never set. A server started outside development with a Vite build on disk
|
|
23
|
+
now boots the built entry and preloads route chunks, instead of emitting the Vite dev preamble
|
|
24
|
+
next to the built CSS.
|
|
25
|
+
|
|
26
|
+
## 2.14.0
|
|
27
|
+
|
|
28
|
+
### Minor Changes
|
|
29
|
+
|
|
30
|
+
- [#100](https://github.com/linked-fw/server/pull/100) [`91e60bd`](https://github.com/linked-fw/server/commit/91e60bde196aaa849661650a937fc89ef47c728b) Thanks [@flyon](https://github.com/flyon)! - Require `@_linked/core@^2.22.8` (was `^2.20.0`), and pin it in the lockfile.
|
|
31
|
+
|
|
32
|
+
The declared range was wide enough that the resolved core depended on whatever the
|
|
33
|
+
consumer — or this repo's own CI, via `package-lock.json` — happened to install. Core
|
|
34
|
+
decides how a shape's IRI is minted, so a stale core made this package emit legacy
|
|
35
|
+
`data.lincd.org` IRIs instead of the arch-02 `linked.cm` scheme. Which IRIs a published
|
|
36
|
+
package produces should not be a function of the installer's dependency tree.
|
|
37
|
+
|
|
38
|
+
Minor rather than patch: this raises the minimum core a consumer must resolve, so it
|
|
39
|
+
changes what gets installed rather than only what this package does internally.
|
|
40
|
+
|
|
3
41
|
## 2.13.7
|
|
4
42
|
|
|
5
43
|
### Patch Changes
|
package/lib/esm/backend.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"backend.js","sourceRoot":"","sources":["../../src/backend.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,6CAA6C,CAAC;AAC9E,OAAO,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAC;AAC1E,OAAO,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAClE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAC;AACvE,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,IAAI,M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,IAAI,CAAC,oBAAoB,EAAE,YAAY,CAAC,EAAE;gBAC5D,SAAS,EAAE,IAAI;aAChB,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAED,SAAS;QACP,OAAO,aAAa,EAAE,CAAC;IACzB,CAAC;IAED,4EAA4E;IAC5E,EAAE;IACF,2DAA2D;IAC3D,gFAAgF;IAChF,6EAA6E;IAC7E,EAAE;IACF,mFAAmF;IACnF,qFAAqF;IACrF,uFAAuF;IACvF,uFAAuF;IACvF,4DAA4D;IAC5D,EAAE;IACF,sFAAsF;IACtF,4EAA4E;IAC5E,uFAAuF;IACvF,qEAAqE;IAErE,WAAW,CAAC,IAAS;QACnB,OAAO,aAAa,CAAC,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAQ,CAAC,CAAC;IAC1D,CAAC;IAED,QAAQ,CAAC,IAAS;QAChB,OAAO,aAAa,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAQ,CAAC,CAAC;IACvD,CAAC;IAED,WAAW,CAAC,IAAS;QACnB,OAAO,aAAa,CAAC,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAQ,CAAC,CAAC;IAC1D,CAAC;IAED,WAAW,CAAC,IAAS;QACnB,OAAO,aAAa,CAAC,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAQ,CAAC,CAAC;IAC1D,CAAC;IAED,WAAW,CAAC,IAAS;QACnB,OAAO,aAAa,CAAC,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAQ,CAAC,CAAC;IAC1D,CAAC;CACF","sourcesContent":["import { BackendProvider } from '@_linked/server-utils/utils/BackendProvider';\nimport { LinkedFileStorage } from '@_linked/core/utils/LinkedFileStorage';\nimport { LinkedStorage } from '@_linked/core/utils/LinkedStorage';\nimport { fromJSON } from '@_linked/core';\nimport { LocalFileStore } from './shapes/filestores/LocalFileStore.js';\nimport { getShapeIndex } from './utils/Shapes.js';\nimport path from 'path';\nimport fs from 'fs/promises';\n\nexport default class LincdServerBackendProvider extends BackendProvider {\n async setupBeforeControllers() {\n if (!LinkedFileStorage.getDefaultStore()) {\n LinkedFileStorage.setDefaultStore(\n new LocalFileStore(process.env.NODE_ENV + '-filestore')\n );\n }\n let fileSystemUploadPath = path.join('data', 'filestores');\n try {\n await fs.access(fileSystemUploadPath);\n } catch (err) {\n await fs.mkdir(path.join(fileSystemUploadPath, 'filestores'), {\n recursive: true,\n });\n }\n }\n\n getShapes() {\n return getShapeIndex();\n }\n\n // ── BackendAPIStore query execution ──────────────────────────────────────\n //\n // These answer the frontend `BackendAPIStore`, which calls\n // `Server.call(packageName, {method}, json)` — the PACKAGE form, so the request\n // arrives here on the generic provider rather than through Shape resolution.\n //\n // They used to live on `BackendAPIStoreProvider`, a `ShapeProvider`, whose methods\n // took the store as a first argument and never read it. Reaching that provider meant\n // the transport had to carry a `shapeURI` and an `instanceNode`, and the server had to\n // rebuild the store with `new (providerShapeClass)({id})` — instantiating a Shape only\n // to discard it. Addressing by package removes all of that.\n //\n // A query cannot cross the wire live (core 2.10.0 contract flip), so the client ships\n // `toJSON()` and `fromJSON()` rehydrates it here into a live, closed query.\n // `LinkedStorage` then routes it by the QUERY's shape — which is, and always was, what\n // decides the target dataset. The store instance never participated.\n\n selectQuery(json: any) {\n return LinkedStorage.selectQuery(fromJSON(json) as any);\n }\n\n askQuery(json: any) {\n return LinkedStorage.askQuery(fromJSON(json) as any);\n }\n\n updateQuery(json: any) {\n return LinkedStorage.updateQuery(fromJSON(json) as any);\n }\n\n createQuery(json: any) {\n return LinkedStorage.createQuery(fromJSON(json) as any);\n }\n\n deleteQuery(json: any) {\n return LinkedStorage.deleteQuery(fromJSON(json) as any);\n }\n}\n"]}
|
package/lib/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,CAAC;AACpB,OAAO,uCAAuC,CAAC;AAE/C,cAAc;AACd,OAAO,0BAA0B,CAAC;AAClC,OAAO,sBAAsB,CAAC;AAC9B,OAAO,wCAAwC,CAAC;AAChD,OAAO,uCAAuC,CAAC;AAC/C,OAAO,yBAAyB,CAAC;AAEjC,iBAAiB;AACjB,OAAO,sBAAsB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,CAAC;AACpB,OAAO,uCAAuC,CAAC;AAE/C,cAAc;AACd,OAAO,0BAA0B,CAAC;AAClC,OAAO,sBAAsB,CAAC;AAC9B,OAAO,wCAAwC,CAAC;AAChD,OAAO,uCAAuC,CAAC;AAC/C,OAAO,yBAAyB,CAAC;AAEjC,iBAAiB;AACjB,OAAO,sBAAsB,CAAC","sourcesContent":["import './types.js';\nimport './ontologies/lincd-server.register.js';\n\n//SHAPES FIRST\nimport './shapes/LinkedServer.js';\nimport './shapes/LincdAPI.js';\nimport './shapes/quadstores/BackendAPIStore.js';\nimport './shapes/filestores/LocalFileStore.js';\nimport './shapes/LincdWebApp.js';\n\n//THEN COMPONENTS\nimport './utils/accessUrl.js';\n\n//TYPES — re-exported from @_linked/server-utils (canonical location)\nexport type {\n RouteConfig,\n RoutesConfig,\n RoutesModule,\n} from '@_linked/server-utils/types/RouteConfig';\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lincd-server.js","sourceRoot":"","sources":["../../../src/ontologies/lincd-server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAEhE;;;GAGG;AACH,MAAM,CAAC,IAAI,QAAQ,GAAG,KAAK,IAAI,EAAE;IAC/B,YAAY;IACZ,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,2BAA2B,EAAE;QACrD,IAAI,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE;KACvB,CAAC,CAAC;IACH,OAAO,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC;AAC9B,CAAC,CAAC;A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,MAAM;CACP,CAAC","sourcesContent":["import { createNameSpace } from '@_linked/core/utils/NameSpace';\n\n/**\n * Load the data of this ontology.\n * In @_linked/core, loadData returns the raw JSON import — no JSONLD.parse() needed.\n */\nexport var loadData = async () => {\n //@ts-ignore\n const data = await import('../data/lincd-server.json', {\n with: { type: 'json' },\n });\n return data.default || data;\n};\n\nexport var ns = createNameSpace('http://lincd.org/ont/lincd-server/');\n\nexport var _self = ns('');\n\n// Terms are properties of the namespace object below, not module-scope\n// exports. Most of these names are also SHAPE CLASS names in this package\n// (BackendAPIStore, LincdWebApp, LincdAPI, ...). Two bindings of the same name\n// in one bundle scope make the bundler rename one of them, and when the loser\n// is the class, `constructor.name` becomes `BackendAPIStore2` -- which is the\n// shape's IRI and the name `Server.call` routes on. The client then asks a\n// backend that has no such shape, and every store round-trip answers 501.\nconst LincdServer = ns('LincdServer');\nconst BackendFileStore = ns('BackendFileStore');\nconst NodeFileStore = ns('NodeFileStore');\nconst BackendStore = ns('BackendStore');\nconst BackendAPIStore = ns('BackendAPIStore');\nconst LincdWebApp = ns('LincdWebApp');\nconst ownPackage = ns('ownPackage');\nconst maintainsPackage = ns('maintainsPackage');\nconst N3FileStore = ns('N3FileStore');\nconst LincdAPI = ns('LincdAPI');\nconst hasAPI = ns('hasAPI');\n\nexport const lincdServer = {\n LincdServer,\n BackendFileStore,\n NodeFileStore,\n BackendStore,\n N3FileStore,\n BackendAPIStore,\n LincdWebApp,\n ownPackage,\n maintainsPackage,\n LincdAPI,\n hasAPI,\n};\n\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lincd-server.register.js","sourceRoot":"","sources":["../../../src/ontologies/lincd-server.register.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,KAAK,KAAK,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAC,QAAQ,EAAE,EAAE,EAAC,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAC,cAAc,EAAC,MAAM,eAAe,CAAC;AAE7C,cAAc,CACZ,KAAK,EACL,EAAE,EACF,cAAc,EACd,QAAQ,EACR,2BAA2B,CAC5B,CAAC"}
|
|
1
|
+
{"version":3,"file":"lincd-server.register.js","sourceRoot":"","sources":["../../../src/ontologies/lincd-server.register.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,KAAK,KAAK,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAC,QAAQ,EAAE,EAAE,EAAC,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAC,cAAc,EAAC,MAAM,eAAe,CAAC;AAE7C,cAAc,CACZ,KAAK,EACL,EAAE,EACF,cAAc,EACd,QAAQ,EACR,2BAA2B,CAC5B,CAAC","sourcesContent":["/**\n * Registers this ontology.\n *\n * Kept out of `lincd-server.ts` because registration needs that module's whole export\n * namespace, and a module cannot import itself once a bundler is involved: Rollup\n * treats a static self-reference as a circular import and elides it, so the binding is\n * undefined at runtime and the consuming app dies at boot with `_this is not\n * defined`. `tsc` preserves it, which is why the pattern survived for as long as\n * packages were built with `tsc` alone.\n *\n * From a sibling module the same import is ordinary and survives.\n */\nimport * as terms from './lincd-server.js';\nimport {loadData, ns} from './lincd-server.js';\nimport {linkedOntology} from '../package.js';\n\nlinkedOntology(\n terms,\n ns,\n 'lincd-server',\n loadData,\n '../data/lincd-server.json'\n);\n"]}
|
package/lib/esm/package.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"package.js","sourceRoot":"","sources":["../../src/package.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAE5D,MAAM,CAAC,MAAM,EACX,WAAW,EACX,UAAU,EACV,cAAc,EACd,cAAc,EACd,WAAW,GACZ,GAAG,aAAa,CAAC,iBAAiB,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"file":"package.js","sourceRoot":"","sources":["../../src/package.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAE5D,MAAM,CAAC,MAAM,EACX,WAAW,EACX,UAAU,EACV,cAAc,EACd,cAAc,EACd,WAAW,GACZ,GAAG,aAAa,CAAC,iBAAiB,CAAC,CAAC","sourcesContent":["import { linkedPackage } from '@_linked/core/utils/Package';\n\nexport const {\n linkedShape,\n linkedUtil,\n linkedOntology,\n packageExports,\n packageName,\n} = linkedPackage('@_linked/server');\n"]}
|
|
@@ -13,6 +13,9 @@ import { JSONWriter } from '@_linked/server-utils/utils/JSONWriter';
|
|
|
13
13
|
import { cached } from '@_linked/core/utils/cached';
|
|
14
14
|
import { getShapeIndex } from '../utils/Shapes.js';
|
|
15
15
|
const cacheTime = process.env.NODE_ENV === 'development' ? 0 : Infinity;
|
|
16
|
+
// Named explicitly: tsc emits `let X = class X`, and any later esbuild pass over that JS (Vite's
|
|
17
|
+
// SSR `define` replacement runs one on every file mentioning a defined `process.env.*`) renames
|
|
18
|
+
// the inner binding to `X2`, which would otherwise become this shape's IRI.
|
|
16
19
|
let LincdAPI = class LincdAPI extends Shape {
|
|
17
20
|
async process(request, response, httpMethod) {
|
|
18
21
|
let { method, action } = request.params;
|
|
@@ -108,7 +111,7 @@ let LincdAPI = class LincdAPI extends Shape {
|
|
|
108
111
|
};
|
|
109
112
|
LincdAPI.targetClass = lincdServer.LincdAPI;
|
|
110
113
|
LincdAPI = __decorate([
|
|
111
|
-
linkedShape
|
|
114
|
+
linkedShape({ name: 'LincdAPI' })
|
|
112
115
|
], LincdAPI);
|
|
113
116
|
export { LincdAPI };
|
|
114
117
|
//# sourceMappingURL=LincdAPI.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LincdAPI.js","sourceRoot":"","sources":["../../../src/shapes/LincdAPI.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5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oBAAW,GAAG,WAAW,CAAC,QAAQ,AAAvB,CAAwB;AAD/B,QAAQ;IADpB,WAAW,CAAC,EAAC,IAAI,EAAE,UAAU,EAAC,CAAC;GACnB,QAAQ,CAmIpB","sourcesContent":["import { Shape } from '@_linked/core/shapes/Shape';\nimport { linkedShape } from '../package.js';\nimport { lincdServer } from '../ontologies/lincd-server.js';\nimport { JSONParser } from '@_linked/server-utils/utils/JSONParser';\nimport { LinkedStorage } from '@_linked/core/utils/LinkedStorage';\nimport { JSONWriter } from '@_linked/server-utils/utils/JSONWriter';\nimport { cached } from '@_linked/core/utils/cached';\nimport { getShapeIndex, ShapeDetails } from '../utils/Shapes.js';\nimport { SparqlDataset as SPARQLStore } from '@_linked/core/sparql/SparqlDataset';\n\nconst cacheTime = process.env.NODE_ENV === 'development' ? 0 : Infinity;\nexport type ShapeSummary = {\n id: string;\n label: string;\n description: string;\n target: { id: string };\n extends?: { id: string };\n numInstances: number;\n};\n// Named explicitly: tsc emits `let X = class X`, and any later esbuild pass over that JS (Vite's\n// SSR `define` replacement runs one on every file mentioning a defined `process.env.*`) renames\n// the inner binding to `X2`, which would otherwise become this shape's IRI.\n@linkedShape({name: 'LincdAPI'})\nexport class LincdAPI extends Shape {\n static targetClass = lincdServer.LincdAPI;\n\n async process(\n request,\n response,\n httpMethod: 'get' | 'post' | 'put' | 'delete'\n ) {\n let { method, action } = request.params;\n const body = JSONParser.parseObject<any>(request.body);\n\n //replace - with _ in action names\n let localMethod = httpMethod + '_' + method.replace(/-/g, '_');\n if (typeof this[localMethod] !== 'function') {\n throw new Error('Unknown method: ' + localMethod);\n }\n\n //TODO: access rights, check if the current user is allowed to execute this method\n try {\n const result = await this[localMethod](body, request, response);\n if (typeof result !== 'undefined' || !response.headersSent) {\n const jsonObject = JSONWriter.toJsObject(result);\n response.json(jsonObject);\n }\n } catch (error) {\n console.error(`Error while processing ${localMethod}:`, error);\n if (!response.headersSent) {\n const message =\n error instanceof Error ? error.message : 'Unknown server error';\n response.status(500).json({ error: message });\n }\n }\n }\n\n get_shape_details({\n shapes,\n }: {\n shapes: string[];\n }): Record<string, ShapeDetails> {\n return cached(\n () => {\n const shapeIndex = getShapeIndex();\n const filteredShapeIndex = {};\n for (const shapeId of shapes) {\n if (shapeIndex[shapeId]) {\n filteredShapeIndex[shapeId] = shapeIndex[shapeId];\n }\n }\n return filteredShapeIndex;\n },\n [shapes],\n cacheTime\n );\n }\n\n get_all_shapes(): Promise<{\n shapes: Record<string, ShapeDetails>;\n defaultGraph: string;\n }> {\n return cached(\n async () => {\n const shapeIndex = getShapeIndex();\n\n const typesWithInstances = new Map<string, number>();\n this.checkRawQuerySupport();\n await (LinkedStorage.getDefaultDataset() as unknown as SPARQLStore)\n .rawQuery(\n `SELECT (COUNT(?s) AS ?count) ?type WHERE { ?s a ?type } GROUP BY ?type`\n )\n .then((results) => {\n // rawQuery also types ASK results (a boolean envelope); this is a SELECT.\n if (!results || !('results' in results)) return;\n results.results.bindings.forEach((binding) => {\n if (binding.type && binding.type.value) {\n typesWithInstances.set(\n binding.type.value,\n parseInt(binding.count.value)\n );\n }\n });\n })\n .catch(console.error);\n\n const shapesWithInstances: Record<string, ShapeDetails> = {};\n for (const shapeId in shapeIndex) {\n const shape = shapeIndex[shapeId];\n shapesWithInstances[shapeId] = {\n ...shape,\n numInstances: typesWithInstances.get(shape.targetClass?.id) || 0,\n };\n }\n return {\n shapes: shapesWithInstances,\n defaultGraph: process.env.DATA_ROOT,\n };\n },\n [],\n cacheTime\n );\n }\n\n post_select({ query }) {\n return LinkedStorage.selectQuery(query);\n }\n post_create({ query }) {\n return LinkedStorage.createQuery(query);\n }\n post_update({ query }) {\n return LinkedStorage.updateQuery(query);\n }\n post_delete({ query }) {\n return LinkedStorage.deleteQuery(query);\n }\n\n post_select_raw({ query }) {\n this.checkRawQuerySupport();\n return (LinkedStorage.getDefaultDataset() as unknown as SPARQLStore).rawQuery(\n query\n );\n }\n\n private checkRawQuerySupport() {\n if (!(LinkedStorage.getDefaultDataset() as unknown as SPARQLStore).rawQuery) {\n throw new Error(\n `Default store (${\n Object.getPrototypeOf(LinkedStorage.getDefaultDataset()).constructor\n .name\n }) does not support raw SPARQL queries`\n );\n }\n }\n}\n"]}
|
|
@@ -13,6 +13,9 @@ import { lincdServer } from '../ontologies/lincd-server.js';
|
|
|
13
13
|
import { Shape } from '@_linked/core/shapes/Shape';
|
|
14
14
|
import { objectProperty } from '@_linked/core/shapes/SHACL';
|
|
15
15
|
import { Lincd_API_Client } from '@_linked/server-utils/shapes/Lincd_API_Client';
|
|
16
|
+
// Named explicitly: tsc emits `let X = class X`, and any later esbuild pass over that JS (Vite's
|
|
17
|
+
// SSR `define` replacement runs one on every file mentioning a defined `process.env.*`) renames
|
|
18
|
+
// the inner binding to `X2`, which would otherwise become this shape's IRI.
|
|
16
19
|
let LincdWebApp = LincdWebApp_1 = class LincdWebApp extends Shape {
|
|
17
20
|
static get localApp() {
|
|
18
21
|
return new LincdWebApp_1({ id: process.env.SITE_ROOT });
|
|
@@ -34,7 +37,7 @@ __decorate([
|
|
|
34
37
|
__metadata("design:paramtypes", [])
|
|
35
38
|
], LincdWebApp.prototype, "api", null);
|
|
36
39
|
LincdWebApp = LincdWebApp_1 = __decorate([
|
|
37
|
-
linkedShape
|
|
40
|
+
linkedShape({ name: 'LincdWebApp' })
|
|
38
41
|
], LincdWebApp);
|
|
39
42
|
export { LincdWebApp };
|
|
40
43
|
//# sourceMappingURL=LincdWebApp.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LincdWebApp.js","sourceRoot":"","sources":["../../../src/shapes/LincdWebApp.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAC5D,OAAO,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,+CAA+C,CAAC;
|
|
1
|
+
{"version":3,"file":"LincdWebApp.js","sourceRoot":"","sources":["../../../src/shapes/LincdWebApp.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAC5D,OAAO,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,+CAA+C,CAAC;AAEjF,iGAAiG;AACjG,gGAAgG;AAChG,4EAA4E;AAErE,IAAM,WAAW,mBAAjB,MAAM,WAAY,SAAQ,KAAK;IAGpC,MAAM,KAAK,QAAQ;QACjB,OAAO,IAAI,aAAW,CAAC,EAAE,EAAE,EAAE,OAAO,CAAC,GAAG,CAAC,SAAS,EAAE,CAAC,CAAC;IACxD,CAAC;IAED,4EAA4E;IAC5E,8FAA8F;IAE9F,IAKI,GAAG;QACL,OAAO,SAAgB,CAAC;IAC1B,CAAC;;AAhBM,uBAAW,GAAG,WAAW,CAAC,WAAW,AAA1B,CAA2B;AAS7C;IAAC,cAAc,CAAC;QACd,IAAI,EAAE,WAAW,CAAC,MAAM;QACxB,KAAK,EAAE,gBAAgB;QACvB,QAAQ,EAAE,CAAC;KACZ,CAAC;8BACS,gBAAgB;;sCAE1B;AAjBU,WAAW;IADvB,WAAW,CAAC,EAAC,IAAI,EAAE,aAAa,EAAC,CAAC;GACtB,WAAW,CAkBvB","sourcesContent":["import { linkedShape } from '../package.js';\nimport { lincdServer } from '../ontologies/lincd-server.js';\nimport { Shape } from '@_linked/core/shapes/Shape';\nimport { objectProperty } from '@_linked/core/shapes/SHACL';\nimport { Lincd_API_Client } from '@_linked/server-utils/shapes/Lincd_API_Client';\n\n// Named explicitly: tsc emits `let X = class X`, and any later esbuild pass over that JS (Vite's\n// SSR `define` replacement runs one on every file mentioning a defined `process.env.*`) renames\n// the inner binding to `X2`, which would otherwise become this shape's IRI.\n@linkedShape({name: 'LincdWebApp'})\nexport class LincdWebApp extends Shape {\n static targetClass = lincdServer.LincdWebApp;\n\n static get localApp() {\n return new LincdWebApp({ id: process.env.SITE_ROOT });\n }\n\n // Module and packages properties removed — lincd-modules is in modules_old.\n // These will be re-added when the shape is properly migrated to @_linked/core query patterns.\n\n @objectProperty({\n path: lincdServer.hasAPI,\n shape: Lincd_API_Client,\n maxCount: 1,\n })\n get api(): Lincd_API_Client {\n return undefined as any;\n }\n}\n"]}
|
|
@@ -10,7 +10,12 @@ export declare class LinkedServer extends Shape {
|
|
|
10
10
|
private config;
|
|
11
11
|
private cachedPaths;
|
|
12
12
|
private assets;
|
|
13
|
-
|
|
13
|
+
/**
|
|
14
|
+
* Whether pages are served by the live Vite dev server rather than a
|
|
15
|
+
* `vite build` on disk. Decided once in `start()` — see
|
|
16
|
+
* utils/bootstrapEntry `resolveViteServingMode`.
|
|
17
|
+
*/
|
|
18
|
+
private viteDevServer;
|
|
14
19
|
/**
|
|
15
20
|
* Base URL every asset this build produced is served from — resolved once in
|
|
16
21
|
* `start()` and kept so per-request route chunks land on the same base as
|
|
@@ -47,8 +47,9 @@ import { CookieJar } from 'tough-cookie';
|
|
|
47
47
|
import { lincdServer } from '../ontologies/lincd-server.js';
|
|
48
48
|
import { linkedShape } from '../package.js';
|
|
49
49
|
import { resolveStaticAccessURL, staticAssetURL, } from '../utils/releaseManifest.js';
|
|
50
|
-
import {
|
|
50
|
+
import { resolveBootstrapEntry, resolveViteMainEntry, resolveViteServingMode, } from '../utils/bootstrapEntry.js';
|
|
51
51
|
import { resolveRouteAssets } from '../utils/routeAssets.js';
|
|
52
|
+
import { ssrCssInlineUrls } from '../utils/ssrCss.js';
|
|
52
53
|
import { indexShapesIntoMemory } from '../utils/Shapes.js';
|
|
53
54
|
import { installSpaFallback, repinSpaFallback, } from '../utils/spaFallback.js';
|
|
54
55
|
import { LincdAPI } from './LincdAPI.js';
|
|
@@ -86,6 +87,9 @@ events.EventEmitter.prototype.setMaxListeners(500);
|
|
|
86
87
|
// global['document'] = document;
|
|
87
88
|
global['reactStaticRenderer'] = renderToStaticMarkup;
|
|
88
89
|
autoLoadOntologyData(true);
|
|
90
|
+
// Named explicitly: tsc emits `let X = class X`, and any later esbuild pass over that JS (Vite's
|
|
91
|
+
// SSR `define` replacement runs one on every file mentioning a defined `process.env.*`) renames
|
|
92
|
+
// the inner binding to `X2`, which would otherwise become this shape's IRI.
|
|
89
93
|
let LinkedServer = class LinkedServer extends Shape {
|
|
90
94
|
/**
|
|
91
95
|
* yarn linked start sends the contents of linked.config.js as an object to this constructor
|
|
@@ -96,7 +100,12 @@ let LinkedServer = class LinkedServer extends Shape {
|
|
|
96
100
|
? config
|
|
97
101
|
: undefined);
|
|
98
102
|
this.cachedPaths = new Map();
|
|
99
|
-
|
|
103
|
+
/**
|
|
104
|
+
* Whether pages are served by the live Vite dev server rather than a
|
|
105
|
+
* `vite build` on disk. Decided once in `start()` — see
|
|
106
|
+
* utils/bootstrapEntry `resolveViteServingMode`.
|
|
107
|
+
*/
|
|
108
|
+
this.viteDevServer = false;
|
|
100
109
|
/**
|
|
101
110
|
* Base URL every asset this build produced is served from — resolved once in
|
|
102
111
|
* `start()` and kept so per-request route chunks land on the same base as
|
|
@@ -235,7 +244,7 @@ let LinkedServer = class LinkedServer extends Shape {
|
|
|
235
244
|
// })
|
|
236
245
|
// }
|
|
237
246
|
async start() {
|
|
238
|
-
var _a, _b, _c, _d
|
|
247
|
+
var _a, _b, _c, _d;
|
|
239
248
|
this.initPackage();
|
|
240
249
|
// Static assets should come from the static store URL (versioned path),
|
|
241
250
|
// not the upload store URL. An explicit STATIC_ACCESS_URL still wins;
|
|
@@ -260,36 +269,44 @@ let LinkedServer = class LinkedServer extends Shape {
|
|
|
260
269
|
'main.js': staticAsset('/bundles/main.bundle.js') + '?v=' + this.package.version,
|
|
261
270
|
'main.css': staticAsset('/bundles/main.css'),
|
|
262
271
|
};
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
272
|
+
// Dev or built, decided once and reused by the render path — see
|
|
273
|
+
// utils/bootstrapEntry. In development the build manifest is not read:
|
|
274
|
+
// one left on disk by an earlier `vite build` would otherwise swap in
|
|
275
|
+
// stale built CSS while Vite serves the live styles.
|
|
276
|
+
const servingMode = resolveViteServingMode({
|
|
277
|
+
viteConfig: (_a = this.config.server) === null || _a === void 0 ? void 0 : _a.vite,
|
|
278
|
+
nodeEnv: process.env.NODE_ENV,
|
|
279
|
+
readManifest: () => {
|
|
280
|
+
try {
|
|
281
|
+
const viteManifestPath = path.resolve(process.cwd(), 'public/bundles/.vite/manifest.json');
|
|
282
|
+
if (!fsNative.existsSync(viteManifestPath))
|
|
283
|
+
return null;
|
|
284
|
+
return JSON.parse(fsNative.readFileSync(viteManifestPath, 'utf-8'));
|
|
275
285
|
}
|
|
276
|
-
|
|
277
|
-
|
|
286
|
+
catch (err) {
|
|
287
|
+
console.warn('Could not load bundle manifest:', err);
|
|
288
|
+
return null;
|
|
278
289
|
}
|
|
290
|
+
},
|
|
291
|
+
});
|
|
292
|
+
this.viteDevServer = servingMode.viteDevServer;
|
|
293
|
+
if (servingMode.manifest) {
|
|
294
|
+
const viteManifest = servingMode.manifest;
|
|
295
|
+
this.assets.manifest = viteManifest;
|
|
296
|
+
// Resolve main entry per Vite manifest shape:
|
|
297
|
+
// { "src/index.tsx": { file: "assets/main-<hash>.js", css: [...] } }
|
|
298
|
+
const mainEntry = resolveViteMainEntry(viteManifest);
|
|
299
|
+
if (mainEntry === null || mainEntry === void 0 ? void 0 : mainEntry.file) {
|
|
300
|
+
this.assets['main.js'] = staticAsset(`/bundles/${mainEntry.file}`);
|
|
301
|
+
this.mainEntryIsModule = true;
|
|
302
|
+
}
|
|
303
|
+
if ((_b = mainEntry === null || mainEntry === void 0 ? void 0 : mainEntry.css) === null || _b === void 0 ? void 0 : _b[0]) {
|
|
304
|
+
this.assets['main.css'] = staticAsset(`/bundles/${mainEntry.css[0]}`);
|
|
279
305
|
}
|
|
280
306
|
}
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
// Vite dev marker: when Vite is in use AND no Vite manifest exists yet
|
|
285
|
-
// (= dev mode, no `vite build` run), the HTML renderer skips
|
|
286
|
-
// pre-built CSS/JS link tags. Vite handles asset injection itself.
|
|
287
|
-
// Same test as the entry bootstrap and the route preloads — see
|
|
288
|
-
// utils/bootstrapEntry.
|
|
289
|
-
if (isViteDevServer({
|
|
290
|
-
viteConfig: (_b = this.config.server) === null || _b === void 0 ? void 0 : _b.vite,
|
|
291
|
-
buildOutput: resolveViteMainEntry((_c = this.assets.manifest) !== null && _c !== void 0 ? _c : {}),
|
|
292
|
-
})) {
|
|
307
|
+
// Vite dev marker: the HTML renderer skips pre-built CSS/JS link tags,
|
|
308
|
+
// because Vite handles asset injection itself.
|
|
309
|
+
if (this.viteDevServer) {
|
|
293
310
|
this.assets['__viteDev'] = '1';
|
|
294
311
|
}
|
|
295
312
|
const isProduction = process.env.NODE_ENV === 'production';
|
|
@@ -335,7 +352,7 @@ let LinkedServer = class LinkedServer extends Shape {
|
|
|
335
352
|
// (`linked start --vite`), the orchestrator passes the Vite handle
|
|
336
353
|
// through config.server.viteMiddleware. We mount it and skip the
|
|
337
354
|
// entire webpack-dev-middleware setup below.
|
|
338
|
-
const viteMiddleware = (
|
|
355
|
+
const viteMiddleware = (_c = this.config.server) === null || _c === void 0 ? void 0 : _c.viteMiddleware;
|
|
339
356
|
if (viteMiddleware) {
|
|
340
357
|
this.server.use(viteMiddleware);
|
|
341
358
|
}
|
|
@@ -442,7 +459,7 @@ let LinkedServer = class LinkedServer extends Shape {
|
|
|
442
459
|
// answering them with the client shell at status 200.
|
|
443
460
|
// An API-only backend (`linked start --api-only`) has no app to render:
|
|
444
461
|
// without the catch-all, page requests get express's plain 404.
|
|
445
|
-
if (!((
|
|
462
|
+
if (!((_d = this.config.server) === null || _d === void 0 ? void 0 : _d.apiOnly)) {
|
|
446
463
|
this.installSpaFallback();
|
|
447
464
|
}
|
|
448
465
|
//remove http(s):// and remove port :[port]
|
|
@@ -1370,7 +1387,6 @@ let LinkedServer = class LinkedServer extends Shape {
|
|
|
1370
1387
|
let ssrCss = '';
|
|
1371
1388
|
if ((_e = vite === null || vite === void 0 ? void 0 : vite.moduleGraph) === null || _e === void 0 ? void 0 : _e.idToModuleMap) {
|
|
1372
1389
|
const cssChunks = [];
|
|
1373
|
-
const seen = new Set();
|
|
1374
1390
|
// Walk the moduleGraph for CSS modules pulled in by app/pages.
|
|
1375
1391
|
// Note: Tailwind v4 `@theme` directives in app theme CSS files are
|
|
1376
1392
|
// NOT processed at SSR collection time — the @tailwindcss/vite
|
|
@@ -1380,14 +1396,10 @@ let LinkedServer = class LinkedServer extends Shape {
|
|
|
1380
1396
|
// unthemed content (logos render black until ~hydration+200ms).
|
|
1381
1397
|
// Production (vite build) is unaffected — the static main.css
|
|
1382
1398
|
// contains expanded :root variables.
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
if (!/\.(module\.)?css(\?(?!.*inline)[^?]*)?$/.test(id))
|
|
1387
|
-
continue;
|
|
1388
|
-
seen.add(id);
|
|
1399
|
+
// Only real stylesheets, once per file — see utils/ssrCss.
|
|
1400
|
+
const inlineUrls = ssrCssInlineUrls(vite.moduleGraph.idToModuleMap.keys(), { publicDir: (_f = vite.config) === null || _f === void 0 ? void 0 : _f.publicDir });
|
|
1401
|
+
for (const inlineUrl of inlineUrls) {
|
|
1389
1402
|
try {
|
|
1390
|
-
const inlineUrl = id + (id.includes('?') ? '&' : '?') + 'inline';
|
|
1391
1403
|
const cssModule = await vite.ssrLoadModule(inlineUrl);
|
|
1392
1404
|
if (typeof (cssModule === null || cssModule === void 0 ? void 0 : cssModule.default) === 'string') {
|
|
1393
1405
|
cssChunks.push(cssModule.default);
|
|
@@ -1397,7 +1409,18 @@ let LinkedServer = class LinkedServer extends Shape {
|
|
|
1397
1409
|
}
|
|
1398
1410
|
ssrCss = cssChunks.join('\n');
|
|
1399
1411
|
}
|
|
1400
|
-
|
|
1412
|
+
// Per request, and not enumerable: Html reads `assets.__viteSsrCss` for
|
|
1413
|
+
// the inline <style>, but also serialises the whole assets object into
|
|
1414
|
+
// `assetManifest` for the client, which never uses it. Enumerable, the
|
|
1415
|
+
// collected CSS — megabytes in a large app — went into every page twice.
|
|
1416
|
+
// A per-request copy also keeps one render's CSS out of another's.
|
|
1417
|
+
const assets = { ...this.assets };
|
|
1418
|
+
if (ssrCss) {
|
|
1419
|
+
Object.defineProperty(assets, '__viteSsrCss', {
|
|
1420
|
+
value: ssrCss,
|
|
1421
|
+
enumerable: false,
|
|
1422
|
+
});
|
|
1423
|
+
}
|
|
1401
1424
|
await this.initRequest(req, res);
|
|
1402
1425
|
let { requestLD, requestObject } = await this.getRequestData(req, res);
|
|
1403
1426
|
//on the backend we need to inform the hook of the request-data value
|
|
@@ -1418,7 +1441,7 @@ let LinkedServer = class LinkedServer extends Shape {
|
|
|
1418
1441
|
// }
|
|
1419
1442
|
// timedout = true;
|
|
1420
1443
|
// }, 8_000);
|
|
1421
|
-
let manifest = this.
|
|
1444
|
+
let manifest = this.assets.manifest || {};
|
|
1422
1445
|
let preloadScripts = [];
|
|
1423
1446
|
let preloadStyles = [];
|
|
1424
1447
|
let matchedRouteKey = null;
|
|
@@ -1427,10 +1450,11 @@ let LinkedServer = class LinkedServer extends Shape {
|
|
|
1427
1450
|
// chunks to preload, and the webpack-shape fallback would pick up
|
|
1428
1451
|
// stale bundles on disk (public/bundles/*.bundle.js from a prior
|
|
1429
1452
|
// webpack build) and link them, breaking hydration.
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1453
|
+
// The same decision start() made for the `__viteDev` marker. This used
|
|
1454
|
+
// to be re-derived from `latestManifest`, which nothing ever set, so it
|
|
1455
|
+
// answered "dev" whenever Vite was attached — even when start() had
|
|
1456
|
+
// chosen the build — and the page mixed built CSS with the dev preamble.
|
|
1457
|
+
const usingViteDev = this.viteDevServer;
|
|
1434
1458
|
// Load routes config if available and extract preload chunks for the current route
|
|
1435
1459
|
if ((_g = this.config.server) === null || _g === void 0 ? void 0 : _g.loadRoutes) {
|
|
1436
1460
|
try {
|
|
@@ -1477,7 +1501,7 @@ let LinkedServer = class LinkedServer extends Shape {
|
|
|
1477
1501
|
req['matchedRouteKey'] = matchedRouteKey;
|
|
1478
1502
|
stream = renderToPipeableStream(React.createElement(React.StrictMode, null,
|
|
1479
1503
|
React.createElement(StaticRouter, { location: req.url },
|
|
1480
|
-
React.createElement(AppContextProvider, { assets:
|
|
1504
|
+
React.createElement(AppContextProvider, { assets: assets, requestLD: requestLD, requestObject: requestObject, preloadScripts: preloadScripts, preloadStyles: preloadStyles, expressRequest: req, expressResponse: res },
|
|
1481
1505
|
React.createElement(App, null)))), {
|
|
1482
1506
|
// How the client entry boots — dev preamble, ES module, or classic
|
|
1483
1507
|
// script. See utils/bootstrapEntry.
|
|
@@ -1650,7 +1674,7 @@ let LinkedServer = class LinkedServer extends Shape {
|
|
|
1650
1674
|
*/
|
|
1651
1675
|
LinkedServer.targetClass = lincdServer.LincdServer;
|
|
1652
1676
|
LinkedServer = __decorate([
|
|
1653
|
-
linkedShape,
|
|
1677
|
+
linkedShape({ name: 'LinkedServer' }),
|
|
1654
1678
|
__metadata("design:paramtypes", [Object])
|
|
1655
1679
|
], LinkedServer);
|
|
1656
1680
|
export { LinkedServer };
|