@sheetxl/scripting 0.7.21 → 0.7.23-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (117) hide show
  1. package/README.md +208 -229
  2. package/browser/cjs/1_xhnTjP6m5oj6za.cjs +21 -0
  3. package/browser/cjs/6XTQ1BNSLrTHmFNH.cjs +1 -0
  4. package/browser/cjs/Bu4cZ8iSZ3rij-oV.cjs +1 -0
  5. package/browser/cjs/BvG8N7G_8CXIAlT-.cjs +1 -0
  6. package/browser/cjs/C_7w8EJZpHw8ueuq.cjs +1 -0
  7. package/browser/cjs/C_IEgjM-hSJCv6Gm.cjs +1 -0
  8. package/browser/cjs/CctaCN_w3o34V9AR.cjs +1 -0
  9. package/browser/cjs/DSEShe7kGtxvljOr.cjs +1 -0
  10. package/browser/cjs/GBmIbvhpXGNyZh4W.cjs +1 -0
  11. package/browser/cjs/index.cjs +1 -6
  12. package/browser/cjs/qWYyYsBboXc9p0Lw.cjs +7 -0
  13. package/browser/esm/B2O6_lZVwu7HGlcx.mjs +8 -0
  14. package/browser/esm/B7Axspg8vBnT9M3x.mjs +421 -0
  15. package/browser/esm/BVMNJQoqhXCkbrAc.mjs +87 -0
  16. package/browser/esm/BX3qwglupa6Y59lz.mjs +27 -0
  17. package/browser/esm/C1gdnq2DZdt3y7zD.mjs +23 -0
  18. package/browser/esm/CD2q23uuB7okp3Dl.mjs +152 -0
  19. package/browser/esm/CabN_0aQQRRyMDbw.mjs +12 -0
  20. package/browser/esm/D8K5BUCHuJ9gEpKs.mjs +105 -0
  21. package/browser/esm/DYjJCR6wkeLLkRm6.mjs +15 -0
  22. package/browser/esm/Qyh7uNkqdCcPtgBO.mjs +25 -0
  23. package/browser/esm/index.mjs +40 -20
  24. package/node/esm/47V_H-QS1YIyY07o.mjs +14 -0
  25. package/node/esm/B2O6_lZVwu7HGlcx.mjs +8 -0
  26. package/node/esm/CFY3Dm5Wl-fatf70.mjs +421 -0
  27. package/node/esm/CPB_iNIWuPOW5OPJ.mjs +152 -0
  28. package/node/esm/CaKTS-uKPFUYE8z9.mjs +27 -0
  29. package/node/esm/DGA9ykmJTQwzArFh.mjs +17 -0
  30. package/node/esm/DXc-q9b4X6dKKFs-.mjs +12 -0
  31. package/node/esm/index.mjs +144 -20
  32. package/node/esm/jw7wu0yKXfqYBchM.mjs +23 -0
  33. package/package.json +11 -8
  34. package/types/index.d.ts +2 -165
  35. package/types/src/ScriptCompiler.d.ts +40 -0
  36. package/types/src/ScriptCompiler.d.ts.map +1 -0
  37. package/types/src/compiler/Bundler.d.ts +7 -0
  38. package/types/src/compiler/Bundler.d.ts.map +1 -0
  39. package/types/src/compiler/TypescriptCompiler.d.ts +27 -0
  40. package/types/src/compiler/TypescriptCompiler.d.ts.map +1 -0
  41. package/types/src/compiler/TypescriptCompiler.impl.d.ts +17 -0
  42. package/types/src/compiler/TypescriptCompiler.impl.d.ts.map +1 -0
  43. package/types/src/compiler/TypescriptCompiler.worker.d.ts +2 -0
  44. package/types/src/compiler/TypescriptCompiler.worker.d.ts.map +1 -0
  45. package/types/src/compiler/compiler.browser.d.ts +8 -0
  46. package/types/src/compiler/compiler.browser.d.ts.map +1 -0
  47. package/types/src/compiler/compiler.node.d.ts +14 -0
  48. package/types/src/compiler/compiler.node.d.ts.map +1 -0
  49. package/types/src/compiler/constants.d.ts +10 -0
  50. package/types/src/compiler/constants.d.ts.map +1 -0
  51. package/types/src/compiler/insertYieldBetweenStatements.d.ts +5 -0
  52. package/types/src/compiler/insertYieldBetweenStatements.d.ts.map +1 -0
  53. package/types/src/compiler/transformAwaitToYield.d.ts +6 -0
  54. package/types/src/compiler/transformAwaitToYield.d.ts.map +1 -0
  55. package/types/src/index.d.ts +7 -0
  56. package/types/src/index.d.ts.map +1 -0
  57. package/types/src/lib/esbuild/esbuild.browser.d.ts +4 -0
  58. package/types/src/lib/esbuild/esbuild.browser.d.ts.map +1 -0
  59. package/types/src/lib/esbuild/esbuild.node.d.ts +11 -0
  60. package/types/src/lib/esbuild/esbuild.node.d.ts.map +1 -0
  61. package/types/src/lib/typescript/typescript.browser.d.ts +4 -0
  62. package/types/src/lib/typescript/typescript.browser.d.ts.map +1 -0
  63. package/types/src/lib/typescript/typescript.node.d.ts +4 -0
  64. package/types/src/lib/typescript/typescript.node.d.ts.map +1 -0
  65. package/types/src/linter/Linter.d.ts +63 -0
  66. package/types/src/linter/Linter.d.ts.map +1 -0
  67. package/types/src/linter/index.d.ts +2 -0
  68. package/types/src/linter/index.d.ts.map +1 -0
  69. package/types/src/loader/index.d.ts +2 -0
  70. package/types/src/loader/index.d.ts.map +1 -0
  71. package/types/src/loader/loadCompiledModule.d.ts +19 -0
  72. package/types/src/loader/loadCompiledModule.d.ts.map +1 -0
  73. package/types/src/loader/moduleLoader.browser.d.ts +11 -0
  74. package/types/src/loader/moduleLoader.browser.d.ts.map +1 -0
  75. package/types/src/loader/moduleLoader.node.d.ts +15 -0
  76. package/types/src/loader/moduleLoader.node.d.ts.map +1 -0
  77. package/types/src/plugin/generate.d.ts +17 -0
  78. package/types/src/plugin/generate.d.ts.map +1 -0
  79. package/types/src/plugin/vite.d.ts +24 -0
  80. package/types/src/plugin/vite.d.ts.map +1 -0
  81. package/types/src/runtime/Constants.d.ts +9 -0
  82. package/types/src/runtime/Constants.d.ts.map +1 -0
  83. package/types/src/runtime/index.d.ts +2 -0
  84. package/types/src/runtime/index.d.ts.map +1 -0
  85. package/types/src/tags/DocTags.d.ts +46 -0
  86. package/types/src/tags/DocTags.d.ts.map +1 -0
  87. package/types/src/tags/index.d.ts +2 -0
  88. package/types/src/tags/index.d.ts.map +1 -0
  89. package/types/src/type/CompileOptions.d.ts +58 -0
  90. package/types/src/type/CompileOptions.d.ts.map +1 -0
  91. package/types/src/type/CompiledModule.d.ts +70 -0
  92. package/types/src/type/CompiledModule.d.ts.map +1 -0
  93. package/types/src/type/Diagnostic.d.ts +120 -0
  94. package/types/src/type/Diagnostic.d.ts.map +1 -0
  95. package/types/src/type/Types.d.ts +72 -0
  96. package/types/src/type/Types.d.ts.map +1 -0
  97. package/types/src/type/index.d.ts +6 -0
  98. package/types/src/type/index.d.ts.map +1 -0
  99. package/types/src/worker/WorkerWrapper.d.ts +44 -0
  100. package/types/src/worker/WorkerWrapper.d.ts.map +1 -0
  101. package/types/src/worker/index.d.ts +2 -0
  102. package/types/src/worker/index.d.ts.map +1 -0
  103. package/browser/cjs/B0y4r3JJPPSwiDzx.cjs +0 -6
  104. package/browser/cjs/CGLLj80MYA2hDUWX.cjs +0 -1512
  105. package/browser/cjs/CTIIZ0KnyksL075e.cjs +0 -32
  106. package/browser/cjs/CUcC81sgg70TCSkb.cjs +0 -6
  107. package/browser/cjs/DR9eQnRTjdCvZ_vn.cjs +0 -6
  108. package/browser/esm/C3Kam_ffnenXH9Ry.mjs +0 -264
  109. package/browser/esm/CWnC_tpttjXTMAYH.mjs +0 -29
  110. package/browser/esm/D9QqdtRf0J6jc-i7.mjs +0 -21
  111. package/browser/esm/Dfs-JW1Cpyj6GJ8P.mjs +0 -1587
  112. package/browser/esm/DpMJmUGhnNbeI2fN.mjs +0 -24
  113. package/node/esm/Bk7d3p9VfcJCsNVL.mjs +0 -264
  114. package/node/esm/CLf-vRuFGkk8X4S9.mjs +0 -29
  115. package/node/esm/CQR30SbeLa27Szfg.mjs +0 -1587
  116. package/node/esm/DL3QM-qR0v00NdZZ.mjs +0 -16
  117. package/node/esm/u4BUV-OpkSGdvi-w.mjs +0 -14
@@ -0,0 +1,72 @@
1
+ import { IFunction, ScalarType, Scalar, IFormulaContext } from '@sheetxl/primitives';
2
+ /**
3
+ * Type for bind signature for typed functions.
4
+ */
5
+ export interface FunctionBinder {
6
+ (mapBind: Map<string, IFunction>, getContext: () => IFormulaContext, implementations: Implementations, declarations: MinifiedDeclarations, getDynamicDescriptors?: DynamicDescriptors, defaultCategory?: string): void;
7
+ }
8
+ /**
9
+ * The default export of a compiled formula module (produced by the FormulaCompiler): given the
10
+ * runtime `getContext` and a {@link FunctionBinder}, it binds its functions into `mapBind` (creating
11
+ * one if omitted) and returns it. This is the unit of formula registration - a consumer passes their
12
+ * compiled module's default export to register custom functions.
13
+ */
14
+ export interface FunctionProvider {
15
+ (getContext: () => IFormulaContext, bindFn: FunctionBinder, mapBind?: Map<string, IFunction>): Map<string, IFunction>;
16
+ }
17
+ /**
18
+ * Minified value.
19
+ */
20
+ export interface MinifiedValue {
21
+ s?: string;
22
+ r?: 'p' | 'r' | 'm' | '*';
23
+ l?: ScalarType | '*' | 'raw';
24
+ a?: number;
25
+ d?: number;
26
+ }
27
+ /**
28
+ * Minified params.
29
+ */
30
+ export interface MinifiedParameter extends MinifiedValue {
31
+ n: string;
32
+ m?: '?' | '...';
33
+ e?: string[];
34
+ o?: 'accept' | 'accept-ref';
35
+ g?: MinifiedParameter[];
36
+ v?: Scalar;
37
+ u?: 1;
38
+ w?: Scalar;
39
+ }
40
+ /**
41
+ * The function declaration needed to autoMarshall and execute.
42
+ */
43
+ export interface MinifiedDeclaration {
44
+ fn?: string;
45
+ c?: boolean;
46
+ p?: MinifiedParameter[];
47
+ r?: MinifiedValue;
48
+ }
49
+ /**
50
+ * The descriptor used for a function
51
+ */
52
+ export interface MinifiedDescriptor {
53
+ s?: string;
54
+ c?: string;
55
+ p?: Record<string, any>;
56
+ h?: string | boolean;
57
+ l?: [url: string, text?: string][];
58
+ }
59
+ export type MinifiedDeclarations = {
60
+ [name: string]: MinifiedDeclaration;
61
+ };
62
+ export interface Implementations {
63
+ [functionName: string]: (...args: any) => any;
64
+ }
65
+ export interface MinifiedDescriptors {
66
+ [name: string]: MinifiedDescriptor;
67
+ }
68
+ export interface DescriptorModule {
69
+ default: MinifiedDescriptors;
70
+ }
71
+ export type DynamicDescriptors = () => Promise<DescriptorModule>;
72
+ //# sourceMappingURL=Types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Types.d.ts","sourceRoot":"","sources":["../../../../src/type/Types.ts"],"names":[],"mappings":"AAAA,OAA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,MAAM,CAAC;CACZ;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,EAAE,CAAC,EAAE,MAAM,CAAC;IAEZ,CAAC,CAAC,EAAE,OAAO,CAAC;IACZ,CAAC,CAAC,EAAE,iBAAiB,EAAE,CAAC;IACxB,CAAC,CAAC,EAAE,aAAa,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,CAAC,CAAC,EAAE,MAAM,CAAC;IAEX,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,CAAC,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAExB,CAAC,CAAC,EAAE,MAAM,GAAC,OAAO,CAAC;IACnB,CAAC,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,EAAE,CAAC;CACpC;AAED,MAAM,MAAM,oBAAoB,GAAG;IACjC,CAAC,IAAI,EAAE,MAAM,GAAG,mBAAmB,CAAC;CACrC,CAAA;AAED,MAAM,WAAW,eAAe;IAC9B,CAAC,YAAY,EAAE,MAAM,GAAG,CAAC,GAAG,IAAI,EAAE,GAAG,KAAK,GAAG,CAAC;CAC/C;AAED,MAAM,WAAW,mBAAmB;IAClC,CAAC,IAAI,EAAE,MAAM,GAAG,kBAAkB,CAAC;CACpC;AAGD,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,mBAAmB,CAAC;CAC9B;AAGD,MAAM,MAAM,kBAAkB,GAAG,MAAM,OAAO,CAAC,gBAAgB,CAAC,CAAC"}
@@ -0,0 +1,6 @@
1
+ export type * from './Types';
2
+ export type * from './CompileOptions';
3
+ export type * from './CompiledModule';
4
+ export type { Diagnostic, DiagnosticSeverity } from './Diagnostic';
5
+ export { DiagnosticCode } from './Diagnostic';
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/type/index.ts"],"names":[],"mappings":"AAAA,mBAAmB,SAAS,CAAC;AAE7B,mBAAmB,kBAAkB,CAAC;AACtC,mBAAmB,kBAAkB,CAAC;AACtC,YAAY,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAEnE,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC"}
@@ -0,0 +1,44 @@
1
+ export interface IWorkerWrapper<TResult = any, TParams = any> {
2
+ start(): Promise<void>;
3
+ execute(params: TParams): Promise<TResult>;
4
+ terminate(): void;
5
+ }
6
+ /**
7
+ * Generic worker wrapper for use in libraries
8
+ * Takes a worker factory function to create the worker instance.
9
+ */
10
+ export declare class WorkerWrapper<TResult = any, TParams = any> implements IWorkerWrapper<TResult, TParams> {
11
+ private _worker;
12
+ private _workerFactory;
13
+ private _nextId;
14
+ private _pendingRequests;
15
+ /**
16
+ * Creates a new worker
17
+ *
18
+ * @param workerFactory - Factory function to create the worker instance.
19
+ */
20
+ constructor(workerFactory: () => Worker);
21
+ /**
22
+ * Initializes the worker if it hasn't been created yet
23
+ * Will throw an error if the environment does not support Web Workers.
24
+ */
25
+ start(): Promise<void>;
26
+ /**
27
+ * Executes a task in the worker
28
+ * @param params - Parameters to pass to the worker
29
+ * @returns Promise that resolves with the worker result
30
+ */
31
+ execute(params: TParams): Promise<TResult>;
32
+ /**
33
+ * Terminates the worker
34
+ */
35
+ terminate(): void;
36
+ }
37
+ export declare class SyncWrapper<TResult = any, TParams = any> implements IWorkerWrapper<TResult, TParams> {
38
+ private _onExecute;
39
+ constructor(onExecute: (params: TParams) => Promise<TResult>);
40
+ execute(params: TParams): Promise<TResult>;
41
+ start(): Promise<void>;
42
+ terminate(): void;
43
+ }
44
+ //# sourceMappingURL=WorkerWrapper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WorkerWrapper.d.ts","sourceRoot":"","sources":["../../../../src/worker/WorkerWrapper.ts"],"names":[],"mappings":"AACA,MAAM,WAAW,cAAc,CAAC,OAAO,GAAC,GAAG,EAAE,OAAO,GAAG,GAAG;IACxD,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACvB,OAAO,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAC3C,SAAS,IAAI,IAAI,CAAC;CACnB;AAED;;;GAGG;AACH,qBAAa,aAAa,CAAC,OAAO,GAAG,GAAG,EAAE,OAAO,GAAG,GAAG,CAAE,YAAW,cAAc,CAAC,OAAO,EAAE,OAAO,CAAC;IAClG,OAAO,CAAC,OAAO,CAAuB;IACtC,OAAO,CAAC,cAAc,CAAe;IAErC,OAAO,CAAC,OAAO,CAAK;IACpB,OAAO,CAAC,gBAAgB,CAA6C;IAErE;;;;OAIG;gBACS,aAAa,EAAE,MAAM,MAAM;IAIvC;;;OAGG;IACI,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAuC7B;;;;OAIG;IACH,OAAO,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;IAiB1C;;OAEG;IACH,SAAS,IAAI,IAAI;CAMlB;AAQD,qBAAa,WAAW,CAAC,OAAO,GAAC,GAAG,EAAE,OAAO,GAAG,GAAG,CAAE,YAAW,cAAc,CAAC,OAAO,EAAE,OAAO,CAAC;IAC9F,OAAO,CAAC,UAAU,CAAwC;gBAExD,SAAS,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,OAAO,CAAC,OAAO,CAAC;IAKlD,OAAO,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;IAInC,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAI7B,SAAS,IAAI,IAAI;CAGlB"}
@@ -0,0 +1,2 @@
1
+ export * from './WorkerWrapper';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/worker/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC"}
@@ -1,6 +0,0 @@
1
- "use strict";/**
2
- * @license @sheetxl/scripting - Scripting - Scripting engine for Macros and formulas; includes TypeScript and EsBuild. - v0.7.21
3
- *
4
- * (C) 2025-present SheetXL Inc. & Michael T. Ford
5
- * License: The license can be found at https://www.sheetxl.com/license.
6
- */Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});let e=null;exports.initialize=async function(){return e||(e=new Promise(async(i,l)=>{let t=null;try{t=await import("https://esm.sh/typescript@5.7.2")}catch(r){console.error("Error initializing Browser TypeScript module:",r)}t||console.log("use script fallback"),i(t)}),e)};