@vizhub/runtime 0.0.1 → 0.0.3

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 (120) hide show
  1. package/dist/assets/setupV3Runtime-BVr5lyKp.js +240 -0
  2. package/dist/computeSrcDoc.d.ts +13 -0
  3. package/dist/computeSrcDoc.d.ts.map +1 -0
  4. package/{src/index.ts → dist/index.d.ts} +1 -0
  5. package/dist/index.d.ts.map +1 -0
  6. package/{src/v2Runtime/bundle/rollup.browser.js → dist/index.js} +9286 -12810
  7. package/dist/useRuntime.d.ts +13 -0
  8. package/dist/useRuntime.d.ts.map +1 -0
  9. package/dist/v2Runtime/bundle/bubleJSXOnly.d.ts +5 -0
  10. package/dist/v2Runtime/bundle/bubleJSXOnly.d.ts.map +1 -0
  11. package/dist/v2Runtime/bundle/packageJson.d.ts +10 -0
  12. package/dist/v2Runtime/bundle/packageJson.d.ts.map +1 -0
  13. package/dist/v2Runtime/computeSrcDocV2.d.ts +3 -0
  14. package/dist/v2Runtime/computeSrcDocV2.d.ts.map +1 -0
  15. package/dist/v2Runtime/computeSrcDocV2.test.d.ts +2 -0
  16. package/dist/v2Runtime/computeSrcDocV2.test.d.ts.map +1 -0
  17. package/dist/v2Runtime/getComputedIndexHtml.d.ts +4 -0
  18. package/dist/v2Runtime/getComputedIndexHtml.d.ts.map +1 -0
  19. package/dist/v2Runtime/getComputedIndexHtml.test.d.ts +2 -0
  20. package/dist/v2Runtime/getComputedIndexHtml.test.d.ts.map +1 -0
  21. package/dist/v2Runtime/getText.d.ts +3 -0
  22. package/dist/v2Runtime/getText.d.ts.map +1 -0
  23. package/dist/v2Runtime/transformFiles.d.ts +3 -0
  24. package/dist/v2Runtime/transformFiles.d.ts.map +1 -0
  25. package/dist/v2Runtime/v3FilesToV2Files.d.ts +3 -0
  26. package/dist/v2Runtime/v3FilesToV2Files.d.ts.map +1 -0
  27. package/dist/v2Runtime/v3FilesToV2Files.test.d.ts +2 -0
  28. package/dist/v2Runtime/v3FilesToV2Files.test.d.ts.map +1 -0
  29. package/dist/v3Runtime/build.d.ts +14 -0
  30. package/dist/v3Runtime/build.d.ts.map +1 -0
  31. package/dist/v3Runtime/build.test.d.ts +2 -0
  32. package/dist/v3Runtime/build.test.d.ts.map +1 -0
  33. package/dist/v3Runtime/cleanRollupErrorMessage.d.ts +5 -0
  34. package/dist/v3Runtime/cleanRollupErrorMessage.d.ts.map +1 -0
  35. package/dist/v3Runtime/computeSrcDocV3.d.ts +7 -0
  36. package/dist/v3Runtime/computeSrcDocV3.d.ts.map +1 -0
  37. package/dist/v3Runtime/extractVizImport.d.ts +7 -0
  38. package/dist/v3Runtime/extractVizImport.d.ts.map +1 -0
  39. package/dist/v3Runtime/extractVizImport.test.d.ts +2 -0
  40. package/dist/v3Runtime/extractVizImport.test.d.ts.map +1 -0
  41. package/dist/v3Runtime/generateRollupErrorMessage.d.ts +5 -0
  42. package/dist/v3Runtime/generateRollupErrorMessage.d.ts.map +1 -0
  43. package/dist/v3Runtime/importFromViz.d.ts +1 -0
  44. package/dist/v3Runtime/importFromViz.d.ts.map +1 -0
  45. package/{src/v3Runtime/index.ts → dist/v3Runtime/index.d.ts} +1 -0
  46. package/dist/v3Runtime/index.d.ts.map +1 -0
  47. package/dist/v3Runtime/parseId.d.ts +7 -0
  48. package/dist/v3Runtime/parseId.d.ts.map +1 -0
  49. package/dist/v3Runtime/setupV3Runtime.d.ts +15 -0
  50. package/dist/v3Runtime/setupV3Runtime.d.ts.map +1 -0
  51. package/dist/v3Runtime/transformDSV/index.d.ts +3 -0
  52. package/dist/v3Runtime/transformDSV/index.d.ts.map +1 -0
  53. package/dist/v3Runtime/transformSvelte.d.ts +6 -0
  54. package/dist/v3Runtime/transformSvelte.d.ts.map +1 -0
  55. package/dist/v3Runtime/types.d.ts +65 -0
  56. package/dist/v3Runtime/types.d.ts.map +1 -0
  57. package/dist/v3Runtime/urlLoad.d.ts +1 -0
  58. package/dist/v3Runtime/urlLoad.d.ts.map +1 -0
  59. package/dist/v3Runtime/virtual.d.ts +1 -0
  60. package/dist/v3Runtime/virtual.d.ts.map +1 -0
  61. package/dist/v3Runtime/vizCache.d.ts +11 -0
  62. package/dist/v3Runtime/vizCache.d.ts.map +1 -0
  63. package/dist/v3Runtime/vizCache.test.d.ts +2 -0
  64. package/dist/v3Runtime/vizCache.test.d.ts.map +1 -0
  65. package/dist/v3Runtime/vizLoad.d.ts +8 -0
  66. package/dist/v3Runtime/vizLoad.d.ts.map +1 -0
  67. package/dist/v3Runtime/vizLoadSvelte.d.ts +1 -0
  68. package/dist/v3Runtime/vizLoadSvelte.d.ts.map +1 -0
  69. package/dist/v3Runtime/vizResolve.d.ts +10 -0
  70. package/dist/v3Runtime/vizResolve.d.ts.map +1 -0
  71. package/dist/v3Runtime/worker.d.ts +2 -0
  72. package/dist/v3Runtime/worker.d.ts.map +1 -0
  73. package/package.json +13 -6
  74. package/src/computeSrcDoc.ts +0 -68
  75. package/src/useRuntime.ts +0 -394
  76. package/src/v2Runtime/bundle/bubleJSXOnly.ts +0 -34
  77. package/src/v2Runtime/bundle/getLibraries.js +0 -31
  78. package/src/v2Runtime/bundle/hypothetical.js +0 -232
  79. package/src/v2Runtime/bundle/index.js +0 -88
  80. package/src/v2Runtime/bundle/packageJson.ts +0 -49
  81. package/src/v2Runtime/bundle.test.js +0 -151
  82. package/src/v2Runtime/computeSrcDocV2.test.ts +0 -163
  83. package/src/v2Runtime/computeSrcDocV2.ts +0 -34
  84. package/src/v2Runtime/getComputedIndexHtml.test.ts +0 -33
  85. package/src/v2Runtime/getComputedIndexHtml.ts +0 -106
  86. package/src/v2Runtime/getText.ts +0 -19
  87. package/src/v2Runtime/magicSandbox.js +0 -291
  88. package/src/v2Runtime/packageJson.js +0 -42
  89. package/src/v2Runtime/transformFiles.test.js +0 -18
  90. package/src/v2Runtime/transformFiles.ts +0 -15
  91. package/src/v2Runtime/v3FilesToV2Files.test.ts +0 -20
  92. package/src/v2Runtime/v3FilesToV2Files.ts +0 -14
  93. package/src/v3Runtime/build.test.ts +0 -474
  94. package/src/v3Runtime/build.ts +0 -270
  95. package/src/v3Runtime/cleanRollupErrorMessage.ts +0 -15
  96. package/src/v3Runtime/computeSrcDocV3.ts +0 -151
  97. package/src/v3Runtime/extractVizImport.test.ts +0 -41
  98. package/src/v3Runtime/extractVizImport.ts +0 -34
  99. package/src/v3Runtime/generateRollupErrorMessage.ts +0 -84
  100. package/src/v3Runtime/importFromViz.ts +0 -36
  101. package/src/v3Runtime/parseId.ts +0 -14
  102. package/src/v3Runtime/setupV3Runtime.ts +0 -478
  103. package/src/v3Runtime/transformDSV/d3-dsv-custom-build/bundle-modified-src.js +0 -121
  104. package/src/v3Runtime/transformDSV/d3-dsv-custom-build/bundle-modified.js +0 -121
  105. package/src/v3Runtime/transformDSV/d3-dsv-custom-build/bundle.js +0 -239
  106. package/src/v3Runtime/transformDSV/d3-dsv-custom-build/index.js +0 -1
  107. package/src/v3Runtime/transformDSV/d3-dsv-custom-build/package-lock.json +0 -475
  108. package/src/v3Runtime/transformDSV/d3-dsv-custom-build/package.json +0 -19
  109. package/src/v3Runtime/transformDSV/d3-dsv-custom-build/rollup.config.js +0 -9
  110. package/src/v3Runtime/transformDSV/index.ts +0 -71
  111. package/src/v3Runtime/transformSvelte.ts +0 -111
  112. package/src/v3Runtime/types.ts +0 -158
  113. package/src/v3Runtime/urlLoad.ts +0 -33
  114. package/src/v3Runtime/virtual.ts +0 -27
  115. package/src/v3Runtime/vizCache.test.ts +0 -126
  116. package/src/v3Runtime/vizCache.ts +0 -60
  117. package/src/v3Runtime/vizLoad.ts +0 -68
  118. package/src/v3Runtime/vizLoadSvelte.ts +0 -46
  119. package/src/v3Runtime/vizResolve.ts +0 -100
  120. package/src/v3Runtime/worker.ts +0 -231
@@ -0,0 +1,13 @@
1
+ import { RefObject } from 'react';
2
+ import { Content, SlugKey, VizId } from 'entities';
3
+ export declare const useRuntime: ({ content, iframeRef, srcdocErrorMessage, setSrcdocErrorMessage, vizCacheContents, isVisual, slugResolutionCache, submitContentOperation, }: {
4
+ content: Content;
5
+ iframeRef: RefObject<HTMLIFrameElement>;
6
+ srcdocErrorMessage: string | null;
7
+ setSrcdocErrorMessage: (error: string | null) => void;
8
+ vizCacheContents: Record<string, Content>;
9
+ isVisual: boolean;
10
+ slugResolutionCache: Record<SlugKey, VizId>;
11
+ submitContentOperation: (next: (content: Content) => Content) => void;
12
+ }) => void;
13
+ //# sourceMappingURL=useRuntime.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useRuntime.d.ts","sourceRoot":"","sources":["../src/useRuntime.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EAKV,MAAM,OAAO,CAAC;AACf,OAAO,EACL,OAAO,EAEP,OAAO,EACP,KAAK,EAGN,MAAM,UAAU,CAAC;AAOlB,eAAO,MAAM,UAAU,gJASpB;IACD,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,SAAS,CAAC,iBAAiB,CAAC,CAAC;IACxC,kBAAkB,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,qBAAqB,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;IACtD,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAG1C,QAAQ,EAAE,OAAO,CAAC;IAClB,mBAAmB,EAAE,MAAM,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IAC5C,sBAAsB,EAAE,CACtB,IAAI,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,OAAO,KAChC,IAAI,CAAC;CACX,SA8VA,CAAC"}
@@ -0,0 +1,5 @@
1
+ export default function buble(options: any): {
2
+ name: string;
3
+ transform: (code: any, id: any) => any;
4
+ };
5
+ //# sourceMappingURL=bubleJSXOnly.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bubleJSXOnly.d.ts","sourceRoot":"","sources":["../../../src/v2Runtime/bundle/bubleJSXOnly.ts"],"names":[],"mappings":"AAMA,MAAM,CAAC,OAAO,UAAU,KAAK,CAAC,OAAO,KAAA;;;EA2BpC"}
@@ -0,0 +1,10 @@
1
+ import { FilesV2 } from 'entities';
2
+ export declare const packageJSON: (files: FilesV2) => any;
3
+ export declare const dependencies: (files: FilesV2) => any;
4
+ export declare const getConfiguredLibraries: (files: FilesV2) => any;
5
+ export declare const dependencySource: ({ name, version }: {
6
+ name: any;
7
+ version: any;
8
+ }, libraries: any) => string;
9
+ export declare const getLicense: (files: any) => any;
10
+ //# sourceMappingURL=packageJson.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"packageJson.d.ts","sourceRoot":"","sources":["../../../src/v2Runtime/bundle/packageJson.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAQnC,eAAO,MAAM,WAAW,UAAW,OAAO,QAkBzC,CAAC;AAEF,eAAO,MAAM,YAAY,UAAW,OAAO,QACJ,CAAC;AAExC,eAAO,MAAM,sBAAsB,UAAW,OAAO,QAGpD,CAAC;AAEF,eAAO,MAAM,gBAAgB;;;4BAS5B,CAAC;AAEF,eAAO,MAAM,UAAU,qBAC+B,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Content } from 'entities';
2
+ export declare const computeSrcDocV2: (content: Content) => Promise<any>;
3
+ //# sourceMappingURL=computeSrcDocV2.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"computeSrcDocV2.d.ts","sourceRoot":"","sources":["../../src/v2Runtime/computeSrcDocV2.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAwB,MAAM,UAAU,CAAC;AASzD,eAAO,MAAM,eAAe,YAAmB,OAAO,iBAwBrD,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=computeSrcDocV2.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"computeSrcDocV2.test.d.ts","sourceRoot":"","sources":["../../src/v2Runtime/computeSrcDocV2.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,4 @@
1
+ import { FilesV2 } from 'entities';
2
+ export declare const setJSDOM: (JSDOM: any) => void;
3
+ export declare const getComputedIndexHtml: (files: FilesV2) => any;
4
+ //# sourceMappingURL=getComputedIndexHtml.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getComputedIndexHtml.d.ts","sourceRoot":"","sources":["../../src/v2Runtime/getComputedIndexHtml.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAcnC,eAAO,MAAM,QAAQ,sBAEpB,CAAC;AAwDF,eAAO,MAAM,oBAAoB,UAAW,OAAO,QA0BlD,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=getComputedIndexHtml.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getComputedIndexHtml.test.d.ts","sourceRoot":"","sources":["../../src/v2Runtime/getComputedIndexHtml.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ import { FilesV2 } from 'entities';
2
+ export declare const getText: (files: FilesV2, name: string) => string;
3
+ //# sourceMappingURL=getText.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getText.d.ts","sourceRoot":"","sources":["../../src/v2Runtime/getText.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAenC,eAAO,MAAM,OAAO,UAAW,OAAO,QAAQ,MAAM,WAGnD,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { FilesV2 } from 'entities';
2
+ export declare const transformFiles: (files: FilesV2) => {};
3
+ //# sourceMappingURL=transformFiles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transformFiles.d.ts","sourceRoot":"","sources":["../../src/v2Runtime/transformFiles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,OAAO,EAAE,MAAM,UAAU,CAAC;AAG3C,eAAO,MAAM,cAAc,UAAW,OAAO,OAWnC,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Files, FilesV2 } from 'entities';
2
+ export declare const v3FilesToV2Files: (files: Files) => FilesV2;
3
+ //# sourceMappingURL=v3FilesToV2Files.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"v3FilesToV2Files.d.ts","sourceRoot":"","sources":["../../src/v2Runtime/v3FilesToV2Files.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAG1C,eAAO,MAAM,gBAAgB,UAAW,KAAK,KAAG,OAU/C,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=v3FilesToV2Files.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"v3FilesToV2Files.test.d.ts","sourceRoot":"","sources":["../../src/v2Runtime/v3FilesToV2Files.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,14 @@
1
+ import { RollupOptions, RollupBuild } from 'rollup';
2
+ import { V3BuildResult } from './types';
3
+ import { VizId } from 'entities';
4
+ import { VizCache } from './vizCache';
5
+ export declare const build: ({ vizId, enableSourcemap, enableCache, rollup, vizCache, resolveSlug, getSvelteCompiler, }: {
6
+ vizId: VizId;
7
+ enableSourcemap?: boolean;
8
+ enableCache?: boolean;
9
+ rollup: (options: RollupOptions) => Promise<RollupBuild>;
10
+ vizCache: VizCache;
11
+ resolveSlug?: ({ userName, slug }: any) => Promise<VizId>;
12
+ getSvelteCompiler?: () => Promise<any>;
13
+ }) => Promise<V3BuildResult>;
14
+ //# sourceMappingURL=build.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../src/v3Runtime/build.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,aAAa,EAGb,WAAW,EACZ,MAAM,QAAQ,CAAC;AAChB,OAAO,EAAgB,aAAa,EAAE,MAAM,SAAS,CAAC;AACtD,OAAO,EAGL,KAAK,EAEN,MAAM,UAAU,CAAC;AAElB,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AA2DtC,eAAO,MAAM,KAAK,+FAQf;IAED,KAAK,EAAE,KAAK,CAAC;IACb,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,MAAM,EAAE,CAAC,OAAO,EAAE,aAAa,KAAK,OAAO,CAAC,WAAW,CAAC,CAAC;IAGzD,QAAQ,EAAE,QAAQ,CAAC;IAGnB,WAAW,CAAC,EAAE,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAA,KAAK,OAAO,CAAC,KAAK,CAAC,CAAC;IAMrD,iBAAiB,CAAC,EAAE,MAAM,OAAO,CAAC,GAAG,CAAC,CAAC;CACxC,KAAG,OAAO,CAAC,aAAa,CAyKxB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=build.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build.test.d.ts","sourceRoot":"","sources":["../../src/v3Runtime/build.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,5 @@
1
+ export declare const cleanRollupErrorMessage: ({ rawMessage, vizId, }: {
2
+ rawMessage: string;
3
+ vizId: string;
4
+ }) => string;
5
+ //# sourceMappingURL=cleanRollupErrorMessage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cleanRollupErrorMessage.d.ts","sourceRoot":"","sources":["../../src/v3Runtime/cleanRollupErrorMessage.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,uBAAuB,2BAGjC;IACD,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;CACf,WAGA,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { V3BuildResult } from './types';
2
+ import { VizCache } from './vizCache';
3
+ export declare const computeSrcDocV3: ({ vizCache, buildResult, }: {
4
+ vizCache: VizCache;
5
+ buildResult: V3BuildResult;
6
+ }) => Promise<string>;
7
+ //# sourceMappingURL=computeSrcDocV3.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"computeSrcDocV3.d.ts","sourceRoot":"","sources":["../../src/v3Runtime/computeSrcDocV3.ts"],"names":[],"mappings":"AACA,OAAO,EAAqB,aAAa,EAAE,MAAM,SAAS,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAUtC,eAAO,MAAM,eAAe,+BAGzB;IACD,QAAQ,EAAE,QAAQ,CAAC;IACnB,WAAW,EAAE,aAAa,CAAC;CAC5B,oBAoIA,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { UserName, VizId } from 'entities';
2
+ export type VizImport = {
3
+ userName: UserName;
4
+ idOrSlug: VizId | string;
5
+ };
6
+ export declare const extractVizImport: (str: string) => VizImport | null;
7
+ //# sourceMappingURL=extractVizImport.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extractVizImport.d.ts","sourceRoot":"","sources":["../../src/v3Runtime/extractVizImport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAE3C,MAAM,MAAM,SAAS,GAAG;IACtB,QAAQ,EAAE,QAAQ,CAAC;IACnB,QAAQ,EAAE,KAAK,GAAG,MAAM,CAAC;CAC1B,CAAC;AAEF,eAAO,MAAM,gBAAgB,QACtB,MAAM,KACV,SAAS,GAAG,IAiBd,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=extractVizImport.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extractVizImport.test.d.ts","sourceRoot":"","sources":["../../src/v3Runtime/extractVizImport.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,5 @@
1
+ import { RollupError } from 'rollup';
2
+ import { ResolvedVizFileId } from './types';
3
+ export default function relativeId(id: ResolvedVizFileId): string;
4
+ export declare const generateRollupErrorMessage: (error: RollupError) => string;
5
+ //# sourceMappingURL=generateRollupErrorMessage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generateRollupErrorMessage.d.ts","sourceRoot":"","sources":["../../src/v3Runtime/generateRollupErrorMessage.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AACrC,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAI5C,MAAM,CAAC,OAAO,UAAU,UAAU,CAChC,EAAE,EAAE,iBAAiB,GACpB,MAAM,CAKR;AAED,eAAO,MAAM,0BAA0B,UAC9B,WAAW,WAiEnB,CAAC"}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=importFromViz.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"importFromViz.d.ts","sourceRoot":"","sources":["../../src/v3Runtime/importFromViz.ts"],"names":[],"mappings":""}
@@ -1 +1,2 @@
1
1
  export type { V3BuildResult } from './types';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/v3Runtime/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { VizId } from 'entities';
2
+ import { ResolvedVizFileId } from './types';
3
+ export declare const parseId: (id: ResolvedVizFileId) => {
4
+ vizId: VizId;
5
+ fileName: string;
6
+ };
7
+ //# sourceMappingURL=parseId.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parseId.d.ts","sourceRoot":"","sources":["../../src/v3Runtime/parseId.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACjC,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAE5C,eAAO,MAAM,OAAO,OACd,iBAAiB,KACpB;IACD,KAAK,EAAE,KAAK,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;CAMlB,CAAC"}
@@ -0,0 +1,15 @@
1
+ import { Content, VizId } from 'entities';
2
+ export type V3Runtime = {
3
+ handleCodeChange: (content: Content) => void;
4
+ invalidateVizCache: (changedVizIds: Array<VizId>) => void;
5
+ resetSrcdoc: (changedVizIds: Array<VizId>) => void;
6
+ };
7
+ export declare const setupV3Runtime: ({ vizId, iframe, setSrcdocErrorMessage, getLatestContent, resolveSlugKey, writeFile, }: {
8
+ vizId: VizId;
9
+ iframe: HTMLIFrameElement;
10
+ setSrcdocErrorMessage: (error: string | null) => void;
11
+ getLatestContent: (vizId: VizId) => Promise<Content>;
12
+ resolveSlugKey: (slugKey: string) => Promise<VizId>;
13
+ writeFile: (fileName: string, content: string) => void;
14
+ }) => V3Runtime;
15
+ //# sourceMappingURL=setupV3Runtime.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"setupV3Runtime.d.ts","sourceRoot":"","sources":["../../src/v3Runtime/setupV3Runtime.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAe,MAAM,UAAU,CAAC;AAuBvD,MAAM,MAAM,SAAS,GAAG;IAEtB,gBAAgB,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IAG7C,kBAAkB,EAAE,CAAC,aAAa,EAAE,KAAK,CAAC,KAAK,CAAC,KAAK,IAAI,CAAC;IAI1D,WAAW,EAAE,CAAC,aAAa,EAAE,KAAK,CAAC,KAAK,CAAC,KAAK,IAAI,CAAC;CACpD,CAAC;AAEF,eAAO,MAAM,cAAc,2FAOxB;IACD,KAAK,EAAE,KAAK,CAAC;IACb,MAAM,EAAE,iBAAiB,CAAC;IAC1B,qBAAqB,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;IACtD,gBAAgB,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IACrD,cAAc,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,KAAK,CAAC,CAAC;IACpD,SAAS,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;CACxD,KAAG,SAmaH,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { InputPluginOption } from 'rollup';
2
+ export declare const transformDSV: () => InputPluginOption;
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/v3Runtime/transformDSV/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,QAAQ,CAAC;AAkB3C,eAAO,MAAM,YAAY,QAAO,iBAoD9B,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { InputPluginOption } from 'rollup';
2
+ export declare const svelteCompilerUrl = "https://cdn.jsdelivr.net/npm/svelte@4.2.9/compiler.cjs";
3
+ export declare const transformSvelte: ({ getSvelteCompiler, }: {
4
+ getSvelteCompiler?: () => Promise<any>;
5
+ }) => InputPluginOption;
6
+ //# sourceMappingURL=transformSvelte.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transformSvelte.d.ts","sourceRoot":"","sources":["../../src/v3Runtime/transformSvelte.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,QAAQ,CAAC;AAe3C,eAAO,MAAM,iBAAiB,2DAA8B,CAAC;AAO7D,eAAO,MAAM,eAAe,2BAEzB;IACD,iBAAiB,CAAC,EAAE,MAAM,OAAO,CAAC,GAAG,CAAC,CAAC;CACxC,KAAG,iBAoFF,CAAC"}
@@ -0,0 +1,65 @@
1
+ import { Content, V3PackageJson, VizId } from 'entities';
2
+ export type V3BuildResult = {
3
+ src: string | undefined;
4
+ pkg: V3PackageJson | undefined;
5
+ warnings: Array<V3BuildError>;
6
+ time: number;
7
+ cssFiles: Array<ResolvedVizFileId>;
8
+ };
9
+ export type V3BuildError = {
10
+ code: string;
11
+ message: string;
12
+ };
13
+ export type ResolvedVizFileId = string;
14
+ export type V3WorkerMessage = {
15
+ type: 'contentRequest';
16
+ vizId: VizId;
17
+ } | {
18
+ type: 'contentResponse';
19
+ vizId: VizId;
20
+ content: Content;
21
+ } | {
22
+ type: 'buildRequest';
23
+ vizId: VizId;
24
+ enableSourcemap: boolean;
25
+ } | {
26
+ type: 'buildResponse';
27
+ buildResult?: V3BuildResult;
28
+ error?: Error;
29
+ } | {
30
+ type: 'invalidateVizCacheRequest';
31
+ changedVizIds: Array<VizId>;
32
+ } | {
33
+ type: 'invalidateVizCacheResponse';
34
+ } | {
35
+ type: 'resolveSlugRequest';
36
+ slugKey: string;
37
+ requestId: string;
38
+ } | {
39
+ type: 'resolveSlugResponse';
40
+ slugKey: string;
41
+ vizId: VizId;
42
+ requestId: string;
43
+ } | {
44
+ type: 'resetSrcdocRequest';
45
+ vizId: VizId;
46
+ changedVizIds: Array<VizId>;
47
+ } | {
48
+ type: 'resetSrcdocResponse';
49
+ srcdoc?: string;
50
+ error?: Error;
51
+ };
52
+ export type V3WindowMessage = {
53
+ type: 'runJS';
54
+ src: string;
55
+ } | {
56
+ type: 'runCSS';
57
+ src: string;
58
+ id: ResolvedVizFileId;
59
+ } | {
60
+ type: 'runDone';
61
+ } | {
62
+ type: 'runError';
63
+ error: Error;
64
+ };
65
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/v3Runtime/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAGzD,MAAM,MAAM,aAAa,GAAG;IAE1B,GAAG,EAAE,MAAM,GAAG,SAAS,CAAC;IACxB,GAAG,EAAE,aAAa,GAAG,SAAS,CAAC;IAC/B,QAAQ,EAAE,KAAK,CAAC,YAAY,CAAC,CAAC;IAC9B,IAAI,EAAE,MAAM,CAAC;IAKb,QAAQ,EAAE,KAAK,CAAC,iBAAiB,CAAC,CAAC;CACpC,CAAC;AAGF,MAAM,MAAM,YAAY,GAAG;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAIF,MAAM,MAAM,iBAAiB,GAAG,MAAM,CAAC;AAGvC,MAAM,MAAM,eAAe,GAMvB;IAAE,IAAI,EAAE,gBAAgB,CAAC;IAAC,KAAK,EAAE,KAAK,CAAA;CAAE,GAKxC;IACE,IAAI,EAAE,iBAAiB,CAAC;IACxB,KAAK,EAAE,KAAK,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;CAClB,GAKD;IACE,IAAI,EAAE,cAAc,CAAC;IACrB,KAAK,EAAE,KAAK,CAAC;IACb,eAAe,EAAE,OAAO,CAAC;CAC1B,GASD;IACE,IAAI,EAAE,eAAe,CAAC;IACtB,WAAW,CAAC,EAAE,aAAa,CAAC;IAC5B,KAAK,CAAC,EAAE,KAAK,CAAC;CACf,GAMD;IACE,IAAI,EAAE,2BAA2B,CAAC;IAClC,aAAa,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;CAC7B,GAKD;IACE,IAAI,EAAE,4BAA4B,CAAC;CACpC,GAKD;IACE,IAAI,EAAE,oBAAoB,CAAC;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;CACnB,GAKD;IACE,IAAI,EAAE,qBAAqB,CAAC;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,KAAK,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;CACnB,GAMD;IACE,IAAI,EAAE,oBAAoB,CAAC;IAC3B,KAAK,EAAE,KAAK,CAAC;IACb,aAAa,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;CAC7B,GAQD;IACE,IAAI,EAAE,qBAAqB,CAAC;IAC5B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,KAAK,CAAC;CACf,CAAC;AAGN,MAAM,MAAM,eAAe,GAIvB;IACE,IAAI,EAAE,OAAO,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;CACb,GAKD;IACE,IAAI,EAAE,QAAQ,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;IACZ,EAAE,EAAE,iBAAiB,CAAC;CACvB,GAMD;IACE,IAAI,EAAE,SAAS,CAAC;CACjB,GAMD;IACE,IAAI,EAAE,UAAU,CAAC;IACjB,KAAK,EAAE,KAAK,CAAC;CACd,CAAC"}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=urlLoad.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"urlLoad.d.ts","sourceRoot":"","sources":["../../src/v3Runtime/urlLoad.ts"],"names":[],"mappings":""}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=virtual.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"virtual.d.ts","sourceRoot":"","sources":["../../src/v3Runtime/virtual.ts"],"names":[],"mappings":""}
@@ -0,0 +1,11 @@
1
+ import { Content, VizId } from 'entities';
2
+ export type VizCache = {
3
+ get: (vizId: string) => Promise<Content>;
4
+ set: (content: Content) => void;
5
+ invalidate: (vizId: string) => void;
6
+ };
7
+ export declare const createVizCache: ({ initialContents, handleCacheMiss, }: {
8
+ initialContents: Array<Content>;
9
+ handleCacheMiss: (vizId: VizId) => Promise<Content>;
10
+ }) => VizCache;
11
+ //# sourceMappingURL=vizCache.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vizCache.d.ts","sourceRoot":"","sources":["../../src/v3Runtime/vizCache.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAE1C,MAAM,MAAM,QAAQ,GAAG;IACrB,GAAG,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IACzC,GAAG,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IAChC,UAAU,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACrC,CAAC;AAKF,eAAO,MAAM,cAAc,0CAGxB;IACD,eAAe,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;IAChC,eAAe,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;CACrD,KAAG,QA0CH,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=vizCache.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vizCache.test.d.ts","sourceRoot":"","sources":["../../src/v3Runtime/vizCache.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,8 @@
1
+ import { InputPluginOption } from 'rollup';
2
+ import { ResolvedVizFileId } from './types';
3
+ import { VizCache } from './vizCache';
4
+ export declare const vizLoad: ({ vizCache, trackCSSImport, }: {
5
+ vizCache: VizCache;
6
+ trackCSSImport: (cssFile: ResolvedVizFileId) => void;
7
+ }) => InputPluginOption;
8
+ //# sourceMappingURL=vizLoad.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vizLoad.d.ts","sourceRoot":"","sources":["../../src/v3Runtime/vizLoad.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,QAAQ,CAAC;AAC3C,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAG5C,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAOtC,eAAO,MAAM,OAAO,kCAGjB;IACD,QAAQ,EAAE,QAAQ,CAAC;IACnB,cAAc,EAAE,CAAC,OAAO,EAAE,iBAAiB,KAAK,IAAI,CAAC;CACtD,KAAG,iBAkDF,CAAC"}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=vizLoadSvelte.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vizLoadSvelte.d.ts","sourceRoot":"","sources":["../../src/v3Runtime/vizLoadSvelte.ts"],"names":[],"mappings":""}
@@ -0,0 +1,10 @@
1
+ import { InputPluginOption } from 'rollup';
2
+ import { VizId } from 'entities';
3
+ export declare const vizResolve: ({ vizId, resolveSlug, }: {
4
+ vizId: VizId;
5
+ resolveSlug?: ({ userName, slug, }: {
6
+ userName: string;
7
+ slug: string;
8
+ }) => Promise<VizId>;
9
+ }) => InputPluginOption;
10
+ //# sourceMappingURL=vizResolve.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vizResolve.d.ts","sourceRoot":"","sources":["../../src/v3Runtime/vizResolve.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,iBAAiB,EAAE,MAAM,QAAQ,CAAC;AAE3C,OAAO,EAAE,KAAK,EAAQ,MAAM,UAAU,CAAC;AAMvC,eAAO,MAAM,UAAU,4BAGpB;IACD,KAAK,EAAE,KAAK,CAAC;IACb,WAAW,CAAC,EAAE,CAAC,EACb,QAAQ,EACR,IAAI,GACL,EAAE;QACD,QAAQ,EAAE,MAAM,CAAC;QACjB,IAAI,EAAE,MAAM,CAAC;KACd,KAAK,OAAO,CAAC,KAAK,CAAC,CAAC;CACtB,KAAG,iBA0EF,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=worker.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"worker.d.ts","sourceRoot":"","sources":["../../src/v3Runtime/worker.ts"],"names":[],"mappings":""}
package/package.json CHANGED
@@ -1,12 +1,15 @@
1
1
  {
2
2
  "name": "@vizhub/runtime",
3
- "version": "0.0.1",
3
+ "version": "0.0.3",
4
4
  "type": "module",
5
- "main": "src/index",
5
+ "main": "dist/index",
6
+ "types": "dist/index.d.ts",
6
7
  "scripts": {
7
8
  "tsc": "tsc --noEmit",
8
9
  "test": "vitest run --reporter verbose",
9
- "prettier": "prettier {*.*,**/*.*} --single-quote --write"
10
+ "build": "vite build --ssr src/index.ts --outDir dist && tsc --emitDeclarationOnly",
11
+ "prettier": "prettier {*.*,**/*.*} --single-quote --write",
12
+ "prepublishOnly": "npm run build"
10
13
  },
11
14
  "repository": {
12
15
  "type": "git",
@@ -25,13 +28,17 @@
25
28
  "svelte": "^4.2.19"
26
29
  },
27
30
  "devDependencies": {
31
+ "@rollup/plugin-node-resolve": "^15.3.0",
32
+ "@rollup/plugin-typescript": "^12.1.1",
28
33
  "@types/d3-dsv": "^3.0.7",
29
- "i": "^0.3.7",
30
- "npm": "^10.9.0",
31
34
  "typescript": "^5.6.3",
35
+ "vite": "^5.4.10",
32
36
  "vitest": "^2.1.2"
33
37
  },
34
38
  "publishConfig": {
35
39
  "access": "public"
36
- }
40
+ },
41
+ "files": [
42
+ "dist"
43
+ ]
37
44
  }
@@ -1,68 +0,0 @@
1
- // import { rollup } from 'rollup';
2
- import {
3
- Content,
4
- VizId,
5
- getRuntimeVersion,
6
- } from 'entities';
7
- import { computeSrcDocV2 } from './v2Runtime/computeSrcDocV2';
8
- import { computeSrcDocV3 } from './v3Runtime/computeSrcDocV3';
9
- import { build } from './v3Runtime/build';
10
- import { VizCache } from './v3Runtime/vizCache';
11
-
12
- const debug = false;
13
- export const computeSrcDoc = async ({
14
- rollup,
15
- content,
16
- vizCache,
17
- resolveSlug,
18
- getSvelteCompiler,
19
- }: {
20
- rollup: any;
21
- content: Content;
22
- vizCache: VizCache;
23
- // Resolves a slug import to a viz ID.
24
- resolveSlug: ({ userName, slug }) => Promise<VizId>;
25
- getSvelteCompiler: () => Promise<any>;
26
- }) => {
27
- // `runtimeVersion` is used to determine which runtime
28
- // to use. It's either 2 or 3.
29
- const runtimeVersion: number = getRuntimeVersion(content);
30
-
31
- let initialSrcdoc = '';
32
- let initialSrcdocError: string | null = null;
33
-
34
- if (debug) {
35
- console.log('computeSrcDoc.ts: computeSrcDoc()');
36
- console.log(' runtimeVersion:', runtimeVersion);
37
- console.log(' content:', content);
38
- }
39
-
40
- try {
41
- if (runtimeVersion === 2) {
42
- initialSrcdoc = await computeSrcDocV2(content);
43
- } else if (runtimeVersion === 3) {
44
- const buildResult = await build({
45
- vizId: content.id,
46
- enableSourcemap: true,
47
- rollup,
48
- vizCache,
49
- resolveSlug,
50
- getSvelteCompiler,
51
- });
52
- initialSrcdoc = await computeSrcDocV3({
53
- vizCache,
54
- buildResult,
55
- });
56
- }
57
- } catch (error) {
58
- // initialSrcdocError = e.toString();
59
- initialSrcdocError = error.message;
60
- }
61
-
62
- return {
63
- // Escape ending tags in strings like "</script>",
64
- // so that they don't break the HTML.
65
- initialSrcdoc,
66
- initialSrcdocError,
67
- };
68
- };