@dxos/plugin-script 0.6.9-staging.8e43e2a → 0.6.10-main.3cfcc89

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 (102) hide show
  1. package/README.md +45 -0
  2. package/dist/lib/browser/ScriptEditor-WNCGR5OU.mjs +452 -0
  3. package/dist/lib/browser/ScriptEditor-WNCGR5OU.mjs.map +7 -0
  4. package/dist/lib/browser/{TypescriptEditor-PIRIDDUS.mjs → TypescriptEditor-XTGRVCMY.mjs} +2 -2
  5. package/dist/lib/browser/{chunk-SK3L274X.mjs → chunk-DL5XQRQM.mjs} +13 -7
  6. package/dist/lib/browser/{chunk-SK3L274X.mjs.map → chunk-DL5XQRQM.mjs.map} +3 -3
  7. package/dist/lib/browser/{chunk-D4O723CR.mjs → chunk-DX5CSOBP.mjs} +22 -5
  8. package/dist/lib/browser/chunk-DX5CSOBP.mjs.map +7 -0
  9. package/dist/lib/browser/chunk-RHEZ5LUU.mjs +229 -0
  10. package/dist/lib/browser/chunk-RHEZ5LUU.mjs.map +7 -0
  11. package/dist/lib/browser/edge/index.mjs +1 -1
  12. package/dist/lib/browser/index.mjs +88 -195
  13. package/dist/lib/browser/index.mjs.map +4 -4
  14. package/dist/lib/browser/meta.json +1 -1
  15. package/dist/lib/node/ScriptEditor-RR7AVOQL.cjs +465 -0
  16. package/dist/lib/node/ScriptEditor-RR7AVOQL.cjs.map +7 -0
  17. package/dist/lib/node/{TypescriptEditor-OTWJUIWB.cjs → TypescriptEditor-CRONCQSI.cjs} +7 -7
  18. package/dist/lib/node/{TypescriptEditor-OTWJUIWB.cjs.map → TypescriptEditor-CRONCQSI.cjs.map} +2 -2
  19. package/dist/lib/node/chunk-4GTXIELQ.cjs +252 -0
  20. package/dist/lib/node/chunk-4GTXIELQ.cjs.map +7 -0
  21. package/dist/lib/node/{chunk-X6A3D4PD.cjs → chunk-PFH3ROEH.cjs} +16 -10
  22. package/dist/lib/node/{chunk-X6A3D4PD.cjs.map → chunk-PFH3ROEH.cjs.map} +3 -3
  23. package/dist/lib/node/{chunk-ITLHJMWP.cjs → chunk-RXI576K3.cjs} +24 -7
  24. package/dist/lib/node/chunk-RXI576K3.cjs.map +7 -0
  25. package/dist/lib/node/edge/index.cjs +8 -8
  26. package/dist/lib/node/edge/index.cjs.map +1 -1
  27. package/dist/lib/node/index.cjs +85 -194
  28. package/dist/lib/node/index.cjs.map +4 -4
  29. package/dist/lib/node/meta.json +1 -1
  30. package/dist/types/src/ScriptPlugin.d.ts +1 -4
  31. package/dist/types/src/ScriptPlugin.d.ts.map +1 -1
  32. package/dist/types/src/bundler/bundler.d.ts +39 -0
  33. package/dist/types/src/bundler/bundler.d.ts.map +1 -0
  34. package/dist/types/src/bundler/bundler.test.d.ts +2 -0
  35. package/dist/types/src/bundler/bundler.test.d.ts.map +1 -0
  36. package/dist/types/src/bundler/index.d.ts +2 -0
  37. package/dist/types/src/bundler/index.d.ts.map +1 -0
  38. package/dist/types/src/compiler/compiler.browser.test.d.ts +2 -0
  39. package/dist/types/src/compiler/compiler.browser.test.d.ts.map +1 -0
  40. package/dist/types/src/compiler/compiler.d.ts +9 -34
  41. package/dist/types/src/compiler/compiler.d.ts.map +1 -1
  42. package/dist/types/src/components/DetailsPanel.d.ts +9 -0
  43. package/dist/types/src/components/DetailsPanel.d.ts.map +1 -0
  44. package/dist/types/src/components/ScriptBlock/FrameContainer/FrameContainer.d.ts +2 -2
  45. package/dist/types/src/components/ScriptBlock/FrameContainer/FrameContainer.d.ts.map +1 -1
  46. package/dist/types/src/components/ScriptBlock/ScriptBlock.d.ts.map +1 -1
  47. package/dist/types/src/components/ScriptBlock/ScriptBlock.stories.d.ts +1 -1
  48. package/dist/types/src/components/ScriptBlock/ScriptBlock.stories.d.ts.map +1 -1
  49. package/dist/types/src/components/ScriptBlock/Splitter/Splitter.stories.d.ts +1 -1
  50. package/dist/types/src/components/ScriptBlock/Splitter/Splitter.stories.d.ts.map +1 -1
  51. package/dist/types/src/components/ScriptEditor.d.ts +3 -2
  52. package/dist/types/src/components/ScriptEditor.d.ts.map +1 -1
  53. package/dist/types/src/components/Toolbar.d.ts +9 -7
  54. package/dist/types/src/components/Toolbar.d.ts.map +1 -1
  55. package/dist/types/src/components/Toolbar.stories.d.ts +2 -2
  56. package/dist/types/src/components/Toolbar.stories.d.ts.map +1 -1
  57. package/dist/types/src/components/TypescriptEditor.d.ts +3 -1
  58. package/dist/types/src/components/TypescriptEditor.d.ts.map +1 -1
  59. package/dist/types/src/components/TypescriptEditor.stories.d.ts +2 -2
  60. package/dist/types/src/components/TypescriptEditor.stories.d.ts.map +1 -1
  61. package/dist/types/src/components/index.d.ts +2 -2
  62. package/dist/types/src/components/index.d.ts.map +1 -1
  63. package/dist/types/src/data/templates.md.d.ts +3 -0
  64. package/dist/types/src/data/templates.md.d.ts.map +1 -0
  65. package/dist/types/src/edge/functions.d.ts.map +1 -1
  66. package/dist/types/src/index.d.ts +1 -0
  67. package/dist/types/src/index.d.ts.map +1 -1
  68. package/dist/types/src/translations.d.ts +3 -2
  69. package/dist/types/src/translations.d.ts.map +1 -1
  70. package/dist/types/src/types/script.d.ts +4 -4
  71. package/package.json +38 -33
  72. package/src/ScriptPlugin.tsx +29 -10
  73. package/src/bundler/bundler.test.ts +44 -0
  74. package/src/bundler/bundler.ts +246 -0
  75. package/src/bundler/index.ts +5 -0
  76. package/src/compiler/compiler.browser.test.ts +18 -0
  77. package/src/compiler/compiler.ts +31 -190
  78. package/src/compiler/index.ts +1 -1
  79. package/src/components/DetailsPanel.tsx +218 -0
  80. package/src/components/ScriptBlock/FrameContainer/FrameContainer.tsx +2 -2
  81. package/src/components/ScriptBlock/ScriptBlock.stories.tsx +1 -1
  82. package/src/components/ScriptBlock/ScriptBlock.tsx +10 -7
  83. package/src/components/ScriptBlock/Splitter/Splitter.stories.tsx +1 -1
  84. package/src/components/ScriptEditor.tsx +71 -13
  85. package/src/components/Toolbar.stories.tsx +1 -1
  86. package/src/components/Toolbar.tsx +69 -91
  87. package/src/components/TypescriptEditor.stories.tsx +1 -1
  88. package/src/components/TypescriptEditor.tsx +18 -4
  89. package/src/data/templates.md.ts +44 -0
  90. package/src/edge/functions.ts +9 -2
  91. package/src/index.ts +1 -0
  92. package/src/translations.ts +4 -3
  93. package/dist/lib/browser/ScriptEditor-7XICKICQ.mjs +0 -241
  94. package/dist/lib/browser/ScriptEditor-7XICKICQ.mjs.map +0 -7
  95. package/dist/lib/browser/chunk-D4O723CR.mjs.map +0 -7
  96. package/dist/lib/node/ScriptEditor-M7KZ2CRS.cjs +0 -258
  97. package/dist/lib/node/ScriptEditor-M7KZ2CRS.cjs.map +0 -7
  98. package/dist/lib/node/chunk-ITLHJMWP.cjs.map +0 -7
  99. package/dist/types/src/compiler/compiler.test.d.ts +0 -2
  100. package/dist/types/src/compiler/compiler.test.d.ts.map +0 -1
  101. package/src/compiler/compiler.test.ts +0 -17
  102. /package/dist/lib/browser/{TypescriptEditor-PIRIDDUS.mjs.map → TypescriptEditor-XTGRVCMY.mjs.map} +0 -0
@@ -0,0 +1,39 @@
1
+ import { type BuildOptions } from 'esbuild';
2
+ import { type BuildResult } from 'esbuild-wasm';
3
+ export type Import = {
4
+ moduleUrl: string;
5
+ defaultImport: boolean;
6
+ namedImports: string[];
7
+ };
8
+ export type BundlerResult = {
9
+ timestamp: number;
10
+ sourceHash: Buffer;
11
+ imports?: Import[];
12
+ bundle?: string;
13
+ error?: any;
14
+ };
15
+ export type BundlerOptions = {
16
+ platform: BuildOptions['platform'];
17
+ sandboxedModules: string[];
18
+ remoteModules: Record<string, string>;
19
+ };
20
+ export declare const initializeBundler: (options: {
21
+ wasmUrl: string;
22
+ }) => Promise<void>;
23
+ /**
24
+ * ESBuild bundler.
25
+ */
26
+ export declare class Bundler {
27
+ private readonly _options;
28
+ constructor(_options: BundlerOptions);
29
+ bundle(source: string): Promise<BundlerResult>;
30
+ analyzeImports(result: BuildResult): Import[];
31
+ analyzeSourceFileImports(code: string): {
32
+ defaultImportName: string;
33
+ namedImports: string[];
34
+ wildcardImportName: string;
35
+ moduleIdentifier: string;
36
+ quotes: string;
37
+ }[];
38
+ }
39
+ //# sourceMappingURL=bundler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bundler.d.ts","sourceRoot":"","sources":["../../../../src/bundler/bundler.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,EAAqB,KAAK,WAAW,EAAe,MAAM,cAAc,CAAC;AAMhF,MAAM,MAAM,MAAM,GAAG;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,OAAO,CAAC;IACvB,YAAY,EAAE,MAAM,EAAE,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,GAAG,CAAC;CACb,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,QAAQ,EAAE,YAAY,CAAC,UAAU,CAAC,CAAC;IACnC,gBAAgB,EAAE,MAAM,EAAE,CAAC;IAC3B,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACvC,CAAC;AAGF,eAAO,MAAM,iBAAiB,YAAmB;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,kBAInE,CAAC;AAEF;;GAEG;AACH,qBAAa,OAAO;IACN,OAAO,CAAC,QAAQ,CAAC,QAAQ;gBAAR,QAAQ,EAAE,cAAc;IAE/C,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;IAoFpD,cAAc,CAAC,MAAM,EAAE,WAAW,GAAG,MAAM,EAAE;IA2B7C,wBAAwB,CAAC,IAAI,EAAE,MAAM;;;;;;;CAatC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=bundler.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bundler.test.d.ts","sourceRoot":"","sources":["../../../../src/bundler/bundler.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export * from './bundler';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/bundler/index.ts"],"names":[],"mappings":"AAIA,cAAc,WAAW,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=compiler.browser.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compiler.browser.test.d.ts","sourceRoot":"","sources":["../../../../src/compiler/compiler.browser.test.ts"],"names":[],"mappings":""}
@@ -1,38 +1,13 @@
1
- import { type BuildOptions } from 'esbuild';
2
- import { type BuildResult } from 'esbuild-wasm';
3
- export type Import = {
4
- moduleUrl: string;
5
- defaultImport: boolean;
6
- namedImports: string[];
7
- };
8
- export type CompilerResult = {
9
- timestamp: number;
10
- sourceHash: Buffer;
11
- imports?: Import[];
12
- bundle?: string;
13
- error?: any;
14
- };
15
- export type CompilerOptions = {
16
- platform: BuildOptions['platform'];
17
- providedModules: string[];
18
- };
19
- export declare const initializeCompiler: (options: {
20
- wasmURL: string;
21
- }) => Promise<void>;
22
- /**
23
- * ESBuild compiler.
24
- */
1
+ import { type VirtualTypeScriptEnvironment } from '@typescript/vfs';
2
+ import ts from 'typescript';
25
3
  export declare class Compiler {
26
4
  private readonly _options;
27
- constructor(_options: CompilerOptions);
28
- compile(source: string): Promise<CompilerResult>;
29
- analyzeImports(result: BuildResult): Import[];
30
- analyzeSourceFileImports(code: string): {
31
- defaultImportName: string;
32
- namedImports: string[];
33
- wildcardImportName: string;
34
- moduleIdentifier: string;
35
- quotes: string;
36
- }[];
5
+ private _env;
6
+ private _fsMap;
7
+ constructor(_options?: ts.CompilerOptions);
8
+ initialize(): Promise<void>;
9
+ get environment(): VirtualTypeScriptEnvironment;
10
+ setFile(fileName: string, content: string): void;
11
+ compile(fileName: string): ts.EmitOutput;
37
12
  }
38
13
  //# sourceMappingURL=compiler.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"compiler.d.ts","sourceRoot":"","sources":["../../../../src/compiler/compiler.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,EAAqB,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;AAKnE,MAAM,MAAM,MAAM,GAAG;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,OAAO,CAAC;IACvB,YAAY,EAAE,MAAM,EAAE,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,GAAG,CAAC;CACb,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,QAAQ,EAAE,YAAY,CAAC,UAAU,CAAC,CAAC;IACnC,eAAe,EAAE,MAAM,EAAE,CAAC;CAC3B,CAAC;AAGF,eAAO,MAAM,kBAAkB,YAAmB;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,kBAIpE,CAAC;AAEF;;GAEG;AACH,qBAAa,QAAQ;IACP,OAAO,CAAC,QAAQ,CAAC,QAAQ;gBAAR,QAAQ,EAAE,eAAe;IAEhD,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;IA6EtD,cAAc,CAAC,MAAM,EAAE,WAAW,GAAG,MAAM,EAAE;IA2B7C,wBAAwB,CAAC,IAAI,EAAE,MAAM;;;;;;;CAatC"}
1
+ {"version":3,"file":"compiler.d.ts","sourceRoot":"","sources":["../../../../src/compiler/compiler.ts"],"names":[],"mappings":"AAIA,OAAO,EAIL,KAAK,4BAA4B,EAClC,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,MAAM,YAAY,CAAC;AAS5B,qBAAa,QAAQ;IAIP,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAHrC,OAAO,CAAC,IAAI,CAA2C;IACvD,OAAO,CAAC,MAAM,CAAkC;gBAEnB,QAAQ,GAAE,EAAE,CAAC,eAAgC;IAEpE,UAAU;IAYhB,IAAI,WAAW,iCAGd;IAED,OAAO,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;IAKzC,OAAO,CAAC,QAAQ,EAAE,MAAM;CAGzB"}
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import { type ThemedClassName } from '@dxos/react-ui';
3
+ export type DetailsPanelProps = ThemedClassName<{
4
+ functionUrl?: string;
5
+ binding?: string;
6
+ onBindingChange?: (binding: string) => void;
7
+ }>;
8
+ export declare const DetailsPanel: ({ classNames, functionUrl, binding: _binding, onBindingChange }: DetailsPanelProps) => React.JSX.Element;
9
+ //# sourceMappingURL=DetailsPanel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DetailsPanel.d.ts","sourceRoot":"","sources":["../../../../src/components/DetailsPanel.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAsC,MAAM,OAAO,CAAC;AAG3D,OAAO,EAKL,KAAK,eAAe,EAKrB,MAAM,gBAAgB,CAAC;AASxB,MAAM,MAAM,iBAAiB,GAAG,eAAe,CAAC;IAC9C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,eAAe,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;CAC7C,CAAC,CAAC;AAEH,eAAO,MAAM,YAAY,oEAAqE,iBAAiB,sBAsJ9G,CAAC"}
@@ -1,8 +1,8 @@
1
1
  import React from 'react';
2
- import { type CompilerResult } from '../../../compiler';
2
+ import { type BundlerResult } from '../../../bundler';
3
3
  export type FrameContainerProps = {
4
4
  containerUrl: string;
5
- result: CompilerResult;
5
+ result: BundlerResult;
6
6
  debug?: boolean;
7
7
  };
8
8
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"FrameContainer.d.ts","sourceRoot":"","sources":["../../../../../../src/components/ScriptBlock/FrameContainer/FrameContainer.tsx"],"names":[],"mappings":"AAIA,OAAO,KAA4B,MAAM,OAAO,CAAC;AASjD,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAExD,MAAM,MAAM,mBAAmB,GAAG;IAChC,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,cAAc,CAAC;IACvB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,cAAc,oCAA4C,mBAAmB,sBAyDzF,CAAC"}
1
+ {"version":3,"file":"FrameContainer.d.ts","sourceRoot":"","sources":["../../../../../../src/components/ScriptBlock/FrameContainer/FrameContainer.tsx"],"names":[],"mappings":"AAIA,OAAO,KAA4B,MAAM,OAAO,CAAC;AASjD,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEtD,MAAM,MAAM,mBAAmB,GAAG;IAChC,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,aAAa,CAAC;IACtB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,cAAc,oCAA4C,mBAAmB,sBAyDzF,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"ScriptBlock.d.ts","sourceRoot":"","sources":["../../../../../src/components/ScriptBlock/ScriptBlock.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAoD,MAAM,OAAO,CAAC;AAOzE,OAAO,EAA8B,KAAK,IAAI,EAAE,MAAM,YAAY,CAAC;AAEnE,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,aAAa,CAAC;AAa9C,MAAM,MAAM,gBAAgB,GAAG;IAC7B,MAAM,EAAE,UAAU,CAAC;IACnB,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,OAAO,CAAC,EAAE;QACR,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC;IAGF,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF;;GAEG;AAEH,eAAO,MAAM,WAAW,2EAMrB,gBAAgB,sBA+ElB,CAAC"}
1
+ {"version":3,"file":"ScriptBlock.d.ts","sourceRoot":"","sources":["../../../../../src/components/ScriptBlock/ScriptBlock.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAoD,MAAM,OAAO,CAAC;AAOzE,OAAO,EAA8B,KAAK,IAAI,EAAE,MAAM,YAAY,CAAC;AAEnE,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,aAAa,CAAC;AAa9C,MAAM,MAAM,gBAAgB,GAAG;IAC7B,MAAM,EAAE,UAAU,CAAC;IACnB,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,OAAO,CAAC,EAAE;QACR,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC;IAGF,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF;;GAEG;AAEH,eAAO,MAAM,WAAW,2EAMrB,gBAAgB,sBAkFlB,CAAC"}
@@ -1,4 +1,4 @@
1
- import '@dxosTheme';
1
+ import '@dxos-theme';
2
2
  import React from 'react';
3
3
  declare const _default: {
4
4
  title: string;
@@ -1 +1 @@
1
- {"version":3,"file":"ScriptBlock.stories.d.ts","sourceRoot":"","sources":["../../../../../src/components/ScriptBlock/ScriptBlock.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,YAAY,CAAC;AAEpB,OAAO,KAA6B,MAAM,OAAO,CAAC;;;;;;;;;;AA+ClD,wBAQE;AAEF,eAAO,MAAM,OAAO,IAAK,CAAC"}
1
+ {"version":3,"file":"ScriptBlock.stories.d.ts","sourceRoot":"","sources":["../../../../../src/components/ScriptBlock/ScriptBlock.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,aAAa,CAAC;AAErB,OAAO,KAA6B,MAAM,OAAO,CAAC;;;;;;;;;;AA+ClD,wBAQE;AAEF,eAAO,MAAM,OAAO,IAAK,CAAC"}
@@ -1,4 +1,4 @@
1
- import '@dxosTheme';
1
+ import '@dxos-theme';
2
2
  import React from 'react';
3
3
  declare const _default: {
4
4
  title: string;
@@ -1 +1 @@
1
- {"version":3,"file":"Splitter.stories.d.ts","sourceRoot":"","sources":["../../../../../../src/components/ScriptBlock/Splitter/Splitter.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,YAAY,CAAC;AAEpB,OAAO,KAAmB,MAAM,OAAO,CAAC;;;;;;;;;AAqBxC,wBAOE;AAEF,eAAO,MAAM,OAAO,IAAK,CAAC"}
1
+ {"version":3,"file":"Splitter.stories.d.ts","sourceRoot":"","sources":["../../../../../../src/components/ScriptBlock/Splitter/Splitter.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,aAAa,CAAC;AAErB,OAAO,KAAmB,MAAM,OAAO,CAAC;;;;;;;;;AAqBxC,wBAOE;AAEF,eAAO,MAAM,OAAO,IAAK,CAAC"}
@@ -1,9 +1,10 @@
1
1
  import React from 'react';
2
+ import { type TypescriptEditorProps } from './TypescriptEditor';
2
3
  import { type ScriptType } from '../types';
3
4
  export type ScriptEditorProps = {
4
5
  script: ScriptType;
5
6
  role?: string;
6
- };
7
- export declare const ScriptEditor: ({ script, role }: ScriptEditorProps) => React.JSX.Element;
7
+ } & Pick<TypescriptEditorProps, 'env'>;
8
+ export declare const ScriptEditor: ({ env, script, role }: ScriptEditorProps) => React.JSX.Element;
8
9
  export default ScriptEditor;
9
10
  //# sourceMappingURL=ScriptEditor.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ScriptEditor.d.ts","sourceRoot":"","sources":["../../../../src/components/ScriptEditor.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAyC,MAAM,OAAO,CAAC;AAmB9D,OAAO,EAAgB,KAAK,UAAU,EAAE,MAAM,UAAU,CAAC;AAEzD,MAAM,MAAM,iBAAiB,GAAG;IAC9B,MAAM,EAAE,UAAU,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,eAAO,MAAM,YAAY,qBAAsB,iBAAiB,sBA+F/D,CAAC;AAEF,eAAe,YAAY,CAAC"}
1
+ {"version":3,"file":"ScriptEditor.d.ts","sourceRoot":"","sources":["../../../../src/components/ScriptEditor.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAyC,MAAM,OAAO,CAAC;AAY9D,OAAO,EAAoB,KAAK,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AASlF,OAAO,EAAgB,KAAK,UAAU,EAAE,MAAM,UAAU,CAAC;AAEzD,MAAM,MAAM,iBAAiB,GAAG;IAC9B,MAAM,EAAE,UAAU,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,GAAG,IAAI,CAAC,qBAAqB,EAAE,KAAK,CAAC,CAAC;AAEvC,eAAO,MAAM,YAAY,0BAA2B,iBAAiB,sBAoJpE,CAAC;AAEF,eAAe,YAAY,CAAC"}
@@ -1,11 +1,13 @@
1
1
  import React from 'react';
2
- export type ToolbarProps = {
3
- binding: string;
4
- onBindingChange: (binding: string) => void;
2
+ import { type ThemedClassName } from '@dxos/react-ui';
3
+ export type ToolbarProps = ThemedClassName<{
5
4
  deployed?: boolean;
6
- onDeploy?: () => Promise<void>;
7
- functionUrl?: string;
8
5
  error?: string;
9
- };
10
- export declare const Toolbar: ({ binding: _binding, onBindingChange, deployed, onDeploy, functionUrl, error, }: ToolbarProps) => React.JSX.Element;
6
+ functionUrl?: string;
7
+ showPanel?: boolean;
8
+ onDeploy?: () => Promise<void>;
9
+ onFormat?: () => Promise<void>;
10
+ onTogglePanel?: () => Promise<void>;
11
+ }>;
12
+ export declare const Toolbar: ({ classNames, deployed, error, functionUrl, showPanel, onDeploy, onFormat, onTogglePanel, }: ToolbarProps) => React.JSX.Element;
11
13
  //# sourceMappingURL=Toolbar.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Toolbar.d.ts","sourceRoot":"","sources":["../../../../src/components/Toolbar.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAsC,MAAM,OAAO,CAAC;AAe3D,MAAM,MAAM,YAAY,GAAG;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,eAAe,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAC3C,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,eAAO,MAAM,OAAO,oFAOjB,YAAY,sBAkJd,CAAC"}
1
+ {"version":3,"file":"Toolbar.d.ts","sourceRoot":"","sources":["../../../../src/components/Toolbar.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAExC,OAAO,EAIL,KAAK,eAAe,EAIrB,MAAM,gBAAgB,CAAC;AAKxB,MAAM,MAAM,YAAY,GAAG,eAAe,CAAC;IACzC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/B,QAAQ,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/B,aAAa,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CACrC,CAAC,CAAC;AAEH,eAAO,MAAM,OAAO,gGASjB,YAAY,sBAyHd,CAAC"}
@@ -1,7 +1,7 @@
1
- import '@dxosTheme';
1
+ import '@dxos-theme';
2
2
  declare const _default: {
3
3
  title: string;
4
- component: ({ binding: _binding, onBindingChange, deployed, onDeploy, functionUrl, error, }: import("./Toolbar").ToolbarProps) => import("react").JSX.Element;
4
+ component: ({ classNames, deployed, error, functionUrl, showPanel, onDeploy, onFormat, onTogglePanel, }: import("./Toolbar").ToolbarProps) => import("react").JSX.Element;
5
5
  parameters: {
6
6
  layout: string;
7
7
  };
@@ -1 +1 @@
1
- {"version":3,"file":"Toolbar.stories.d.ts","sourceRoot":"","sources":["../../../../src/components/Toolbar.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,YAAY,CAAC;;;;;;;;AAMpB,wBAME;AAEF,eAAO,MAAM,OAAO;;;;;CAAmD,CAAC"}
1
+ {"version":3,"file":"Toolbar.stories.d.ts","sourceRoot":"","sources":["../../../../src/components/Toolbar.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,aAAa,CAAC;;;;;;;;AAMrB,wBAME;AAEF,eAAO,MAAM,OAAO;;;;;CAAmD,CAAC"}
@@ -1,10 +1,12 @@
1
+ import { type VirtualTypeScriptEnvironment } from '@typescript/vfs';
1
2
  import React from 'react';
2
3
  import { type UseTextEditorProps } from '@dxos/react-ui-editor';
3
4
  export type TypescriptEditorProps = {
4
5
  id: string;
6
+ env?: VirtualTypeScriptEnvironment;
5
7
  className?: string;
6
8
  scrollPastEnd?: boolean;
7
9
  } & Pick<UseTextEditorProps, 'initialValue' | 'extensions' | 'scrollTo' | 'selection'>;
8
- export declare const TypescriptEditor: ({ id, extensions, initialValue, scrollTo, selection, className, scrollPastEnd, }: TypescriptEditorProps) => React.JSX.Element;
10
+ export declare const TypescriptEditor: ({ id, extensions, env, initialValue, scrollTo, selection, className, scrollPastEnd, }: TypescriptEditorProps) => React.JSX.Element;
9
11
  export default TypescriptEditor;
10
12
  //# sourceMappingURL=TypescriptEditor.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"TypescriptEditor.d.ts","sourceRoot":"","sources":["../../../../src/components/TypescriptEditor.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAQL,KAAK,kBAAkB,EACxB,MAAM,uBAAuB,CAAC;AAG/B,MAAM,MAAM,qBAAqB,GAAG;IAClC,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB,GAAG,IAAI,CAAC,kBAAkB,EAAE,cAAc,GAAG,YAAY,GAAG,UAAU,GAAG,WAAW,CAAC,CAAC;AAEvF,eAAO,MAAM,gBAAgB,qFAQ1B,qBAAqB,sBA8BvB,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
1
+ {"version":3,"file":"TypescriptEditor.d.ts","sourceRoot":"","sources":["../../../../src/components/TypescriptEditor.tsx"],"names":[],"mappings":"AAOA,OAAO,EAAE,KAAK,4BAA4B,EAAE,MAAM,iBAAiB,CAAC;AAEpE,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EASL,KAAK,kBAAkB,EACxB,MAAM,uBAAuB,CAAC;AAG/B,MAAM,MAAM,qBAAqB,GAAG;IAClC,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,CAAC,EAAE,4BAA4B,CAAC;IACnC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB,GAAG,IAAI,CAAC,kBAAkB,EAAE,cAAc,GAAG,YAAY,GAAG,UAAU,GAAG,WAAW,CAAC,CAAC;AAEvF,eAAO,MAAM,gBAAgB,0FAS1B,qBAAqB,sBAuCvB,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
@@ -1,8 +1,8 @@
1
- import '@dxosTheme';
1
+ import '@dxos-theme';
2
2
  import React from 'react';
3
3
  declare const _default: {
4
4
  title: string;
5
- component: ({ id, extensions, initialValue, scrollTo, selection, className, scrollPastEnd, }: import("./TypescriptEditor").TypescriptEditorProps) => React.JSX.Element;
5
+ component: ({ id, extensions, env, initialValue, scrollTo, selection, className, scrollPastEnd, }: import("./TypescriptEditor").TypescriptEditorProps) => React.JSX.Element;
6
6
  render: () => React.JSX.Element;
7
7
  parameters: {
8
8
  layout: string;
@@ -1 +1 @@
1
- {"version":3,"file":"TypescriptEditor.stories.d.ts","sourceRoot":"","sources":["../../../../src/components/TypescriptEditor.stories.tsx"],"names":[],"mappings":"AAeA,OAAO,YAAY,CAAC;AAEpB,OAAO,KAAkB,MAAM,OAAO,CAAC;;;;;;;;;AAoCvC,wBAOE;AAEF,eAAO,MAAM,OAAO,IAAK,CAAC"}
1
+ {"version":3,"file":"TypescriptEditor.stories.d.ts","sourceRoot":"","sources":["../../../../src/components/TypescriptEditor.stories.tsx"],"names":[],"mappings":"AAeA,OAAO,aAAa,CAAC;AAErB,OAAO,KAAkB,MAAM,OAAO,CAAC;;;;;;;;;AAoCvC,wBAOE;AAEF,eAAO,MAAM,OAAO,IAAK,CAAC"}
@@ -1,4 +1,4 @@
1
1
  import React from 'react';
2
- export declare const ScriptEditor: React.LazyExoticComponent<({ script, role }: import("./ScriptEditor").ScriptEditorProps) => React.JSX.Element>;
3
- export declare const TypescriptEditor: React.LazyExoticComponent<({ id, extensions, initialValue, scrollTo, selection, className, scrollPastEnd, }: import("./TypescriptEditor").TypescriptEditorProps) => React.JSX.Element>;
2
+ export declare const ScriptEditor: React.LazyExoticComponent<({ env, script, role }: import("./ScriptEditor").ScriptEditorProps) => React.JSX.Element>;
3
+ export declare const TypescriptEditor: React.LazyExoticComponent<({ id, extensions, env, initialValue, scrollTo, selection, className, scrollPastEnd, }: import("./TypescriptEditor").TypescriptEditorProps) => React.JSX.Element>;
4
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,eAAO,MAAM,YAAY,gHAA6C,CAAC;AACvE,eAAO,MAAM,gBAAgB,wLAAiD,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,eAAO,MAAM,YAAY,qHAA6C,CAAC;AACvE,eAAO,MAAM,gBAAgB,6LAAiD,CAAC"}
@@ -0,0 +1,3 @@
1
+ declare const _default: ({ event: { data: { request }, }, context: { space, ai }, }: any) => Promise<Response>;
2
+ export default _default;
3
+ //# sourceMappingURL=templates.md.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"templates.md.d.ts","sourceRoot":"","sources":["../../../../src/data/templates.md.ts"],"names":[],"mappings":"qFASG,GAAG;AALN,wBAuCE"}
@@ -1 +1 @@
1
- {"version":3,"file":"functions.d.ts","sourceRoot":"","sources":["../../../../src/edge/functions.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,GAAG,EAAE,MAAM,eAAe,CAAC;AAGzC,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAapD,MAAM,MAAM,wBAAwB,GAAG;IACrC,MAAM,EAAE,SAAS,GAAG,OAAO,CAAC;IAC5B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,qBAAqB,CAAC,EAAE,MAAM,CAAC;CAChC,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,IAAI,CAAC;IACX,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,GAAG,CAAC;IACd,qBAAqB,CAAC,EAAE,MAAM,CAAC;CAChC,CAAC;AAQF,eAAO,MAAM,oBAAoB,uFAQ9B,iBAAiB,sCAwBnB,CAAC;AAEF,eAAO,MAAM,4BAA4B,SAAU,UAAU,uBAE5D,CAAC;AAEF,eAAO,MAAM,4BAA4B,SAAU,UAAU,eAAe,MAAM,SASjF,CAAC"}
1
+ {"version":3,"file":"functions.d.ts","sourceRoot":"","sources":["../../../../src/edge/functions.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,GAAG,EAAE,MAAM,eAAe,CAAC;AAGzC,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAapD,MAAM,MAAM,wBAAwB,GAAG;IACrC,MAAM,EAAE,SAAS,GAAG,OAAO,CAAC;IAC5B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,qBAAqB,CAAC,EAAE,MAAM,CAAC;CAChC,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,IAAI,CAAC;IACX,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,GAAG,CAAC;IACd,qBAAqB,CAAC,EAAE,MAAM,CAAC;CAChC,CAAC;AAeF,eAAO,MAAM,oBAAoB,uFAQ9B,iBAAiB,sCAwBnB,CAAC;AAEF,eAAO,MAAM,4BAA4B,SAAU,UAAU,uBAE5D,CAAC;AAEF,eAAO,MAAM,4BAA4B,SAAU,UAAU,eAAe,MAAM,SASjF,CAAC"}
@@ -1,5 +1,6 @@
1
1
  import { ScriptPlugin } from './ScriptPlugin';
2
2
  export default ScriptPlugin;
3
+ export * from './bundler';
3
4
  export * from './compiler';
4
5
  export * from './components';
5
6
  export * from './types';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,eAAe,YAAY,CAAC;AAE5B,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AAExB,cAAc,gBAAgB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,eAAe,YAAY,CAAC;AAE5B,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AAExB,cAAc,gBAAgB,CAAC"}
@@ -5,13 +5,14 @@ declare const _default: {
5
5
  'object title placeholder': string;
6
6
  'create object label': string;
7
7
  'create stack section label': string;
8
- 'binding label': string;
9
8
  'binding placeholder': string;
10
- 'edit binding label': string;
9
+ 'function request placeholder': string;
11
10
  'deploy label': string;
12
11
  'deployed label': string;
13
12
  'upload failed label': string;
14
13
  'copy link label': string;
14
+ 'format label': string;
15
+ 'toggle details label': string;
15
16
  };
16
17
  };
17
18
  }[];
@@ -1 +1 @@
1
- {"version":3,"file":"translations.d.ts","sourceRoot":"","sources":["../../../src/translations.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAMA,wBAkBE"}
1
+ {"version":3,"file":"translations.d.ts","sourceRoot":"","sources":["../../../src/translations.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAMA,wBAmBE"}
@@ -1,11 +1,11 @@
1
1
  import { ref, S } from '@dxos/echo-schema';
2
2
  declare const ScriptType_base: import("@dxos/echo-schema").AbstractTypedObject<{
3
+ name?: string | undefined;
3
4
  source: import("@dxos/echo-schema").Ref<{
4
5
  content: string;
5
6
  } & {
6
7
  id: string;
7
8
  }>;
8
- name?: string | undefined;
9
9
  changed?: boolean | undefined;
10
10
  } & {
11
11
  id: string;
@@ -21,18 +21,18 @@ declare const ScriptType_base: import("@dxos/echo-schema").AbstractTypedObject<{
21
21
  export declare class ScriptType extends ScriptType_base {
22
22
  }
23
23
  declare const FunctionType_base: import("@dxos/echo-schema").AbstractTypedObject<{
24
+ version: number;
24
25
  source?: import("@dxos/echo-schema").Ref<{
26
+ name?: string | undefined;
25
27
  source: import("@dxos/echo-schema").Ref<{
26
28
  content: string;
27
29
  } & {
28
30
  id: string;
29
31
  }>;
30
- name?: string | undefined;
31
32
  changed?: boolean | undefined;
32
33
  } & {
33
34
  id: string;
34
35
  }>;
35
- version: number;
36
36
  binding?: string | undefined;
37
37
  } & {
38
38
  id: string;
@@ -40,12 +40,12 @@ declare const FunctionType_base: import("@dxos/echo-schema").AbstractTypedObject
40
40
  version: typeof S.Number;
41
41
  binding: S.optional<typeof S.String>;
42
42
  source: S.optional<ref<{
43
+ name?: string | undefined;
43
44
  source: import("@dxos/echo-schema").Ref<{
44
45
  content: string;
45
46
  } & {
46
47
  id: string;
47
48
  }>;
48
- name?: string | undefined;
49
49
  changed?: boolean | undefined;
50
50
  } & {
51
51
  id: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dxos/plugin-script",
3
- "version": "0.6.9-staging.8e43e2a",
3
+ "version": "0.6.10-main.3cfcc89",
4
4
  "description": "Braneframe notebook plugin",
5
5
  "homepage": "https://dxos.org",
6
6
  "bugs": "https://github.com/dxos/dxos/issues",
@@ -58,38 +58,43 @@
58
58
  "@codemirror/autocomplete": "^6.18.0",
59
59
  "@codemirror/lang-javascript": "^6.2.2",
60
60
  "@codemirror/language": "^6.10.2",
61
+ "@codemirror/lint": "^6.8.1",
61
62
  "@codemirror/state": "^6.4.1",
62
63
  "@codemirror/theme-one-dark": "^6.1.2",
63
64
  "@codemirror/view": "^6.29.1",
64
65
  "@lezer/common": "^1.2.1",
65
66
  "@preact/signals-core": "^1.6.0",
67
+ "@typescript/vfs": "^1.6.0",
68
+ "@valtown/codemirror-ts": "^2.2.0",
66
69
  "codemirror": "^6.0.1",
67
70
  "esbuild-wasm": "^0.16.14",
68
71
  "iso-did": "^1.6.0",
69
72
  "lodash.get": "^4.4.2",
70
- "@dxos/app-framework": "0.6.9-staging.8e43e2a",
71
- "@dxos/async": "0.6.9-staging.8e43e2a",
72
- "@dxos/client": "0.6.9-staging.8e43e2a",
73
- "@dxos/client-protocol": "0.6.9-staging.8e43e2a",
74
- "@dxos/debug": "0.6.9-staging.8e43e2a",
75
- "@dxos/echo-schema": "0.6.9-staging.8e43e2a",
76
- "@dxos/crypto": "0.6.9-staging.8e43e2a",
77
- "@dxos/invariant": "0.6.9-staging.8e43e2a",
78
- "@dxos/keys": "0.6.9-staging.8e43e2a",
79
- "@dxos/log": "0.6.9-staging.8e43e2a",
80
- "@dxos/plugin-client": "0.6.9-staging.8e43e2a",
81
- "@dxos/plugin-explorer": "0.6.9-staging.8e43e2a",
82
- "@dxos/plugin-graph": "0.6.9-staging.8e43e2a",
83
- "@dxos/plugin-space": "0.6.9-staging.8e43e2a",
84
- "@dxos/plugin-markdown": "0.6.9-staging.8e43e2a",
85
- "@dxos/plugin-theme": "0.6.9-staging.8e43e2a",
86
- "@dxos/protocols": "0.6.9-staging.8e43e2a",
87
- "@dxos/plugin-stack": "0.6.9-staging.8e43e2a",
88
- "@dxos/react-client": "0.6.9-staging.8e43e2a",
89
- "@dxos/react-ui-editor": "0.6.9-staging.8e43e2a",
90
- "@dxos/rpc": "0.6.9-staging.8e43e2a",
91
- "@dxos/util": "0.6.9-staging.8e43e2a",
92
- "@dxos/rpc-tunnel": "0.6.9-staging.8e43e2a"
73
+ "prettier": "^3.2.4",
74
+ "typescript": "^5.5.4",
75
+ "@dxos/app-framework": "0.6.10-main.3cfcc89",
76
+ "@dxos/async": "0.6.10-main.3cfcc89",
77
+ "@dxos/client": "0.6.10-main.3cfcc89",
78
+ "@dxos/crypto": "0.6.10-main.3cfcc89",
79
+ "@dxos/client-protocol": "0.6.10-main.3cfcc89",
80
+ "@dxos/debug": "0.6.10-main.3cfcc89",
81
+ "@dxos/echo-schema": "0.6.10-main.3cfcc89",
82
+ "@dxos/invariant": "0.6.10-main.3cfcc89",
83
+ "@dxos/keys": "0.6.10-main.3cfcc89",
84
+ "@dxos/log": "0.6.10-main.3cfcc89",
85
+ "@dxos/plugin-client": "0.6.10-main.3cfcc89",
86
+ "@dxos/plugin-explorer": "0.6.10-main.3cfcc89",
87
+ "@dxos/plugin-graph": "0.6.10-main.3cfcc89",
88
+ "@dxos/plugin-markdown": "0.6.10-main.3cfcc89",
89
+ "@dxos/plugin-space": "0.6.10-main.3cfcc89",
90
+ "@dxos/plugin-stack": "0.6.10-main.3cfcc89",
91
+ "@dxos/plugin-theme": "0.6.10-main.3cfcc89",
92
+ "@dxos/protocols": "0.6.10-main.3cfcc89",
93
+ "@dxos/react-client": "0.6.10-main.3cfcc89",
94
+ "@dxos/react-ui-editor": "0.6.10-main.3cfcc89",
95
+ "@dxos/rpc": "0.6.10-main.3cfcc89",
96
+ "@dxos/rpc-tunnel": "0.6.10-main.3cfcc89",
97
+ "@dxos/util": "0.6.10-main.3cfcc89"
93
98
  },
94
99
  "devDependencies": {
95
100
  "@phosphor-icons/react": "^2.1.5",
@@ -99,20 +104,20 @@
99
104
  "react": "~18.2.0",
100
105
  "react-dom": "~18.2.0",
101
106
  "vite": "^5.3.4",
102
- "@dxos/echo-generator": "0.6.9-staging.8e43e2a",
103
- "@dxos/random": "0.6.9-staging.8e43e2a",
104
- "@dxos/react-ui-mosaic": "0.6.9-staging.8e43e2a",
105
- "@dxos/react-ui": "0.6.9-staging.8e43e2a",
106
- "@dxos/react-ui-theme": "0.6.9-staging.8e43e2a",
107
- "@dxos/storybook-utils": "0.6.9-staging.8e43e2a"
107
+ "@dxos/echo-generator": "0.6.10-main.3cfcc89",
108
+ "@dxos/random": "0.6.10-main.3cfcc89",
109
+ "@dxos/react-ui": "0.6.10-main.3cfcc89",
110
+ "@dxos/react-ui-mosaic": "0.6.10-main.3cfcc89",
111
+ "@dxos/react-ui-theme": "0.6.10-main.3cfcc89",
112
+ "@dxos/storybook-utils": "0.6.10-main.3cfcc89"
108
113
  },
109
114
  "optionalDependencies": {
110
115
  "@phosphor-icons/react": "^2.1.5",
111
116
  "react": "^18.0.0",
112
117
  "react-dom": "^18.0.0",
113
- "@dxos/react-ui": "0.6.9-staging.8e43e2a",
114
- "@dxos/react-ui-theme": "0.6.9-staging.8e43e2a",
115
- "@dxos/react-ui-mosaic": "0.6.9-staging.8e43e2a"
118
+ "@dxos/react-ui": "0.6.10-main.3cfcc89",
119
+ "@dxos/react-ui-mosaic": "0.6.10-main.3cfcc89",
120
+ "@dxos/react-ui-theme": "0.6.10-main.3cfcc89"
116
121
  },
117
122
  "publishConfig": {
118
123
  "access": "public"
@@ -3,6 +3,8 @@
3
3
  //
4
4
 
5
5
  import { Code, type IconProps } from '@phosphor-icons/react';
6
+ // @ts-ignore
7
+ import wasmUrl from 'esbuild-wasm/esbuild.wasm?url';
6
8
  import React from 'react';
7
9
 
8
10
  import { parseIntentPlugin, type PluginDefinition, resolvePlugin, NavigationAction } from '@dxos/app-framework';
@@ -13,19 +15,35 @@ import { TextType } from '@dxos/plugin-markdown/types';
13
15
  import { SpaceAction } from '@dxos/plugin-space';
14
16
  import { loadObjectReferences } from '@dxos/react-client/echo';
15
17
 
18
+ import { initializeBundler } from './bundler';
19
+ import { Compiler } from './compiler';
16
20
  import { ScriptEditor } from './components';
17
21
  import meta, { SCRIPT_PLUGIN } from './meta';
18
22
  import translations from './translations';
19
23
  import { FunctionType, ScriptType } from './types';
20
24
  import { ScriptAction, type ScriptPluginProvides } from './types';
21
25
 
22
- export type ScriptPluginProps = {
23
- containerUrl: string;
24
- };
26
+ export const ScriptPlugin = (): PluginDefinition<ScriptPluginProvides> => {
27
+ const compiler = new Compiler();
25
28
 
26
- export const ScriptPlugin = ({ containerUrl }: ScriptPluginProps): PluginDefinition<ScriptPluginProvides> => {
27
29
  return {
28
30
  meta,
31
+ initialize: async () => {
32
+ await compiler.initialize();
33
+ // TODO(wittjosiah): Fetch types for https modules.
34
+ compiler.setFile('/src/typings.d.ts', "declare module 'https://*';");
35
+ // TODO(wittjosiah): Proper function handler types.
36
+ // TODO(wittjosiah): Remove.
37
+ compiler.setFile(
38
+ '/src/runtime.ts',
39
+ `
40
+ export const Filter: any = {};
41
+ export type FunctionHandler = ({ event, context }: { event: any; context: any }) => Promise<Response>;
42
+ export const functionHandler = (handler: FunctionHandler) => handler;
43
+ `,
44
+ );
45
+ await initializeBundler({ wasmUrl });
46
+ },
29
47
  provides: {
30
48
  metadata: {
31
49
  records: {
@@ -104,7 +122,7 @@ export const ScriptPlugin = ({ containerUrl }: ScriptPluginProps): PluginDefinit
104
122
  }
105
123
 
106
124
  if (data.object instanceof ScriptType) {
107
- return <ScriptEditor script={data.object} role={role} />;
125
+ return <ScriptEditor env={compiler.environment} script={data.object} role={role} />;
108
126
  }
109
127
 
110
128
  return null;
@@ -125,10 +143,11 @@ export const ScriptPlugin = ({ containerUrl }: ScriptPluginProps): PluginDefinit
125
143
 
126
144
  // TODO(burdon): Import.
127
145
  const example = [
128
- 'export default {',
129
- ' async fetch(request, env, ctx) {',
130
- " return new Response('Hello World, from ScriptPlugin!');",
131
- ' }',
132
- '}',
146
+ 'export default async ({ ',
147
+ ' event: { data: { request } },',
148
+ ' context: { space, ai } ',
149
+ '}) => {',
150
+ " return new Response('Hello World, from ScriptPlugin!');",
151
+ '};',
133
152
  '',
134
153
  ].join('\n');