@declarion/react 0.3.1 → 0.4.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/dist-lib/{DraggableChildrenTable-8WlRET2T.js → DraggableChildrenTable---ODhvpn.js} +2 -2
- package/dist-lib/{DraggableChildrenTable-8WlRET2T.js.map → DraggableChildrenTable---ODhvpn.js.map} +1 -1
- package/dist-lib/components/mass-edit/PropertyGridEditor.d.ts +1 -1
- package/dist-lib/{dataTableStyles-ChRNMLAZ.js → dataTableStyles-BrYVdg1O.js} +5 -5
- package/dist-lib/dataTableStyles-BrYVdg1O.js.map +1 -0
- package/dist-lib/declarion-react.css +1 -1
- package/dist-lib/index.js +24 -24
- package/dist-lib/index.js.map +1 -1
- package/dist-lib/vite/fingerprint-plugin.d.ts +1 -1
- package/dist-lib/vite/index.js.map +1 -1
- package/package.json +1 -1
- package/dist-lib/dataTableStyles-ChRNMLAZ.js.map +0 -1
|
@@ -9,7 +9,7 @@ export interface DeclarionFingerprintPluginOptions {
|
|
|
9
9
|
/**
|
|
10
10
|
* Filename of the emitted fingerprint, written next to `index.html`.
|
|
11
11
|
* Defaults to "bundle-fingerprint.txt". Match this on the server
|
|
12
|
-
* side (`
|
|
12
|
+
* side (`cmd/server/fingerprint.go:readBundleFingerprint`) if you
|
|
13
13
|
* customize.
|
|
14
14
|
*/
|
|
15
15
|
filename?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../src/vite/fingerprint-plugin.ts"],"sourcesContent":["import type { Plugin } from \"vite\";\nimport { createHash } from \"node:crypto\";\nimport {\n readdirSync,\n readFileSync,\n statSync,\n writeFileSync,\n} from \"node:fs\";\nimport { join } from \"node:path\";\n\nexport interface DeclarionFingerprintPluginOptions {\n /**\n * Subdirectory of `outDir` to walk. Defaults to \"assets\" — Vite's\n * standard hashed-output location. Override only if a consumer has\n * customized `build.assetsDir`.\n */\n assetsDir?: string;\n\n /**\n * Filename of the emitted fingerprint, written next to `index.html`.\n * Defaults to \"bundle-fingerprint.txt\". Match this on the server\n * side (`
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/vite/fingerprint-plugin.ts"],"sourcesContent":["import type { Plugin } from \"vite\";\nimport { createHash } from \"node:crypto\";\nimport {\n readdirSync,\n readFileSync,\n statSync,\n writeFileSync,\n} from \"node:fs\";\nimport { join } from \"node:path\";\n\nexport interface DeclarionFingerprintPluginOptions {\n /**\n * Subdirectory of `outDir` to walk. Defaults to \"assets\" — Vite's\n * standard hashed-output location. Override only if a consumer has\n * customized `build.assetsDir`.\n */\n assetsDir?: string;\n\n /**\n * Filename of the emitted fingerprint, written next to `index.html`.\n * Defaults to \"bundle-fingerprint.txt\". Match this on the server\n * side (`cmd/server/fingerprint.go:readBundleFingerprint`) if you\n * customize.\n */\n filename?: string;\n}\n\n/**\n * Vite plugin that emits a single-line `bundle-fingerprint.txt` next\n * to `index.html` after every production build. The fingerprint is a\n * SHA-256 over every file in `assetsDir/` — sorted by name, length-\n * prefixed (`name\\x00sha256\\x00`) so concatenation is collision-safe.\n *\n * The Declarion server reads this file at boot and folds it into the\n * combined build identity exposed via `X-Declarion-Version` and\n * `/api/version`. When a consumer redeploys the UI bundle (changed\n * JS/CSS/assets) the file changes → server fingerprint changes → SDK\n * detects asset drift → user is prompted to reload to pick up the\n * new code.\n *\n * Why a separate file rather than walking `assetsDir/` from Go at\n * boot:\n * - Eliminates a per-process I/O dependency on bundle layout\n * conventions (Vite could change `assetsDir` defaults; the\n * plugin is the canonical contract).\n * - Computed once at build time, read once at boot — never on the\n * hot path.\n * - Lets the consumer image ship the fingerprint as an immutable\n * artifact rather than re-deriving it at every server start.\n *\n * Backward compatible: if a consumer hasn't adopted the plugin yet,\n * `bundle-fingerprint.txt` is absent at boot, the server logs once\n * and degrades to binary-only drift detection (still correct — the\n * binary fingerprint differs across builds anyway). No errors.\n */\nexport function declarionFingerprintPlugin(\n options: DeclarionFingerprintPluginOptions = {},\n): Plugin {\n const filename = options.filename ?? \"bundle-fingerprint.txt\";\n\n return {\n name: \"declarion-fingerprint\",\n apply: \"build\",\n closeBundle: {\n // `sequential: true` is the safe default — run after rollup has\n // finished writing the bundle, before any other closeBundle\n // hooks observe the output dir.\n sequential: true,\n handler() {\n // Read outDir + assetsDir from the resolved Vite config. We\n // don't capture them in a `configResolved` hook because\n // `closeBundle` already runs after config resolution.\n const cfg = this.environment.config;\n const outDir = cfg.build.outDir;\n const assetsDir = options.assetsDir ?? cfg.build.assetsDir ?? \"assets\";\n const assetsRoot = join(outDir, assetsDir);\n\n const files = collectFiles(assetsRoot);\n files.sort(); // deterministic order\n\n const h = createHash(\"sha256\");\n for (const relPath of files) {\n const abs = join(assetsRoot, relPath);\n const fileHash = createHash(\"sha256\")\n .update(readFileSync(abs))\n .digest(\"hex\");\n // Length-prefix discipline — same as the Go side\n // (store/migrations.go:215-282 + cmd/server/fingerprint.go).\n // `a`+`bc` and `ab`+`c` must produce different hashes.\n h.update(`${relPath.length}:${relPath}\\n`);\n h.update(`${fileHash.length}:${fileHash}\\n`);\n }\n const combined = h.digest(\"hex\");\n\n writeFileSync(join(outDir, filename), combined + \"\\n\", \"utf8\");\n },\n },\n };\n}\n\n/**\n * Walks `root` recursively and returns POSIX-style relative paths of\n * every regular file. Sorted by the caller. Symlinks are followed\n * since Vite output dirs don't contain them in practice.\n */\nfunction collectFiles(root: string): string[] {\n const out: string[] = [];\n const stack: { abs: string; rel: string }[] = [{ abs: root, rel: \"\" }];\n while (stack.length > 0) {\n const { abs, rel } = stack.pop()!;\n let entries: string[];\n try {\n entries = readdirSync(abs);\n } catch (err) {\n // Missing assetsDir: nothing to fingerprint. Return empty;\n // the plugin still emits the file so the server boot path\n // doesn't have to special-case missing-yet-defined assets.\n if (\n err &&\n typeof err === \"object\" &&\n \"code\" in err &&\n (err as { code: string }).code === \"ENOENT\"\n ) {\n return [];\n }\n throw err;\n }\n for (const name of entries) {\n const childAbs = join(abs, name);\n const childRel = rel ? `${rel}/${name}` : name;\n if (statSync(childAbs).isDirectory()) {\n stack.push({ abs: childAbs, rel: childRel });\n } else {\n out.push(childRel);\n }\n }\n }\n return out;\n}\n"],"mappings":";;;;AAuDA,SAAgB,EACd,IAA6C,CAAC,GACtC;CACR,IAAM,IAAW,EAAQ,YAAY;CAErC,OAAO;EACL,MAAM;EACN,OAAO;EACP,aAAa;GAIX,YAAY;GACZ,UAAU;IAIR,IAAM,IAAM,KAAK,YAAY,QACvB,IAAS,EAAI,MAAM,QAEnB,IAAa,EAAK,GADN,EAAQ,aAAa,EAAI,MAAM,aAAa,QACrB,GAEnC,IAAQ,EAAa,CAAU;IACrC,EAAM,KAAK;IAEX,IAAM,IAAI,EAAW,QAAQ;IAC7B,KAAK,IAAM,KAAW,GAAO;KAC3B,IAAM,IAAM,EAAK,GAAY,CAAO,GAC9B,IAAW,EAAW,QAAQ,EACjC,OAAO,EAAa,CAAG,CAAC,EACxB,OAAO,KAAK;KAKf,AADA,EAAE,OAAO,GAAG,EAAQ,OAAO,GAAG,EAAQ,GAAG,GACzC,EAAE,OAAO,GAAG,EAAS,OAAO,GAAG,EAAS,GAAG;IAC7C;IACA,IAAM,IAAW,EAAE,OAAO,KAAK;IAE/B,EAAc,EAAK,GAAQ,CAAQ,GAAG,IAAW,MAAM,MAAM;GAC/D;EACF;CACF;AACF;AAOA,SAAS,EAAa,GAAwB;CAC5C,IAAM,IAAgB,CAAC,GACjB,IAAwC,CAAC;EAAE,KAAK;EAAM,KAAK;CAAG,CAAC;CACrE,OAAO,EAAM,SAAS,IAAG;EACvB,IAAM,EAAE,QAAK,WAAQ,EAAM,IAAI,GAC3B;EACJ,IAAI;GACF,IAAU,EAAY,CAAG;EAC3B,SAAS,GAAK;GAIZ,IACE,KACA,OAAO,KAAQ,YACf,UAAU,KACT,EAAyB,SAAS,UAEnC,OAAO,CAAC;GAEV,MAAM;EACR;EACA,KAAK,IAAM,KAAQ,GAAS;GAC1B,IAAM,IAAW,EAAK,GAAK,CAAI,GACzB,IAAW,IAAM,GAAG,EAAI,GAAG,MAAS;GAC1C,AAAI,EAAS,CAAQ,EAAE,YAAY,IACjC,EAAM,KAAK;IAAE,KAAK;IAAU,KAAK;GAAS,CAAC,IAE3C,EAAI,KAAK,CAAQ;EAErB;CACF;CACA,OAAO;AACT"}
|