@dxos/config 0.8.4-main.7ace549 → 0.8.4-main.937b3ca

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.
Files changed (68) hide show
  1. package/dist/lib/browser/chunk-WETPAQBA.mjs +147 -0
  2. package/dist/lib/browser/chunk-WETPAQBA.mjs.map +7 -0
  3. package/dist/lib/browser/chunk-ZI5JXCYY.mjs +11 -0
  4. package/dist/lib/browser/chunk-ZI5JXCYY.mjs.map +7 -0
  5. package/dist/lib/browser/index.mjs +45 -232
  6. package/dist/lib/browser/index.mjs.map +4 -4
  7. package/dist/lib/browser/loaders/browser.mjs +98 -0
  8. package/dist/lib/browser/loaders/browser.mjs.map +7 -0
  9. package/dist/lib/browser/loaders/index.mjs +71 -0
  10. package/dist/lib/browser/loaders/index.mjs.map +7 -0
  11. package/dist/lib/browser/meta.json +1 -1
  12. package/dist/lib/browser/plugin/browser.mjs +8 -0
  13. package/dist/lib/browser/plugin/browser.mjs.map +7 -0
  14. package/dist/lib/browser/plugin/index.mjs +116 -0
  15. package/dist/lib/browser/plugin/index.mjs.map +7 -0
  16. package/dist/lib/browser/savers/browser.mjs +35 -0
  17. package/dist/lib/browser/savers/browser.mjs.map +7 -0
  18. package/dist/lib/browser/savers/index.mjs +7 -0
  19. package/dist/lib/browser/savers/index.mjs.map +7 -0
  20. package/dist/lib/node-esm/chunk-FVCGIRXP.mjs +149 -0
  21. package/dist/lib/node-esm/chunk-FVCGIRXP.mjs.map +7 -0
  22. package/dist/lib/node-esm/chunk-ODEKAZ4J.mjs +13 -0
  23. package/dist/lib/node-esm/chunk-ODEKAZ4J.mjs.map +7 -0
  24. package/dist/lib/node-esm/index.mjs +49 -330
  25. package/dist/lib/node-esm/index.mjs.map +4 -4
  26. package/dist/lib/node-esm/loaders/browser.mjs +100 -0
  27. package/dist/lib/node-esm/loaders/browser.mjs.map +7 -0
  28. package/dist/lib/node-esm/loaders/index.mjs +72 -0
  29. package/dist/lib/node-esm/loaders/index.mjs.map +7 -0
  30. package/dist/lib/node-esm/meta.json +1 -1
  31. package/dist/lib/node-esm/plugin/browser.mjs +10 -0
  32. package/dist/lib/node-esm/plugin/browser.mjs.map +7 -0
  33. package/dist/lib/node-esm/plugin/index.mjs +117 -0
  34. package/dist/lib/node-esm/plugin/index.mjs.map +7 -0
  35. package/dist/lib/node-esm/savers/browser.mjs +37 -0
  36. package/dist/lib/node-esm/savers/browser.mjs.map +7 -0
  37. package/dist/lib/node-esm/savers/index.mjs +9 -0
  38. package/dist/lib/node-esm/savers/index.mjs.map +7 -0
  39. package/dist/plugin/node-esm/{chunk-V3PJG4GW.mjs → chunk-QQKWALKX.mjs} +1 -1
  40. package/dist/plugin/node-esm/chunk-QQKWALKX.mjs.map +7 -0
  41. package/dist/plugin/node-esm/esbuild-plugin.mjs +1 -1
  42. package/dist/plugin/node-esm/meta.json +1 -1
  43. package/dist/plugin/node-esm/rollup-plugin.mjs +1 -1
  44. package/dist/plugin/node-esm/vite-plugin.mjs +1 -1
  45. package/dist/types/src/config-service.d.ts +1 -0
  46. package/dist/types/src/config-service.d.ts.map +1 -1
  47. package/dist/types/src/config.d.ts +0 -1
  48. package/dist/types/src/config.d.ts.map +1 -1
  49. package/dist/types/src/index.d.ts +3 -3
  50. package/dist/types/src/index.d.ts.map +1 -1
  51. package/dist/types/src/loaders/browser.d.ts +11 -15
  52. package/dist/types/src/loaders/browser.d.ts.map +1 -1
  53. package/dist/types/src/plugin/browser.d.ts +3 -0
  54. package/dist/types/src/plugin/browser.d.ts.map +1 -0
  55. package/dist/types/src/preset.d.ts +1 -1
  56. package/dist/types/src/preset.d.ts.map +1 -1
  57. package/dist/types/src/savers/browser.d.ts +2 -1
  58. package/dist/types/src/savers/browser.d.ts.map +1 -1
  59. package/dist/types/tsconfig.tsbuildinfo +1 -1
  60. package/package.json +45 -18
  61. package/src/config-service.ts +29 -13
  62. package/src/config.ts +0 -2
  63. package/src/index.ts +3 -3
  64. package/src/loaders/{browser.js → browser.ts} +15 -9
  65. package/src/plugin/browser.ts +11 -0
  66. package/src/preset.ts +2 -1
  67. package/src/savers/{browser.js → browser.ts} +2 -2
  68. package/dist/plugin/node-esm/chunk-V3PJG4GW.mjs.map +0 -7
@@ -0,0 +1,100 @@
1
+ import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
2
+
3
+ // src/loaders/browser.ts
4
+ import localforage from "localforage";
5
+ import { log } from "@dxos/log";
6
+ var __dxlog_file = "/__w/dxos/dxos/packages/sdk/config/src/loaders/browser.ts";
7
+ var CONFIG_ENDPOINT = "/.well-known/dx/config";
8
+ var Profile = (_profile = "default") => ({});
9
+ var Local = () => {
10
+ return typeof __CONFIG_LOCAL__ !== "undefined" ? __CONFIG_LOCAL__ : {};
11
+ };
12
+ var Dynamics = async () => {
13
+ const { publicUrl = "", dynamic } = __DXOS_CONFIG__;
14
+ if (!dynamic) {
15
+ log("dynamics disabled", void 0, {
16
+ F: __dxlog_file,
17
+ L: 28,
18
+ S: void 0,
19
+ C: (f, a) => f(...a)
20
+ });
21
+ return {};
22
+ }
23
+ log("fetching config...", {
24
+ publicUrl
25
+ }, {
26
+ F: __dxlog_file,
27
+ L: 32,
28
+ S: void 0,
29
+ C: (f, a) => f(...a)
30
+ });
31
+ return await fetch(`${publicUrl}${CONFIG_ENDPOINT}`).then((res) => res.json()).catch((error) => {
32
+ log.warn("Failed to fetch dynamic config.", error, {
33
+ F: __dxlog_file,
34
+ L: 36,
35
+ S: void 0,
36
+ C: (f, a) => f(...a)
37
+ });
38
+ return {};
39
+ });
40
+ };
41
+ var Envs = (_basePath) => {
42
+ return typeof __CONFIG_ENVS__ !== "undefined" ? __CONFIG_ENVS__ : {};
43
+ };
44
+ var Defaults = (_basePath) => {
45
+ return typeof __CONFIG_DEFAULTS__ !== "undefined" ? __CONFIG_DEFAULTS__ : {};
46
+ };
47
+ var Storage = async () => {
48
+ try {
49
+ const config = await localforage.getItem("dxos.org/settings/config");
50
+ if (config) {
51
+ return config;
52
+ }
53
+ } catch (err) {
54
+ log.warn("Failed to load config", {
55
+ err
56
+ }, {
57
+ F: __dxlog_file,
58
+ L: 59,
59
+ S: void 0,
60
+ C: (f, a) => f(...a)
61
+ });
62
+ }
63
+ return {};
64
+ };
65
+ var Remote = (target, authenticationToken) => {
66
+ if (!target) {
67
+ return {};
68
+ }
69
+ try {
70
+ const url = new URL(target);
71
+ const protocol = url.protocol.slice(0, -1);
72
+ return {
73
+ runtime: {
74
+ client: {
75
+ // TODO(burdon): Remove vault.html.
76
+ remoteSource: url.origin + (protocol.startsWith("http") ? "/vault.html" : ""),
77
+ remoteSourceAuthenticationToken: authenticationToken
78
+ }
79
+ }
80
+ };
81
+ } catch (err) {
82
+ log.catch(err, void 0, {
83
+ F: __dxlog_file,
84
+ L: 83,
85
+ S: void 0,
86
+ C: (f, a) => f(...a)
87
+ });
88
+ return {};
89
+ }
90
+ };
91
+ export {
92
+ Defaults,
93
+ Dynamics,
94
+ Envs,
95
+ Local,
96
+ Profile,
97
+ Remote,
98
+ Storage
99
+ };
100
+ //# sourceMappingURL=browser.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/loaders/browser.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2021 DXOS.org\n//\n\n/* THIS FILE WILL BE LOADED BY CONTEXT REPLACEMENT PLUGIN IN BROWSER ENVS. */\n\nimport localforage from 'localforage';\n\nimport { log } from '@dxos/log';\nimport { type Config as ConfigProto } from '@dxos/protocols/proto/dxos/config';\n\ndeclare const __DXOS_CONFIG__: { publicUrl?: string; dynamic?: boolean };\ndeclare const __CONFIG_ENVS__: Partial<ConfigProto> | undefined;\ndeclare const __CONFIG_DEFAULTS__: Partial<ConfigProto> | undefined;\ndeclare const __CONFIG_LOCAL__: Partial<ConfigProto> | undefined;\n\nconst CONFIG_ENDPOINT = '/.well-known/dx/config';\n\nexport const Profile = (_profile = 'default'): Partial<ConfigProto> => ({});\n\nexport const Local = (): Partial<ConfigProto> => {\n return typeof __CONFIG_LOCAL__ !== 'undefined' ? __CONFIG_LOCAL__ : {};\n};\n\nexport const Dynamics = async (): Promise<Partial<ConfigProto>> => {\n const { publicUrl = '', dynamic } = __DXOS_CONFIG__;\n if (!dynamic) {\n log('dynamics disabled');\n return {};\n }\n\n log('fetching config...', { publicUrl });\n return await fetch(`${publicUrl}${CONFIG_ENDPOINT}`)\n .then((res) => res.json())\n .catch((error) => {\n log.warn('Failed to fetch dynamic config.', error);\n return {};\n });\n};\n\nexport const Envs = (_basePath?: string): Partial<ConfigProto> => {\n return typeof __CONFIG_ENVS__ !== 'undefined' ? __CONFIG_ENVS__ : {};\n};\n\nexport const Defaults = (_basePath?: string): Partial<ConfigProto> => {\n return typeof __CONFIG_DEFAULTS__ !== 'undefined' ? __CONFIG_DEFAULTS__ : {};\n};\n\n/**\n * Settings config from browser storage.\n */\nexport const Storage = async (): Promise<Partial<ConfigProto>> => {\n try {\n const config = await localforage.getItem<Partial<ConfigProto>>('dxos.org/settings/config');\n if (config) {\n return config;\n }\n } catch (err) {\n log.warn('Failed to load config', { err });\n }\n return {};\n};\n\nexport const Remote = (target: string | undefined, authenticationToken?: string): Partial<ConfigProto> => {\n if (!target) {\n return {};\n }\n\n try {\n const url = new URL(target);\n const protocol = url.protocol.slice(0, -1);\n\n return {\n runtime: {\n client: {\n // TODO(burdon): Remove vault.html.\n remoteSource: url.origin + (protocol.startsWith('http') ? '/vault.html' : ''),\n remoteSourceAuthenticationToken: authenticationToken,\n },\n },\n };\n } catch (err) {\n log.catch(err);\n return {};\n }\n};\n"],
5
+ "mappings": ";;;AAMA,OAAOA,iBAAiB;AAExB,SAASC,WAAW;AAJuD,IAAA,eAAA;AAY3E,IAAMC,kBAAkB;AAEjB,IAAMC,UAAU,CAACC,WAAW,eAAqC,CAAC;AAElE,IAAMC,QAAQ,MAAA;AACnB,SAAO,OAAOC,qBAAqB,cAAcA,mBAAmB,CAAC;AACvE;AAEO,IAAMC,WAAW,YAAA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", "Profile", "_profile", "Local", "__CONFIG_LOCAL__", "Dynamics", "publicUrl", "dynamic", "__DXOS_CONFIG__", "fetch", "then", "res", "json", "catch", "error", "warn", "Envs", "_basePath", "__CONFIG_ENVS__", "Defaults", "__CONFIG_DEFAULTS__", "Storage", "config", "getItem", "err", "Remote", "target", "authenticationToken", "url", "URL", "protocol", "slice", "runtime", "client", "remoteSource", "origin", "startsWith", "remoteSourceAuthenticationToken"]
7
+ }
@@ -0,0 +1,72 @@
1
+ import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
2
+ import {
3
+ FILE_DEFAULTS,
4
+ FILE_ENVS
5
+ } from "../chunk-ODEKAZ4J.mjs";
6
+ import {
7
+ mapFromKeyValues
8
+ } from "../chunk-FVCGIRXP.mjs";
9
+
10
+ // src/loaders/index.ts
11
+ import fs from "node:fs";
12
+ import path from "node:path";
13
+ import { parse } from "yaml";
14
+ import { log } from "@dxos/log";
15
+ var __dxlog_file = "/__w/dxos/dxos/packages/sdk/config/src/loaders/index.ts";
16
+ var DEFAULT_BASE_PATH = path.resolve(process.cwd(), "config");
17
+ var maybeLoadFile = (file) => {
18
+ try {
19
+ return parse(fs.readFileSync(file, {
20
+ encoding: "utf8"
21
+ }));
22
+ } catch (err) {
23
+ }
24
+ };
25
+ var Profile = (profile = "default") => {
26
+ const configFile = path.join(process.env.HOME ?? "~", `.config/dx/profile/${profile}.yml`);
27
+ return maybeLoadFile(configFile);
28
+ };
29
+ var Local = () => ({});
30
+ var Dynamics = () => ({});
31
+ var Envs = (basePath = DEFAULT_BASE_PATH) => {
32
+ const content = maybeLoadFile(path.resolve(basePath, FILE_ENVS));
33
+ return content ? mapFromKeyValues(content, process.env) : {};
34
+ };
35
+ var Defaults = (basePath = DEFAULT_BASE_PATH) => maybeLoadFile(path.resolve(basePath, FILE_DEFAULTS)) ?? {};
36
+ var Storage = async () => ({});
37
+ var Remote = (target, authenticationToken) => {
38
+ if (!target) {
39
+ return {};
40
+ }
41
+ try {
42
+ const url = new URL(target);
43
+ const protocol = url.protocol.slice(0, -1);
44
+ return {
45
+ runtime: {
46
+ client: {
47
+ // TODO(burdon): Remove vault.html.
48
+ remoteSource: url.origin + (protocol.startsWith("http") ? "/vault.html" : ""),
49
+ remoteSourceAuthenticationToken: authenticationToken
50
+ }
51
+ }
52
+ };
53
+ } catch (err) {
54
+ log.catch(err, void 0, {
55
+ F: __dxlog_file,
56
+ L: 88,
57
+ S: void 0,
58
+ C: (f, a) => f(...a)
59
+ });
60
+ return {};
61
+ }
62
+ };
63
+ export {
64
+ Defaults,
65
+ Dynamics,
66
+ Envs,
67
+ Local,
68
+ Profile,
69
+ Remote,
70
+ Storage
71
+ };
72
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/loaders/index.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2021 DXOS.org\n//\n\nimport fs from 'node:fs';\nimport path from 'node:path';\n\nimport { parse } from 'yaml';\n\nimport { log } from '@dxos/log';\nimport { type Config as ConfigProto } from '@dxos/protocols/proto/dxos/config';\n\nimport { mapFromKeyValues } from '../config';\nimport { FILE_DEFAULTS, FILE_ENVS } from '../types';\n\n// TODO(burdon): Move code out of index file.\n\nconst DEFAULT_BASE_PATH = path.resolve(process.cwd(), 'config');\n\nconst maybeLoadFile = (file: string): any => {\n try {\n return parse(fs.readFileSync(file, { encoding: 'utf8' }));\n } catch (err: any) {\n // Ignored.\n }\n};\n\n//\n// NOTE: Export LocalStorage and Dynamics for typescript to typecheck browser code (see ConfigPlugin).\n//\n\n/**\n * Profile\n */\nexport const Profile = (profile = 'default') => {\n const configFile = path.join(process.env.HOME ?? '~', `.config/dx/profile/${profile}.yml`);\n return maybeLoadFile(configFile) as ConfigProto;\n};\n\n/**\n * Development config.\n */\n// TODO(burdon): Rename or reconcile with Profile above?\nexport const Local = (): Partial<ConfigProto> => ({});\n\n/**\n * Provided dynamically by server.\n */\nexport const Dynamics = (): Partial<ConfigProto> => ({});\n\n/**\n * ENV variable (key/value) map.\n */\nexport const Envs = (basePath = DEFAULT_BASE_PATH): Partial<ConfigProto> => {\n const content = maybeLoadFile(path.resolve(basePath, FILE_ENVS));\n return content ? mapFromKeyValues(content, process.env) : {};\n};\n\n/**\n * JSON config.\n */\nexport const Defaults = (basePath = DEFAULT_BASE_PATH): Partial<ConfigProto> =>\n maybeLoadFile(path.resolve(basePath, FILE_DEFAULTS)) ?? {};\n\n/**\n * Load config from storage.\n */\nexport const Storage = async (): Promise<Partial<ConfigProto>> => ({});\n\nexport const Remote = (target: string | undefined, authenticationToken?: string): Partial<ConfigProto> => {\n if (!target) {\n return {};\n }\n\n try {\n const url = new URL(target);\n const protocol = url.protocol.slice(0, -1);\n return {\n runtime: {\n client: {\n // TODO(burdon): Remove vault.html.\n remoteSource: url.origin + (protocol.startsWith('http') ? '/vault.html' : ''),\n remoteSourceAuthenticationToken: authenticationToken,\n },\n },\n };\n } catch (err) {\n log.catch(err);\n return {};\n }\n};\n"],
5
+ "mappings": ";;;;;;;;;;AAIA,OAAOA,QAAQ;AACf,OAAOC,UAAU;AAEjB,SAASC,aAAa;AAEtB,SAASC,WAAW;;AAQpB,IAAMC,oBAAoBC,KAAKC,QAAQC,QAAQC,IAAG,GAAI,QAAA;AAEtD,IAAMC,gBAAgB,CAACC,SAAAA;AACrB,MAAI;AACF,WAAOC,MAAMC,GAAGC,aAAaH,MAAM;MAAEI,UAAU;IAAO,CAAA,CAAA;EACxD,SAASC,KAAU;EAEnB;AACF;AASO,IAAMC,UAAU,CAACC,UAAU,cAAS;AACzC,QAAMC,aAAab,KAAKc,KAAKZ,QAAQa,IAAIC,QAAQ,KAAK,sBAAsBJ,OAAAA,MAAa;AACzF,SAAOR,cAAcS,UAAAA;AACvB;AAMO,IAAMI,QAAQ,OAA6B,CAAC;AAK5C,IAAMC,WAAW,OAA6B,CAAC;AAK/C,IAAMC,OAAO,CAACC,WAAWrB,sBAAiB;AAC/C,QAAMsB,UAAUjB,cAAcJ,KAAKC,QAAQmB,UAAUE,SAAAA,CAAAA;AACrD,SAAOD,UAAUE,iBAAiBF,SAASnB,QAAQa,GAAG,IAAI,CAAC;AAC7D;AAKO,IAAMS,WAAW,CAACJ,WAAWrB,sBAClCK,cAAcJ,KAAKC,QAAQmB,UAAUK,aAAAA,CAAAA,KAAmB,CAAC;AAKpD,IAAMC,UAAU,aAA4C,CAAC;AAE7D,IAAMC,SAAS,CAACC,QAA4BC,wBAAAA;AACjD,MAAI,CAACD,QAAQ;AACX,WAAO,CAAC;EACV;AAEA,MAAI;AACF,UAAME,MAAM,IAAIC,IAAIH,MAAAA;AACpB,UAAMI,WAAWF,IAAIE,SAASC,MAAM,GAAG,EAAC;AACxC,WAAO;MACLC,SAAS;QACPC,QAAQ;;UAENC,cAAcN,IAAIO,UAAUL,SAASM,WAAW,MAAA,IAAU,gBAAgB;UAC1EC,iCAAiCV;QACnC;MACF;IACF;EACF,SAASnB,KAAK;AACZ8B,QAAIC,MAAM/B,KAAAA,QAAAA;;;;;;AACV,WAAO,CAAC;EACV;AACF;",
6
+ "names": ["fs", "path", "parse", "log", "DEFAULT_BASE_PATH", "path", "resolve", "process", "cwd", "maybeLoadFile", "file", "parse", "fs", "readFileSync", "encoding", "err", "Profile", "profile", "configFile", "join", "env", "HOME", "Local", "Dynamics", "Envs", "basePath", "content", "FILE_ENVS", "mapFromKeyValues", "Defaults", "FILE_DEFAULTS", "Storage", "Remote", "target", "authenticationToken", "url", "URL", "protocol", "slice", "runtime", "client", "remoteSource", "origin", "startsWith", "remoteSourceAuthenticationToken", "log", "catch"]
7
+ }
@@ -1 +1 @@
1
- {"inputs":{"src/config.ts":{"bytes":16009,"imports":[{"path":"boolean","kind":"import-statement","external":true},{"path":"lodash.defaultsdeep","kind":"import-statement","external":true},{"path":"lodash.ismatch","kind":"import-statement","external":true},{"path":"@dxos/protocols","kind":"import-statement","external":true},{"path":"@dxos/protocols/proto","kind":"import-statement","external":true},{"path":"@dxos/tracing","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true}],"format":"esm"},"src/config-service.ts":{"bytes":11041,"imports":[{"path":"node:path","kind":"import-statement","external":true},{"path":"@effect/platform/FileSystem","kind":"import-statement","external":true},{"path":"effect/Context","kind":"import-statement","external":true},{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"effect/Layer","kind":"import-statement","external":true},{"path":"effect/Option","kind":"import-statement","external":true},{"path":"yaml","kind":"import-statement","external":true},{"path":"@dxos/client-protocol","kind":"import-statement","external":true},{"path":"@dxos/client-protocol","kind":"import-statement","external":true},{"path":"src/config.ts","kind":"import-statement","original":"./config"}],"format":"esm"},"src/types.ts":{"bytes":2735,"imports":[],"format":"esm"},"src/loaders/index.ts":{"bytes":8224,"imports":[{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"yaml","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"src/config.ts","kind":"import-statement","original":"../config"},{"path":"src/types.ts","kind":"import-statement","original":"../types"}],"format":"esm"},"src/savers/index.ts":{"bytes":666,"imports":[],"format":"esm"},"src/plugin/definitions.ts":{"bytes":12031,"imports":[{"path":"node:child_process","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"pkg-up","kind":"import-statement","external":true},{"path":"yaml","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"src/config.ts","kind":"import-statement","original":"../config"}],"format":"esm"},"src/plugin/index.ts":{"bytes":504,"imports":[{"path":"src/plugin/definitions.ts","kind":"import-statement","original":"./definitions"}],"format":"esm"},"src/preset.ts":{"bytes":3066,"imports":[{"path":"effect/Match","kind":"import-statement","external":true},{"path":"src/config.ts","kind":"import-statement","original":"./config"}],"format":"esm"},"src/index.ts":{"bytes":1404,"imports":[{"path":"@dxos/protocols/proto/dxos/config","kind":"import-statement","external":true},{"path":"src/config.ts","kind":"import-statement","original":"./config"},{"path":"src/config-service.ts","kind":"import-statement","original":"./config-service"},{"path":"src/loaders/index.ts","kind":"import-statement","original":"./loaders"},{"path":"src/savers/index.ts","kind":"import-statement","original":"./savers"},{"path":"src/plugin/index.ts","kind":"import-statement","original":"./plugin"},{"path":"src/types.ts","kind":"import-statement","original":"./types"},{"path":"src/preset.ts","kind":"import-statement","original":"./preset"}],"format":"esm"}},"outputs":{"dist/lib/node-esm/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":27085},"dist/lib/node-esm/index.mjs":{"imports":[{"path":"@dxos/protocols/proto/dxos/config","kind":"import-statement","external":true},{"path":"boolean","kind":"import-statement","external":true},{"path":"lodash.defaultsdeep","kind":"import-statement","external":true},{"path":"lodash.ismatch","kind":"import-statement","external":true},{"path":"@dxos/protocols","kind":"import-statement","external":true},{"path":"@dxos/protocols/proto","kind":"import-statement","external":true},{"path":"@dxos/tracing","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"@effect/platform/FileSystem","kind":"import-statement","external":true},{"path":"effect/Context","kind":"import-statement","external":true},{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"effect/Layer","kind":"import-statement","external":true},{"path":"effect/Option","kind":"import-statement","external":true},{"path":"yaml","kind":"import-statement","external":true},{"path":"@dxos/client-protocol","kind":"import-statement","external":true},{"path":"@dxos/client-protocol","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"yaml","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"node:child_process","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"pkg-up","kind":"import-statement","external":true},{"path":"yaml","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"effect/Match","kind":"import-statement","external":true}],"exports":["Config","ConfigResource","ConfigService","Defaults","Dynamics","Envs","FILE_DEFAULTS","FILE_DYNAMICS","FILE_ENVS","Local","Profile","Remote","SaveConfig","Storage","configPreset","defaultConfig","definitions","defs","mapFromKeyValues","mapToKeyValues","memoryConfig","validateConfig"],"entryPoint":"src/index.ts","inputs":{"src/index.ts":{"bytesInOutput":59},"src/config.ts":{"bytesInOutput":4098},"src/config-service.ts":{"bytesInOutput":2731},"src/loaders/index.ts":{"bytesInOutput":1558},"src/types.ts":{"bytesInOutput":102},"src/savers/index.ts":{"bytesInOutput":35},"src/plugin/definitions.ts":{"bytesInOutput":3239},"src/plugin/index.ts":{"bytesInOutput":0},"src/preset.ts":{"bytesInOutput":541}},"bytes":13008}}}
1
+ {"inputs":{"src/config.ts":{"bytes":15994,"imports":[{"path":"boolean","kind":"import-statement","external":true},{"path":"lodash.defaultsdeep","kind":"import-statement","external":true},{"path":"lodash.ismatch","kind":"import-statement","external":true},{"path":"@dxos/protocols","kind":"import-statement","external":true},{"path":"@dxos/protocols/proto","kind":"import-statement","external":true},{"path":"@dxos/tracing","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true}],"format":"esm"},"src/config-service.ts":{"bytes":12105,"imports":[{"path":"node:path","kind":"import-statement","external":true},{"path":"@effect/platform/FileSystem","kind":"import-statement","external":true},{"path":"effect/Context","kind":"import-statement","external":true},{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"effect/Layer","kind":"import-statement","external":true},{"path":"effect/Option","kind":"import-statement","external":true},{"path":"yaml","kind":"import-statement","external":true},{"path":"@dxos/client-protocol","kind":"import-statement","external":true},{"path":"@dxos/client-protocol","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"src/config.ts","kind":"import-statement","original":"./config"}],"format":"esm"},"src/types.ts":{"bytes":2735,"imports":[],"format":"esm"},"src/preset.ts":{"bytes":3324,"imports":[{"path":"effect/Match","kind":"import-statement","external":true},{"path":"src/config.ts","kind":"import-statement","original":"./config"}],"format":"esm"},"src/index.ts":{"bytes":1397,"imports":[{"path":"@dxos/protocols/proto/dxos/config","kind":"import-statement","external":true},{"path":"src/config.ts","kind":"import-statement","original":"./config"},{"path":"src/config-service.ts","kind":"import-statement","original":"./config-service"},{"path":"#loaders","kind":"import-statement","external":true},{"path":"#savers","kind":"import-statement","external":true},{"path":"#plugin","kind":"import-statement","external":true},{"path":"src/types.ts","kind":"import-statement","original":"./types"},{"path":"src/preset.ts","kind":"import-statement","original":"./preset"}],"format":"esm"},"src/loaders/index.ts":{"bytes":8224,"imports":[{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"yaml","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"src/config.ts","kind":"import-statement","original":"../config"},{"path":"src/types.ts","kind":"import-statement","original":"../types"}],"format":"esm"},"src/loaders/browser.ts":{"bytes":8612,"imports":[{"path":"localforage","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true}],"format":"esm"},"src/savers/index.ts":{"bytes":666,"imports":[],"format":"esm"},"src/savers/browser.ts":{"bytes":2707,"imports":[{"path":"localforage","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true}],"format":"esm"},"src/plugin/definitions.ts":{"bytes":12031,"imports":[{"path":"node:child_process","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"pkg-up","kind":"import-statement","external":true},{"path":"yaml","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"src/config.ts","kind":"import-statement","original":"../config"}],"format":"esm"},"src/plugin/index.ts":{"bytes":504,"imports":[{"path":"src/plugin/definitions.ts","kind":"import-statement","original":"./definitions"}],"format":"esm"},"src/plugin/browser.ts":{"bytes":1003,"imports":[],"format":"esm"}},"outputs":{"dist/lib/node-esm/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":8219},"dist/lib/node-esm/index.mjs":{"imports":[{"path":"dist/lib/node-esm/chunk-ODEKAZ4J.mjs","kind":"import-statement"},{"path":"dist/lib/node-esm/chunk-FVCGIRXP.mjs","kind":"import-statement"},{"path":"@dxos/protocols/proto/dxos/config","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"@effect/platform/FileSystem","kind":"import-statement","external":true},{"path":"effect/Context","kind":"import-statement","external":true},{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"effect/Layer","kind":"import-statement","external":true},{"path":"effect/Option","kind":"import-statement","external":true},{"path":"yaml","kind":"import-statement","external":true},{"path":"@dxos/client-protocol","kind":"import-statement","external":true},{"path":"@dxos/client-protocol","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"#loaders","kind":"import-statement","external":true},{"path":"#savers","kind":"import-statement","external":true},{"path":"#plugin","kind":"import-statement","external":true},{"path":"effect/Match","kind":"import-statement","external":true}],"exports":["Config","ConfigResource","ConfigService","FILE_DEFAULTS","FILE_DYNAMICS","FILE_ENVS","configPreset","defaultConfig","defs","mapFromKeyValues","mapToKeyValues","memoryConfig","validateConfig"],"entryPoint":"src/index.ts","inputs":{"src/index.ts":{"bytesInOutput":135},"src/config-service.ts":{"bytesInOutput":3206},"src/preset.ts":{"bytesInOutput":617}},"bytes":4588},"dist/lib/node-esm/loaders/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":4122},"dist/lib/node-esm/loaders/index.mjs":{"imports":[{"path":"dist/lib/node-esm/chunk-ODEKAZ4J.mjs","kind":"import-statement"},{"path":"dist/lib/node-esm/chunk-FVCGIRXP.mjs","kind":"import-statement"},{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"yaml","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true}],"exports":["Defaults","Dynamics","Envs","Local","Profile","Remote","Storage"],"entryPoint":"src/loaders/index.ts","inputs":{"src/loaders/index.ts":{"bytesInOutput":1547}},"bytes":1913},"dist/lib/node-esm/chunk-ODEKAZ4J.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":1815},"dist/lib/node-esm/chunk-ODEKAZ4J.mjs":{"imports":[],"exports":["FILE_DEFAULTS","FILE_DYNAMICS","FILE_ENVS"],"inputs":{"src/types.ts":{"bytesInOutput":102}},"bytes":314},"dist/lib/node-esm/loaders/browser.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":4407},"dist/lib/node-esm/loaders/browser.mjs":{"imports":[{"path":"localforage","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true}],"exports":["Defaults","Dynamics","Envs","Local","Profile","Remote","Storage"],"entryPoint":"src/loaders/browser.ts","inputs":{"src/loaders/browser.ts":{"bytesInOutput":2148}},"bytes":2388},"dist/lib/node-esm/savers/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":360},"dist/lib/node-esm/savers/index.mjs":{"imports":[],"exports":["SaveConfig"],"entryPoint":"src/savers/index.ts","inputs":{"src/savers/index.ts":{"bytesInOutput":35}},"bytes":211},"dist/lib/node-esm/savers/browser.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":1282},"dist/lib/node-esm/savers/browser.mjs":{"imports":[{"path":"localforage","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true}],"exports":["SaveConfig"],"entryPoint":"src/savers/browser.ts","inputs":{"src/savers/browser.ts":{"bytesInOutput":747}},"bytes":927},"dist/lib/node-esm/plugin/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":5744},"dist/lib/node-esm/plugin/index.mjs":{"imports":[{"path":"dist/lib/node-esm/chunk-FVCGIRXP.mjs","kind":"import-statement"},{"path":"node:child_process","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"pkg-up","kind":"import-statement","external":true},{"path":"yaml","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true}],"exports":["definitions"],"entryPoint":"src/plugin/index.ts","inputs":{"src/plugin/definitions.ts":{"bytesInOutput":3193},"src/plugin/index.ts":{"bytesInOutput":0}},"bytes":3436},"dist/lib/node-esm/chunk-FVCGIRXP.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":7881},"dist/lib/node-esm/chunk-FVCGIRXP.mjs":{"imports":[{"path":"boolean","kind":"import-statement","external":true},{"path":"lodash.defaultsdeep","kind":"import-statement","external":true},{"path":"lodash.ismatch","kind":"import-statement","external":true},{"path":"@dxos/protocols","kind":"import-statement","external":true},{"path":"@dxos/protocols/proto","kind":"import-statement","external":true},{"path":"@dxos/tracing","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true}],"exports":["Config","ConfigResource","mapFromKeyValues","mapToKeyValues","validateConfig"],"inputs":{"src/config.ts":{"bytesInOutput":4061}},"bytes":4311},"dist/lib/node-esm/plugin/browser.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":496},"dist/lib/node-esm/plugin/browser.mjs":{"imports":[],"exports":["definitions"],"entryPoint":"src/plugin/browser.ts","inputs":{"src/plugin/browser.ts":{"bytesInOutput":110}},"bytes":291}}}
@@ -0,0 +1,10 @@
1
+ import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
2
+
3
+ // src/plugin/browser.ts
4
+ var definitions = () => {
5
+ throw new Error("Config plugin definitions are not available in the browser");
6
+ };
7
+ export {
8
+ definitions
9
+ };
10
+ //# sourceMappingURL=browser.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/plugin/browser.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2022 DXOS.org\n//\n\n// Browser stub for plugin module - plugins are build-time only.\n\nexport type * from './types';\n\nexport const definitions = (): Record<string, unknown> => {\n throw new Error('Config plugin definitions are not available in the browser');\n};\n"],
5
+ "mappings": ";;;AAQO,IAAMA,cAAc,MAAA;AACzB,QAAM,IAAIC,MAAM,4DAAA;AAClB;",
6
+ "names": ["definitions", "Error"]
7
+ }
@@ -0,0 +1,117 @@
1
+ import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
2
+ import {
3
+ mapFromKeyValues
4
+ } from "../chunk-FVCGIRXP.mjs";
5
+
6
+ // src/plugin/definitions.ts
7
+ import { execSync } from "node:child_process";
8
+ import { readFileSync } from "node:fs";
9
+ import { resolve } from "node:path";
10
+ import pkgUp from "pkg-up";
11
+ import { parse } from "yaml";
12
+ import { invariant } from "@dxos/invariant";
13
+ import { log } from "@dxos/log";
14
+ import { setDeep } from "@dxos/util";
15
+ var __dxlog_file = "/__w/dxos/dxos/packages/sdk/config/src/plugin/definitions.ts";
16
+ var CWD = process.cwd();
17
+ var definitions = ({ configPath, envPath, devPath, mode = process.env.NODE_ENV, publicUrl = "", env }) => {
18
+ const KEYS_TO_FILE = {
19
+ __CONFIG_DEFAULTS__: configPath?.length ? configPath : resolve(CWD, "dx.yml"),
20
+ __CONFIG_ENVS__: envPath?.length ? envPath : resolve(CWD, "dx-env.yml")
21
+ };
22
+ if (mode !== "production") {
23
+ KEYS_TO_FILE.__CONFIG_LOCAL__ = devPath ?? resolve(CWD, "dx-local.yml");
24
+ }
25
+ return Object.entries(KEYS_TO_FILE).reduce((prev, [key, value]) => {
26
+ invariant(key, void 0, {
27
+ F: __dxlog_file,
28
+ L: 40,
29
+ S: void 0,
30
+ A: [
31
+ "key",
32
+ ""
33
+ ]
34
+ });
35
+ let content = {};
36
+ try {
37
+ content = parse(readFileSync(value, "utf-8"));
38
+ if (key === "__CONFIG_ENVS__") {
39
+ content = mapFromKeyValues(content, process.env);
40
+ }
41
+ if (key === "__CONFIG_DEFAULTS__") {
42
+ Object.entries(process.env).forEach(([key2, value2]) => {
43
+ if (key2.startsWith("DX_") || env?.includes(key2)) {
44
+ setDeep(content, [
45
+ "runtime",
46
+ "app",
47
+ "env",
48
+ key2
49
+ ], value2);
50
+ }
51
+ });
52
+ try {
53
+ const timestamp = (/* @__PURE__ */ new Date()).toISOString();
54
+ const commitHash = process.env.DX_COMMIT_HASH ?? execSync("git rev-parse --short HEAD", {
55
+ encoding: "utf-8"
56
+ }).replace("\n", "");
57
+ const packagePath = pkgUp.sync();
58
+ const packageJson = packagePath && JSON.parse(readFileSync(packagePath, "utf-8"));
59
+ setDeep(content, [
60
+ "runtime",
61
+ "app",
62
+ "build",
63
+ "timestamp"
64
+ ], timestamp);
65
+ setDeep(content, [
66
+ "runtime",
67
+ "app",
68
+ "build",
69
+ "commitHash"
70
+ ], commitHash);
71
+ setDeep(content, [
72
+ "runtime",
73
+ "app",
74
+ "build",
75
+ "version"
76
+ ], packageJson?.version);
77
+ } catch {
78
+ }
79
+ }
80
+ } catch (err) {
81
+ if (err.message.includes("YAMLException")) {
82
+ log.error(`Failed to parse file ${value}:`, err, {
83
+ F: __dxlog_file,
84
+ L: 73,
85
+ S: void 0,
86
+ C: (f, a) => f(...a)
87
+ });
88
+ } else {
89
+ log(`Failed to load file ${value}:`, err, {
90
+ F: __dxlog_file,
91
+ L: 75,
92
+ S: void 0,
93
+ C: (f, a) => f(...a)
94
+ });
95
+ }
96
+ if (key === "__CONFIG_DEFAULTS__") {
97
+ throw new Error(`Failed to load default config file from ${value}`);
98
+ }
99
+ }
100
+ return {
101
+ ...prev,
102
+ [key]: content
103
+ };
104
+ }, {
105
+ __CONFIG_DEFAULTS__: {},
106
+ __CONFIG_ENVS__: {},
107
+ __CONFIG_LOCAL__: {},
108
+ __DXOS_CONFIG__: {
109
+ dynamic: mode === "production",
110
+ publicUrl
111
+ }
112
+ });
113
+ };
114
+ export {
115
+ definitions
116
+ };
117
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/plugin/definitions.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2022 DXOS.org\n//\n\nimport { execSync } from 'node:child_process';\nimport { readFileSync } from 'node:fs';\nimport { resolve } from 'node:path';\n\nimport pkgUp from 'pkg-up';\nimport { parse } from 'yaml';\n\nimport { invariant } from '@dxos/invariant';\nimport { log } from '@dxos/log';\nimport { setDeep } from '@dxos/util';\n\nimport { mapFromKeyValues } from '../config';\n\nimport { type ConfigPluginOpts } from './types';\n\nconst CWD = process.cwd();\n\nexport const definitions = ({\n configPath,\n envPath,\n devPath,\n mode = process.env.NODE_ENV,\n publicUrl = '',\n env,\n}: ConfigPluginOpts) => {\n const KEYS_TO_FILE = {\n __CONFIG_DEFAULTS__: configPath?.length ? configPath : resolve(CWD, 'dx.yml'),\n __CONFIG_ENVS__: envPath?.length ? envPath : resolve(CWD, 'dx-env.yml'),\n } as { [key: string]: string };\n if (mode !== 'production') {\n KEYS_TO_FILE.__CONFIG_LOCAL__ = devPath ?? resolve(CWD, 'dx-local.yml');\n }\n\n return Object.entries(KEYS_TO_FILE).reduce(\n (prev, [key, value]) => {\n invariant(key);\n let content = {};\n try {\n content = parse(readFileSync(value, 'utf-8')) as any;\n\n // Map environment variables to config values.\n if (key === '__CONFIG_ENVS__') {\n content = mapFromKeyValues(content, process.env);\n }\n\n if (key === '__CONFIG_DEFAULTS__') {\n // Load app environment variables into default config.\n Object.entries(process.env).forEach(([key, value]) => {\n if (key.startsWith('DX_') || env?.includes(key)) {\n setDeep(content, ['runtime', 'app', 'env', key], value);\n }\n });\n\n // Set build info automatically if available.\n try {\n const timestamp = new Date().toISOString();\n const commitHash =\n process.env.DX_COMMIT_HASH ??\n execSync('git rev-parse --short HEAD', { encoding: 'utf-8' }).replace('\\n', '');\n const packagePath = pkgUp.sync();\n const packageJson = packagePath && JSON.parse(readFileSync(packagePath, 'utf-8'));\n setDeep(content, ['runtime', 'app', 'build', 'timestamp'], timestamp);\n setDeep(content, ['runtime', 'app', 'build', 'commitHash'], commitHash);\n setDeep(content, ['runtime', 'app', 'build', 'version'], packageJson?.version);\n } catch {}\n }\n } catch (err: any) {\n if (err.message.includes('YAMLException')) {\n log.error(`Failed to parse file ${value}:`, err);\n } else {\n log(`Failed to load file ${value}:`, err);\n }\n\n if (key === '__CONFIG_DEFAULTS__') {\n // Default config is required.\n throw new Error(`Failed to load default config file from ${value}`);\n }\n }\n\n return {\n ...prev,\n [key]: content,\n };\n },\n {\n __CONFIG_DEFAULTS__: {},\n __CONFIG_ENVS__: {},\n __CONFIG_LOCAL__: {},\n __DXOS_CONFIG__: { dynamic: mode === 'production', publicUrl },\n },\n );\n};\n"],
5
+ "mappings": ";;;;;;AAIA,SAASA,gBAAgB;AACzB,SAASC,oBAAoB;AAC7B,SAASC,eAAe;AAExB,OAAOC,WAAW;AAClB,SAASC,aAAa;AAEtB,SAASC,iBAAiB;AAC1B,SAASC,WAAW;AACpB,SAASC,eAAe;;AAMxB,IAAMC,MAAMC,QAAQC,IAAG;AAEhB,IAAMC,cAAc,CAAC,EAC1BC,YACAC,SACAC,SACAC,OAAON,QAAQO,IAAIC,UACnBC,YAAY,IACZF,IAAG,MACc;AACjB,QAAMG,eAAe;IACnBC,qBAAqBR,YAAYS,SAAST,aAAaU,QAAQd,KAAK,QAAA;IACpEe,iBAAiBV,SAASQ,SAASR,UAAUS,QAAQd,KAAK,YAAA;EAC5D;AACA,MAAIO,SAAS,cAAc;AACzBI,iBAAaK,mBAAmBV,WAAWQ,QAAQd,KAAK,cAAA;EAC1D;AAEA,SAAOiB,OAAOC,QAAQP,YAAAA,EAAcQ,OAClC,CAACC,MAAM,CAACC,KAAKC,KAAAA,MAAM;AACjBC,cAAUF,KAAAA,QAAAA;;;;;;;;;AACV,QAAIG,UAAU,CAAC;AACf,QAAI;AACFA,gBAAUC,MAAMC,aAAaJ,OAAO,OAAA,CAAA;AAGpC,UAAID,QAAQ,mBAAm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;IACnBmC,iBAAiB;MAAEC,SAAS7C,SAAS;MAAcG;IAAU;EAC/D,CAAA;AAEJ;",
6
+ "names": ["execSync", "readFileSync", "resolve", "pkgUp", "parse", "invariant", "log", "setDeep", "CWD", "process", "cwd", "definitions", "configPath", "envPath", "devPath", "mode", "env", "NODE_ENV", "publicUrl", "KEYS_TO_FILE", "__CONFIG_DEFAULTS__", "length", "resolve", "__CONFIG_ENVS__", "__CONFIG_LOCAL__", "Object", "entries", "reduce", "prev", "key", "value", "invariant", "content", "parse", "readFileSync", "mapFromKeyValues", "forEach", "startsWith", "includes", "setDeep", "timestamp", "Date", "toISOString", "commitHash", "DX_COMMIT_HASH", "execSync", "encoding", "replace", "packagePath", "pkgUp", "sync", "packageJson", "JSON", "version", "err", "message", "log", "error", "Error", "__DXOS_CONFIG__", "dynamic"]
7
+ }
@@ -0,0 +1,37 @@
1
+ import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
2
+
3
+ // src/savers/browser.ts
4
+ import localforage from "localforage";
5
+ import { log } from "@dxos/log";
6
+ var __dxlog_file = "/__w/dxos/dxos/packages/sdk/config/src/savers/browser.ts";
7
+ var PERFORMING_CONFIG_SAVE = false;
8
+ var SaveConfig = async (config) => {
9
+ if (PERFORMING_CONFIG_SAVE) {
10
+ log.warn("Already performing config save", void 0, {
11
+ F: __dxlog_file,
12
+ L: 16,
13
+ S: void 0,
14
+ C: (f, a) => f(...a)
15
+ });
16
+ return;
17
+ }
18
+ PERFORMING_CONFIG_SAVE = true;
19
+ try {
20
+ await localforage.setItem("dxos.org/settings/config", config);
21
+ } catch (err) {
22
+ log.warn("Failed to save config", {
23
+ err
24
+ }, {
25
+ F: __dxlog_file,
26
+ L: 24,
27
+ S: void 0,
28
+ C: (f, a) => f(...a)
29
+ });
30
+ } finally {
31
+ PERFORMING_CONFIG_SAVE = false;
32
+ }
33
+ };
34
+ export {
35
+ SaveConfig
36
+ };
37
+ //# sourceMappingURL=browser.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/savers/browser.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2021 DXOS.org\n//\n\n/* THIS FILE WILL BE LOADED BY CONTEXT REPLACEMENT PLUGIN IN BROWSER ENVS. */\n\nimport localforage from 'localforage';\n\nimport { log } from '@dxos/log';\nimport { type Config as ConfigProto } from '@dxos/protocols/proto/dxos/config';\n\nlet PERFORMING_CONFIG_SAVE = false;\n\nexport const SaveConfig = async (config: ConfigProto): Promise<void> => {\n if (PERFORMING_CONFIG_SAVE) {\n log.warn('Already performing config save');\n return;\n }\n PERFORMING_CONFIG_SAVE = true;\n\n try {\n await localforage.setItem('dxos.org/settings/config', config);\n } catch (err) {\n log.warn('Failed to save config', { err });\n } finally {\n PERFORMING_CONFIG_SAVE = false;\n }\n};\n"],
5
+ "mappings": ";;;AAMA,OAAOA,iBAAiB;AAExB,SAASC,WAAW;AAJuD,IAAA,eAAA;AAO3E,IAAIC,yBAAyB;AAEtB,IAAMC,aAAa,OAAOC,WAAAA;AAC/B,MAAIF,wBAAwB;AAC1BD,QAAII,KAAK,kCAAA,QAAA;;;;;;AACT;EACF;AACAH,2BAAyB;AAEzB,MAAI;AACF,UAAMF,YAAYM,QAAQ,4BAA4BF,MAAAA;EACxD,SAASG,KAAK;AACZN,QAAII,KAAK,yBAAyB;MAAEE;IAAI,GAAA;;;;;;EAC1C,UAAA;AACEL,6BAAyB;EAC3B;AACF;",
6
+ "names": ["localforage", "log", "PERFORMING_CONFIG_SAVE", "SaveConfig", "config", "warn", "setItem", "err"]
7
+ }
@@ -0,0 +1,9 @@
1
+ import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
2
+
3
+ // src/savers/index.ts
4
+ var SaveConfig = async (_) => {
5
+ };
6
+ export {
7
+ SaveConfig
8
+ };
9
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/savers/index.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport { type Config as ConfigProto } from '@dxos/protocols/proto/dxos/config';\n\nexport const SaveConfig = async (_: ConfigProto) => {};\n"],
5
+ "mappings": ";;;AAMO,IAAMA,aAAa,OAAOC,MAAAA;AAAoB;",
6
+ "names": ["SaveConfig", "_"]
7
+ }
@@ -237,4 +237,4 @@ var definitions = ({ configPath, envPath, devPath, mode = process.env.NODE_ENV,
237
237
  export {
238
238
  definitions
239
239
  };
240
- //# sourceMappingURL=chunk-V3PJG4GW.mjs.map
240
+ //# sourceMappingURL=chunk-QQKWALKX.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/plugin/definitions.ts", "../../../src/config.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2022 DXOS.org\n//\n\nimport { execSync } from 'node:child_process';\nimport { readFileSync } from 'node:fs';\nimport { resolve } from 'node:path';\n\nimport pkgUp from 'pkg-up';\nimport { parse } from 'yaml';\n\nimport { invariant } from '@dxos/invariant';\nimport { log } from '@dxos/log';\nimport { setDeep } from '@dxos/util';\n\nimport { mapFromKeyValues } from '../config';\n\nimport { type ConfigPluginOpts } from './types';\n\nconst CWD = process.cwd();\n\nexport const definitions = ({\n configPath,\n envPath,\n devPath,\n mode = process.env.NODE_ENV,\n publicUrl = '',\n env,\n}: ConfigPluginOpts) => {\n const KEYS_TO_FILE = {\n __CONFIG_DEFAULTS__: configPath?.length ? configPath : resolve(CWD, 'dx.yml'),\n __CONFIG_ENVS__: envPath?.length ? envPath : resolve(CWD, 'dx-env.yml'),\n } as { [key: string]: string };\n if (mode !== 'production') {\n KEYS_TO_FILE.__CONFIG_LOCAL__ = devPath ?? resolve(CWD, 'dx-local.yml');\n }\n\n return Object.entries(KEYS_TO_FILE).reduce(\n (prev, [key, value]) => {\n invariant(key);\n let content = {};\n try {\n content = parse(readFileSync(value, 'utf-8')) as any;\n\n // Map environment variables to config values.\n if (key === '__CONFIG_ENVS__') {\n content = mapFromKeyValues(content, process.env);\n }\n\n if (key === '__CONFIG_DEFAULTS__') {\n // Load app environment variables into default config.\n Object.entries(process.env).forEach(([key, value]) => {\n if (key.startsWith('DX_') || env?.includes(key)) {\n setDeep(content, ['runtime', 'app', 'env', key], value);\n }\n });\n\n // Set build info automatically if available.\n try {\n const timestamp = new Date().toISOString();\n const commitHash =\n process.env.DX_COMMIT_HASH ??\n execSync('git rev-parse --short HEAD', { encoding: 'utf-8' }).replace('\\n', '');\n const packagePath = pkgUp.sync();\n const packageJson = packagePath && JSON.parse(readFileSync(packagePath, 'utf-8'));\n setDeep(content, ['runtime', 'app', 'build', 'timestamp'], timestamp);\n setDeep(content, ['runtime', 'app', 'build', 'commitHash'], commitHash);\n setDeep(content, ['runtime', 'app', 'build', 'version'], packageJson?.version);\n } catch {}\n }\n } catch (err: any) {\n if (err.message.includes('YAMLException')) {\n log.error(`Failed to parse file ${value}:`, err);\n } else {\n log(`Failed to load file ${value}:`, err);\n }\n\n if (key === '__CONFIG_DEFAULTS__') {\n // Default config is required.\n throw new Error(`Failed to load default config file from ${value}`);\n }\n }\n\n return {\n ...prev,\n [key]: content,\n };\n },\n {\n __CONFIG_DEFAULTS__: {},\n __CONFIG_ENVS__: {},\n __CONFIG_LOCAL__: {},\n __DXOS_CONFIG__: { dynamic: mode === 'production', publicUrl },\n },\n );\n};\n", "//\n// Copyright 2021 DXOS.org\n//\n\nimport { boolean } from 'boolean';\nimport defaultsDeep from 'lodash.defaultsdeep';\nimport isMatch from 'lodash.ismatch';\n\nimport { InvalidConfigError } from '@dxos/protocols';\nimport { schema } from '@dxos/protocols/proto';\nimport { type Config as ConfigProto } from '@dxos/protocols/proto/dxos/config';\nimport { trace } from '@dxos/tracing';\nimport { getDeep, setDeep } from '@dxos/util';\n\nimport { type ConfigKey, type DeepIndex, type ParseKey } from './types';\n\ntype MappingSpec = Record<string, { path: string; type?: string }>;\nconst configRootType = schema.getCodecForType('dxos.config.Config');\n\n/**\n * Maps the given objects onto a flattened set of (key x values).\n * Expects parsed yaml content of the form:\n *\n * ```\n * ENV_VAR:\n * path: config.selector.path\n * ```\n *\n * @param {object} spec\n * @param {object} values\n * @return {object}\n */\nexport const mapFromKeyValues = (spec: MappingSpec, values: Record<string, any>) => {\n const config = {};\n\n for (const [key, { path, type }] of Object.entries(spec)) {\n let value = values[key];\n if (value !== undefined) {\n if (type) {\n switch (type) {\n case 'boolean': {\n value = boolean(value);\n break;\n }\n\n case 'number': {\n value = Number(value);\n break;\n }\n\n case 'string': {\n break;\n }\n\n case 'json': {\n value = value ? JSON.parse(value) : null;\n break;\n }\n\n default: {\n throw new Error(`Invalid type: ${type}`);\n }\n }\n }\n\n setDeep(config, path.split('.'), value);\n }\n }\n\n return config;\n};\n\n/**\n * Maps the given flattend set of (key x values) onto a JSON object.\n * @param {object} spec\n * @param {object} values\n */\nexport const mapToKeyValues = (spec: MappingSpec, values: any) => {\n const config: Record<string, any> = {};\n\n for (const [key, { path, type }] of Object.entries(spec)) {\n const value = getDeep(values, path.split('.'));\n if (value !== undefined) {\n switch (type) {\n case 'json':\n config[key] = JSON.stringify(value);\n break;\n default:\n config[key] = value;\n }\n }\n }\n\n return config;\n};\n\n/**\n * Validate config object.\n */\nexport const validateConfig = (config: ConfigProto): ConfigProto => {\n if (!('version' in config)) {\n throw new InvalidConfigError({ message: 'Version not specified' });\n }\n\n if (config?.version !== 1) {\n throw new InvalidConfigError({ message: `Invalid config version: ${config.version}` });\n }\n\n const error = configRootType.protoType.verify(config);\n if (error) {\n throw new InvalidConfigError({ message: String(error) });\n }\n\n return config;\n};\n\nexport const ConfigResource = Symbol.for('dxos.resource.Config');\n\n/**\n * Global configuration object.\n * NOTE: Config objects are immutable.\n */\n@trace.resource({ annotation: ConfigResource })\nexport class Config {\n private readonly _config: any;\n\n /**\n * Creates an immutable instance.\n * @constructor\n */\n constructor(config: ConfigProto = {}, ...objects: ConfigProto[]) {\n this._config = validateConfig(defaultsDeep(config, ...objects, { version: 1 }));\n }\n\n /**\n * Returns an immutable config JSON object.\n */\n get values(): ConfigProto {\n return this._config;\n }\n\n /**\n * Returns the given config property.\n *\n * @param key A key in the config object. Can be a nested property with keys separated by dots: 'services.signal.server'.\n * @param defaultValue Default value to return if option is not present in the config.\n * @returns The config value or undefined if the option is not present.\n */\n get<K extends ConfigKey>(\n key: K,\n defaultValue?: DeepIndex<ConfigProto, ParseKey<K>>,\n ): DeepIndex<ConfigProto, ParseKey<K>> | undefined {\n return getDeep(this._config, key.split('.')) ?? defaultValue;\n }\n\n /**\n * Get unique key.\n */\n find<T = any>(path: string, test: object): T | undefined {\n const values = getDeep(this._config, path.split('.'));\n if (!Array.isArray(values)) {\n return;\n }\n\n return values.find((value) => isMatch(value, test));\n }\n\n /**\n * Returns the given config property or throw if it doesn't exist.\n *\n * @param key A key in the config object. Can be a nested property with keys separated by dots: 'services.signal.server'.\n */\n getOrThrow<K extends ConfigKey>(key: K): Exclude<DeepIndex<ConfigProto, ParseKey<K>>, undefined> {\n const value: DeepIndex<ConfigProto, ParseKey<K>> | undefined = getDeep(this._config, key.split('.'));\n if (!value) {\n throw new Error(`Config option not present: ${key}`);\n }\n return value;\n }\n}\n"],
5
+ "mappings": ";;;AAIA,SAASA,gBAAgB;AACzB,SAASC,oBAAoB;AAC7B,SAASC,eAAe;AAExB,OAAOC,WAAW;AAClB,SAASC,aAAa;AAEtB,SAASC,iBAAiB;AAC1B,SAASC,WAAW;AACpB,SAASC,WAAAA,gBAAe;;;ACTxB,SAASC,eAAe;AACxB,OAAOC,kBAAkB;AACzB,OAAOC,aAAa;AAEpB,SAASC,0BAA0B;AACnC,SAASC,cAAc;AAEvB,SAASC,aAAa;AACtB,SAASC,SAASC,eAAe;;;;;;;AAKjC,IAAMC,iBAAiBC,OAAOC,gBAAgB,oBAAA;AAevC,IAAMC,mBAAmB,CAACC,MAAmBC,WAAAA;AAClD,QAAMC,SAAS,CAAC;AAEhB,aAAW,CAACC,KAAK,EAAEC,MAAMC,KAAI,CAAE,KAA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names": ["execSync", "readFileSync", "resolve", "pkgUp", "parse", "invariant", "log", "setDeep", "boolean", "defaultsDeep", "isMatch", "InvalidConfigError", "schema", "trace", "getDeep", "setDeep", "configRootType", "schema", "getCodecForType", "mapFromKeyValues", "spec", "values", "config", "key", "path", "type", "Object", "entries", "value", "undefined", "boolean", "Number", "JSON", "parse", "Error", "setDeep", "split", "validateConfig", "config", "InvalidConfigError", "message", "version", "error", "configRootType", "protoType", "verify", "String", "ConfigResource", "Symbol", "for", "Config", "_config", "objects", "defaultsDeep", "values", "get", "key", "defaultValue", "getDeep", "split", "find", "path", "test", "Array", "isArray", "value", "isMatch", "getOrThrow", "Error", "resource", "annotation", "CWD", "process", "cwd", "definitions", "configPath", "envPath", "devPath", "mode", "env", "NODE_ENV", "publicUrl", "KEYS_TO_FILE", "__CONFIG_DEFAULTS__", "length", "resolve", "__CONFIG_ENVS__", "__CONFIG_LOCAL__", "Object", "entries", "reduce", "prev", "key", "value", "invariant", "content", "parse", "readFileSync", "mapFromKeyValues", "forEach", "startsWith", "includes", "setDeep", "timestamp", "Date", "toISOString", "commitHash", "DX_COMMIT_HASH", "execSync", "encoding", "replace", "packagePath", "pkgUp", "sync", "packageJson", "JSON", "version", "err", "message", "log", "error", "Error", "__DXOS_CONFIG__", "dynamic"]
7
+ }
@@ -1,7 +1,7 @@
1
1
  import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
2
2
  import {
3
3
  definitions
4
- } from "./chunk-V3PJG4GW.mjs";
4
+ } from "./chunk-QQKWALKX.mjs";
5
5
 
6
6
  // src/plugin/esbuild-plugin.ts
7
7
  var ConfigPlugin = (options = {}) => {
@@ -1 +1 @@
1
- {"inputs":{"src/config.ts":{"bytes":16009,"imports":[{"path":"boolean","kind":"import-statement","external":true},{"path":"lodash.defaultsdeep","kind":"import-statement","external":true},{"path":"lodash.ismatch","kind":"import-statement","external":true},{"path":"@dxos/protocols","kind":"import-statement","external":true},{"path":"@dxos/protocols/proto","kind":"import-statement","external":true},{"path":"@dxos/tracing","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true}],"format":"esm"},"src/plugin/definitions.ts":{"bytes":12031,"imports":[{"path":"node:child_process","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"pkg-up","kind":"import-statement","external":true},{"path":"yaml","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"src/config.ts","kind":"import-statement","original":"../config"}],"format":"esm"},"src/plugin/esbuild-plugin.ts":{"bytes":2571,"imports":[{"path":"src/plugin/definitions.ts","kind":"import-statement","original":"./definitions"}],"format":"esm"},"src/plugin/rollup-plugin.ts":{"bytes":2055,"imports":[{"path":"src/plugin/definitions.ts","kind":"import-statement","original":"./definitions"}],"format":"esm"},"src/plugin/vite-plugin.ts":{"bytes":3666,"imports":[{"path":"node:path","kind":"import-statement","external":true},{"path":"src/plugin/definitions.ts","kind":"import-statement","original":"./definitions"}],"format":"esm"}},"outputs":{"dist/plugin/node-esm/esbuild-plugin.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":1347},"dist/plugin/node-esm/esbuild-plugin.mjs":{"imports":[{"path":"dist/plugin/node-esm/chunk-V3PJG4GW.mjs","kind":"import-statement"}],"exports":["ConfigPlugin"],"entryPoint":"src/plugin/esbuild-plugin.ts","inputs":{"src/plugin/esbuild-plugin.ts":{"bytesInOutput":443}},"bytes":693},"dist/plugin/node-esm/rollup-plugin.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":1103},"dist/plugin/node-esm/rollup-plugin.mjs":{"imports":[{"path":"dist/plugin/node-esm/chunk-V3PJG4GW.mjs","kind":"import-statement"}],"exports":["ConfigPlugin"],"entryPoint":"src/plugin/rollup-plugin.ts","inputs":{"src/plugin/rollup-plugin.ts":{"bytesInOutput":288}},"bytes":536},"dist/plugin/node-esm/vite-plugin.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":1838},"dist/plugin/node-esm/vite-plugin.mjs":{"imports":[{"path":"dist/plugin/node-esm/chunk-V3PJG4GW.mjs","kind":"import-statement"},{"path":"node:path","kind":"import-statement","external":true}],"exports":["ConfigPlugin"],"entryPoint":"src/plugin/vite-plugin.ts","inputs":{"src/plugin/vite-plugin.ts":{"bytesInOutput":674}},"bytes":918},"dist/plugin/node-esm/chunk-V3PJG4GW.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":13234},"dist/plugin/node-esm/chunk-V3PJG4GW.mjs":{"imports":[{"path":"node:child_process","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"pkg-up","kind":"import-statement","external":true},{"path":"yaml","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"boolean","kind":"import-statement","external":true},{"path":"lodash.defaultsdeep","kind":"import-statement","external":true},{"path":"lodash.ismatch","kind":"import-statement","external":true},{"path":"@dxos/protocols","kind":"import-statement","external":true},{"path":"@dxos/protocols/proto","kind":"import-statement","external":true},{"path":"@dxos/tracing","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true}],"exports":["definitions"],"inputs":{"src/plugin/definitions.ts":{"bytesInOutput":3209},"src/config.ts":{"bytesInOutput":3664}},"bytes":7114}}}
1
+ {"inputs":{"src/config.ts":{"bytes":15994,"imports":[{"path":"boolean","kind":"import-statement","external":true},{"path":"lodash.defaultsdeep","kind":"import-statement","external":true},{"path":"lodash.ismatch","kind":"import-statement","external":true},{"path":"@dxos/protocols","kind":"import-statement","external":true},{"path":"@dxos/protocols/proto","kind":"import-statement","external":true},{"path":"@dxos/tracing","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true}],"format":"esm"},"src/plugin/definitions.ts":{"bytes":12031,"imports":[{"path":"node:child_process","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"pkg-up","kind":"import-statement","external":true},{"path":"yaml","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"src/config.ts","kind":"import-statement","original":"../config"}],"format":"esm"},"src/plugin/esbuild-plugin.ts":{"bytes":2571,"imports":[{"path":"src/plugin/definitions.ts","kind":"import-statement","original":"./definitions"}],"format":"esm"},"src/plugin/rollup-plugin.ts":{"bytes":2055,"imports":[{"path":"src/plugin/definitions.ts","kind":"import-statement","original":"./definitions"}],"format":"esm"},"src/plugin/vite-plugin.ts":{"bytes":3666,"imports":[{"path":"node:path","kind":"import-statement","external":true},{"path":"src/plugin/definitions.ts","kind":"import-statement","original":"./definitions"}],"format":"esm"}},"outputs":{"dist/plugin/node-esm/esbuild-plugin.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":1347},"dist/plugin/node-esm/esbuild-plugin.mjs":{"imports":[{"path":"dist/plugin/node-esm/chunk-QQKWALKX.mjs","kind":"import-statement"}],"exports":["ConfigPlugin"],"entryPoint":"src/plugin/esbuild-plugin.ts","inputs":{"src/plugin/esbuild-plugin.ts":{"bytesInOutput":443}},"bytes":693},"dist/plugin/node-esm/rollup-plugin.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":1103},"dist/plugin/node-esm/rollup-plugin.mjs":{"imports":[{"path":"dist/plugin/node-esm/chunk-QQKWALKX.mjs","kind":"import-statement"}],"exports":["ConfigPlugin"],"entryPoint":"src/plugin/rollup-plugin.ts","inputs":{"src/plugin/rollup-plugin.ts":{"bytesInOutput":288}},"bytes":536},"dist/plugin/node-esm/vite-plugin.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":1838},"dist/plugin/node-esm/vite-plugin.mjs":{"imports":[{"path":"dist/plugin/node-esm/chunk-QQKWALKX.mjs","kind":"import-statement"},{"path":"node:path","kind":"import-statement","external":true}],"exports":["ConfigPlugin"],"entryPoint":"src/plugin/vite-plugin.ts","inputs":{"src/plugin/vite-plugin.ts":{"bytesInOutput":674}},"bytes":918},"dist/plugin/node-esm/chunk-QQKWALKX.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":13227},"dist/plugin/node-esm/chunk-QQKWALKX.mjs":{"imports":[{"path":"node:child_process","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"pkg-up","kind":"import-statement","external":true},{"path":"yaml","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"boolean","kind":"import-statement","external":true},{"path":"lodash.defaultsdeep","kind":"import-statement","external":true},{"path":"lodash.ismatch","kind":"import-statement","external":true},{"path":"@dxos/protocols","kind":"import-statement","external":true},{"path":"@dxos/protocols/proto","kind":"import-statement","external":true},{"path":"@dxos/tracing","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true}],"exports":["definitions"],"inputs":{"src/plugin/definitions.ts":{"bytesInOutput":3209},"src/config.ts":{"bytesInOutput":3664}},"bytes":7114}}}
@@ -1,7 +1,7 @@
1
1
  import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
2
2
  import {
3
3
  definitions
4
- } from "./chunk-V3PJG4GW.mjs";
4
+ } from "./chunk-QQKWALKX.mjs";
5
5
 
6
6
  // src/plugin/rollup-plugin.ts
7
7
  var ConfigPlugin = (options = {}) => {
@@ -1,7 +1,7 @@
1
1
  import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
2
2
  import {
3
3
  definitions
4
- } from "./chunk-V3PJG4GW.mjs";
4
+ } from "./chunk-QQKWALKX.mjs";
5
5
 
6
6
  // src/plugin/vite-plugin.ts
7
7
  import { resolve } from "node:path";