@sheetxl/scripting 0.8.0-beta.2 → 0.8.0-beta.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +8 -7
- package/README.md +2 -2
- package/{node/esm/byRhqE863Yd8YyB5.mjs → browser/esm/CUERvTrIURHqOWKm.mjs} +281 -282
- package/browser/esm/CwhaPB7R93eqixfq.mjs +162 -0
- package/browser/esm/DYo_7j0y20wRtntJ.mjs +4012 -0
- package/browser/esm/DfSFyaySrD6y1NJY.mjs +17 -0
- package/browser/esm/{SXQ4A1qlBB6JRAEQ.mjs → Dxfyqtw07s-Dtn7T.mjs} +1 -1
- package/browser/esm/index.mjs +3 -3
- package/node/esm/{DyZ4_kNN_urjQyjU.mjs → 2OiXgLd8VwO6IeDg.mjs} +1 -1
- package/node/esm/BDIcVjo-h3KFdXXo.mjs +161 -0
- package/node/esm/BLO91PRuOQIsW_Ow.mjs +580 -0
- package/node/esm/index.mjs +9 -9
- package/node/esm/{CZo429AzOkBwGTWk.mjs → oWHIRxwwLexnOwAn.mjs} +1 -1
- package/package.json +12 -8
- package/types/src/compiler/Bundler.d.ts +1 -1
- package/types/src/type/CompileOptions.d.ts +12 -9
- package/types/src/type/CompiledModule.d.ts +2 -2
- package/types/src/type/Diagnostic.d.ts +0 -2
- package/types/src/type/Types.d.ts +17 -0
- package/browser/cjs/B6RS19boKbA_QGQ6.cjs +0 -2
- package/browser/cjs/Bn3oEXST6uP5oPU2.cjs +0 -1
- package/browser/cjs/C83wXnFq94exmYt9.cjs +0 -1
- package/browser/cjs/C94szTiUbmNQa9FD.cjs +0 -1
- package/browser/cjs/CUd5aIyyU3_3B_V1.cjs +0 -29
- package/browser/cjs/D5np5QScDyDDD_WJ.cjs +0 -1
- package/browser/cjs/DLi7EA_dfez5uwwY.cjs +0 -1
- package/browser/cjs/DZAweI0sdBfrHzAk.cjs +0 -3747
- package/browser/cjs/DcxyEv9XIOa5qfCm.cjs +0 -1
- package/browser/cjs/ZKJrH74dcPwEAgmF.cjs +0 -7
- package/browser/cjs/index.cjs +0 -1
- package/browser/esm/B73J41HhbJvswDz1.mjs +0 -17
- package/browser/esm/BXhWTnlrRShaRGS5.mjs +0 -581
- package/browser/esm/DP3uAaeZa0hNHrYJ.mjs +0 -3818
- package/browser/esm/zGQXHcrpOlM4m6Nn.mjs +0 -197
- package/node/esm/BRuHQvNZfkRtcqXr.mjs +0 -196
- package/types/src/compiler/relaxForRun.d.ts +0 -8
|
@@ -4,7 +4,7 @@ var t = class {
|
|
|
4
4
|
}
|
|
5
5
|
async getWorkerWrapper() {
|
|
6
6
|
if (this.workerWrapper) return this.workerWrapper;
|
|
7
|
-
const { createCompilerWorker: r } = await import("./
|
|
7
|
+
const { createCompilerWorker: r } = await import("./2OiXgLd8VwO6IeDg.mjs");
|
|
8
8
|
return this.workerWrapper = await r(), this.workerWrapper;
|
|
9
9
|
}
|
|
10
10
|
async compileModule(r) {
|
package/package.json
CHANGED
|
@@ -1,21 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sheetxl/scripting",
|
|
3
3
|
"description": "Scripting - Scripting engine for Macros and formulas; includes TypeScript and EsBuild.",
|
|
4
|
-
"version": "0.8.0-beta.
|
|
5
|
-
"license": "SEE LICENSE IN
|
|
4
|
+
"version": "0.8.0-beta.21",
|
|
5
|
+
"license": "SEE LICENSE IN LICENSE.md",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"exports": {
|
|
8
8
|
".": {
|
|
9
9
|
"types": "./types/index.d.ts",
|
|
10
10
|
"browser": "./browser/esm/index.mjs",
|
|
11
11
|
"node": "./node/esm/index.mjs",
|
|
12
|
-
"
|
|
13
|
-
"require": "./browser/cjs/index.cjs"
|
|
12
|
+
"default": "./browser/esm/index.mjs"
|
|
14
13
|
}
|
|
15
14
|
},
|
|
16
15
|
"types": "./types/index.d.ts",
|
|
17
16
|
"module": "./browser/esm/index.mjs",
|
|
18
|
-
"main": "./browser/
|
|
17
|
+
"main": "./browser/esm/index.mjs",
|
|
19
18
|
"sideEffects": false,
|
|
20
19
|
"engines": {
|
|
21
20
|
"node": ">=22"
|
|
@@ -40,15 +39,20 @@
|
|
|
40
39
|
"scripting"
|
|
41
40
|
],
|
|
42
41
|
"dependencies": {
|
|
43
|
-
"@sheetxl/primitives": "^0.8.0-beta.
|
|
44
|
-
"@sheetxl/utils": "^0.8.0-beta.
|
|
42
|
+
"@sheetxl/primitives": "^0.8.0-beta.21",
|
|
43
|
+
"@sheetxl/utils": "^0.8.0-beta.21"
|
|
45
44
|
},
|
|
46
45
|
"peerDependencies": {
|
|
47
46
|
"esbuild-wasm": ">=0.25.7",
|
|
48
47
|
"typescript": "^5.9.0 || ^6.0.0",
|
|
49
48
|
"vite": "^8.0.0"
|
|
50
49
|
},
|
|
50
|
+
"peerDependenciesMeta": {
|
|
51
|
+
"vite": {
|
|
52
|
+
"optional": true
|
|
53
|
+
}
|
|
54
|
+
},
|
|
51
55
|
"devDependencies": {
|
|
52
|
-
"@types/node": "^26.
|
|
56
|
+
"@types/node": "^26.6.4"
|
|
53
57
|
}
|
|
54
58
|
}
|
|
@@ -3,5 +3,5 @@
|
|
|
3
3
|
* resolving '@sheetxl/primitives' to a framework-controlled implementation.
|
|
4
4
|
* Other imports are treated as external.
|
|
5
5
|
*/
|
|
6
|
-
export declare function bundleScript(ts: typeof import('typescript'), codeAsString: string, entryPointId?: string, globalVariable?: string): Promise<string>;
|
|
6
|
+
export declare function bundleScript(ts: typeof import('typescript'), codeAsString: string, entryPointId?: string, globalVariable?: string, minify?: boolean): Promise<string>;
|
|
7
7
|
//# sourceMappingURL=Bundler.d.ts.map
|
|
@@ -15,6 +15,14 @@ export interface CompileOptions {
|
|
|
15
15
|
* This is useful for validation
|
|
16
16
|
*/
|
|
17
17
|
disableBundle?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* If true, the bundle is minified. For a module that is stored (a workbook's scripts, a `.sxlm`).
|
|
20
|
+
*
|
|
21
|
+
* @remarks
|
|
22
|
+
* Off by default: code that is only run keeps its own names, so a runtime error reads as the
|
|
23
|
+
* author wrote it (`wb.getWorksheet is not a function`, not `a.getWorksheet`).
|
|
24
|
+
*/
|
|
25
|
+
minify?: boolean;
|
|
18
26
|
/**
|
|
19
27
|
* If true, this will not include the source map in the compiled module.
|
|
20
28
|
*/
|
|
@@ -73,16 +81,11 @@ export interface CompileOptions {
|
|
|
73
81
|
* Check the source as code that runs once, not as code kept to be run again.
|
|
74
82
|
*
|
|
75
83
|
* @remarks
|
|
76
|
-
* For an
|
|
77
|
-
*
|
|
78
|
-
*
|
|
79
|
-
* - Annotations are not required: an untyped parameter is `any` (no `noImplicitAny`), and a
|
|
80
|
-
* missing type on an entry is not reported.
|
|
81
|
-
* - A member the receiver does not have, read where a missing member is expected - `r.getFormat?.()`,
|
|
82
|
-
* `r.getFormulas ? … : …`, `typeof r.x` - is a probe, and a warning: it reads `undefined`.
|
|
83
|
-
* - A condition on a function that is never called (TS2774) is a warning.
|
|
84
|
+
* For an ad hoc run (`sheetxl -e`, the MCP `run` tool). Annotations are not required: a default
|
|
85
|
+
* export's untyped first parameter is the script context, and a missing type is not reported.
|
|
84
86
|
*
|
|
85
|
-
*
|
|
87
|
+
* A run is not type-checked before it executes - leave {@link ambientTypes} out. The types are
|
|
88
|
+
* there to explain a run that went wrong, which is `diagnoseRun` in `@sheetxl/runner`.
|
|
86
89
|
*/
|
|
87
90
|
lenient?: boolean;
|
|
88
91
|
}
|
|
@@ -9,7 +9,7 @@ import { IFunction } from '@sheetxl/primitives';
|
|
|
9
9
|
* as `IModule.JSON` in the SDK. Produced by `ScriptCompiler.compile` (Node, which returns
|
|
10
10
|
* it inside a {@link CompileResult} alongside diagnostics) and executed compiler-free via
|
|
11
11
|
* `loadCompiledModule`. Compile diagnostics are NOT part of this artifact — they live on
|
|
12
|
-
* {@link CompileResult}.
|
|
12
|
+
* {@link CompileResult}.
|
|
13
13
|
*/
|
|
14
14
|
export interface CompiledModule {
|
|
15
15
|
/**
|
|
@@ -73,7 +73,7 @@ export interface CompiledModule {
|
|
|
73
73
|
*
|
|
74
74
|
* @remarks
|
|
75
75
|
* There is deliberately no sheet value here. A sheet's modules are stored BY the sheet
|
|
76
|
-
* (`
|
|
76
|
+
* (`IWorksheet.JSON.modules`), so nothing has to name it and a module cannot be left behind pointing
|
|
77
77
|
* at a sheet that no longer exists. This field exists only because a workbook holds both its
|
|
78
78
|
* global modules and its own in one collection, which is the single case nesting cannot express.
|
|
79
79
|
*/
|
|
@@ -70,8 +70,6 @@ export declare const DiagnosticCode: Readonly<{
|
|
|
70
70
|
readonly UntypedArray: "SXL2005";
|
|
71
71
|
/** A generic type must be supplied exactly one type argument. */
|
|
72
72
|
readonly GenericArity: "SXL2006";
|
|
73
|
-
/** A return type cannot combine multiple modifiers (e.g. async + stream). */
|
|
74
|
-
readonly MultipleModifiers: "SXL2007";
|
|
75
73
|
/** A context parameter must be the first parameter. */
|
|
76
74
|
readonly ContextNotFirst: "SXL2010";
|
|
77
75
|
/** More than one `Lambda` parameter. */
|
|
@@ -14,6 +14,22 @@ export interface FunctionBinder {
|
|
|
14
14
|
export interface FunctionProvider {
|
|
15
15
|
(getContext: () => IFormulaContext, bindFn: FunctionBinder, mapBind?: Map<string, IFunction>): Map<string, IFunction>;
|
|
16
16
|
}
|
|
17
|
+
/**
|
|
18
|
+
* One source module's declarations, without its implementations.
|
|
19
|
+
*
|
|
20
|
+
* @remarks
|
|
21
|
+
* A compiled formula package exports a list of these from its `declarations` entry, for a consumer
|
|
22
|
+
* that needs to know what each function accepts and returns (a file format, a linter) but never runs
|
|
23
|
+
* one. Importing it does not load the implementations.
|
|
24
|
+
*/
|
|
25
|
+
export interface FunctionDeclarationModule {
|
|
26
|
+
/** The module's declarations, by function name. */
|
|
27
|
+
declarations: MinifiedDeclarations;
|
|
28
|
+
/** The category the module's functions belong to unless a declaration names its own. */
|
|
29
|
+
category?: string;
|
|
30
|
+
/** The enums the declarations refer to. */
|
|
31
|
+
enums?: MinifiedEnums;
|
|
32
|
+
}
|
|
17
33
|
/**
|
|
18
34
|
* Minified value.
|
|
19
35
|
*/
|
|
@@ -53,6 +69,7 @@ export interface MinifiedDeclaration {
|
|
|
53
69
|
p?: MinifiedParameter[];
|
|
54
70
|
r?: MinifiedValue;
|
|
55
71
|
mx?: number;
|
|
72
|
+
h?: 1;
|
|
56
73
|
}
|
|
57
74
|
/**
|
|
58
75
|
* The descriptor used for a function
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var r=Object.freeze({NoBody:"SXL1001",Anonymous:"SXL1002",ParseError:"SXL1003",InvalidParamType:"SXL2001",InvalidReturnType:"SXL2002",UndefinedInput:"SXL2003",MissingType:"SXL2004",UntypedArray:"SXL2005",GenericArity:"SXL2006",MultipleModifiers:"SXL2007",ContextNotFirst:"SXL2010",MultipleLambda:"SXL2020",LambdaNotLast:"SXL2021",LambdaScalarMismatch:"SXL2022",LambdaReturn:"SXL2023",FunctionReturn:"SXL2024",LambdaArity:"SXL2025",ArrayDepth:"SXL2030",RepeatingPosition:"SXL2040",MultipleRepeating:"SXL2041",RepeatingSlots:"SXL2042",RepeatingOptional:"SXL2043",RepeatingMax:"SXL2044",EnumMixed:"SXL2050",EnumMemberNotConstant:"SXL2051",EnumNotLocal:"SXL2052",EnumMissingAlias:"SXL2053",EnumPosition:"SXL2054",EnumOmittedValue:"SXL2055",NoExports:"SXL3001",UnknownParam:"SXL3002",BuiltInName:"SXL3003",UnknownReturnKind:"SXL3005",InvalidName:"SXL3006",DuplicateName:"SXL3007",MissingSummary:"SXL9001",MissingParamDescription:"SXL9002",MissingReturns:"SXL9003",EnumDuplicateValue:"SXL9004",EnumMemberUndocumented:"SXL9005"}),a=[{name:"param",group:"jsdoc",description:"Document a parameter. A string union type becomes a dropdown of allowed options.",snippet:"param ${1:name} ${2:description}"},{name:"returns",aliases:["return"],group:"jsdoc",description:"Describe the return value."},{name:"category",group:"sheetxl",description:"Group the function under a category in the function list.",snippet:"category ${1:name}"},{name:"name",group:"sheetxl",description:"A name an identifier cannot spell: the name formulas call a function by (MY.FUNC), or an enum member's label.",snippet:"name ${1:NAME}"},{name:"description",group:"sheetxl",description:"A longer description of the function."},{name:"deprecated",group:"sheetxl",standalone:!0,description:"Mark the function as deprecated (optionally with a reason)."},{name:"hidden",group:"sheetxl",standalone:!0,description:"Hide the function from the function list."},{name:"returnkind",group:"sheetxl",description:"Declare the value kind of the return (a ValueKind word, e.g. `number`, `array`, `reference`) where the type spelling cannot say it (a union return collapses to any).",snippet:"returnKind ${1:number}"},{name:"example",group:"jsdoc",description:"Provide a usage example."},{name:"see",group:"jsdoc",description:"Reference a related function or link."}],i=(()=>{const n=new Map;for(const e of a)if(n.set(e.name,e),e.aliases)for(const t of e.aliases)n.set(t,e);return n})();function o(n){return(function(e){if(!e)return;const t=(e.startsWith("@")?e.slice(1):e).toLowerCase();return i.get(t)})(n)?.standalone===!0}Object.defineProperty(exports,"DiagnosticCode",{enumerable:!0,get:function(){return r}}),Object.defineProperty(exports,"DocTags",{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,"isStandaloneJSDocTag",{enumerable:!0,get:function(){return o}});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var n=Object.defineProperty,o=(t,l)=>{let e={};for(var r in t)n(e,r,{get:t[r],enumerable:!0});return l||n(e,Symbol.toStringTag,{value:"Module"}),e},a=o({GLOBAL_CONTEXT_VARIABLE:()=>u}),u="__SHEETXL";Object.defineProperty(exports,"Constants_exports",{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,"GLOBAL_CONTEXT_VARIABLE",{enumerable:!0,get:function(){return u}}),Object.defineProperty(exports,"__exportAll",{enumerable:!0,get:function(){return o}});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
exports.TypeScriptCompiler=class{constructor(r={}){this.workerWrapper=null}async getWorkerWrapper(){if(this.workerWrapper)return this.workerWrapper;const{createCompilerWorker:r}=await Promise.resolve().then(()=>require("./DZAweI0sdBfrHzAk.cjs"));return this.workerWrapper=await r(),this.workerWrapper}async compileModule(r){try{return(await this.getWorkerWrapper()).execute(r)}catch(e){throw console.error("Failed to compile using worker:",e),e}}terminate(){this.workerWrapper?.terminate(),this.workerWrapper=null}};
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
const k=require("./C83wXnFq94exmYt9.cjs"),U=require("./Bn3oEXST6uP5oPU2.cjs"),Q=require("./ZKJrH74dcPwEAgmF.cjs"),N=require("./DLi7EA_dfez5uwwY.cjs");let J=require("@sheetxl/utils");var g=null,v=null,H={compilerOptions:{target:"esnext"}};async function Y(t,d,u="/script.js",c=k.GLOBAL_CONTEXT_VARIABLE){try{const e=await(async function(){if(g)return g;if(v){if(await v,!g)throw new Error("ESBuild initialization promise resolved, but instance is not available.");return g}let r,s;v=new Promise((i,f)=>{r=i,s=f});try{const{initialize:i}=await Promise.resolve().then(()=>require("./DcxyEv9XIOa5qfCm.cjs"));return g=await i(),r(),g}catch(i){throw console.error("Failed to import or initialize esbuild:",i),v=null,s(i),i}})(),a="@sheetxl/primitives",l=`
|
|
2
|
-
export const FormulaContext = globalThis.${c}?.FormulaContext;
|
|
3
|
-
export const ScalarType = globalThis.${c}?.ScalarType;
|
|
4
|
-
export const Observable = globalThis.${c}?.Observable;
|
|
5
|
-
export const IRange = globalThis.${c}?.IRange;
|
|
6
|
-
export const FormulaError = globalThis.${c}?.FormulaError;
|
|
7
|
-
// Add more exports as needed
|
|
8
|
-
`,o=await e.build({entryPoints:[u],bundle:!0,write:!1,format:"esm",plugins:[{name:"sheetxl-esbuild-in-memory",setup(r){const s="sheetxl-"+new Date().getTime();r.onResolve({filter:new RegExp(`^(${u.replace("/","\\/")}|${a})$`)},i=>({path:i.path,namespace:s})),r.onResolve({filter:/.*/},i=>{if(i.namespace!==s)return console.warn(`esbuild: Treating import "${i.path}" as external.`),{path:i.path,external:!0}}),r.onLoad({filter:/.*/,namespace:s},i=>{let f;if(i.path===u)f=d;else{if(i.path!==a)return{errors:[{text:`Cannot load unknown path in ${s}: ${i.path}`}]};f=l}return{contents:f,loader:"ts"}})}}],sourcemap:"inline",tsconfigRaw:H,minify:!0,platform:"neutral"});if(o.outputFiles&&o.outputFiles.length>0)return o.outputFiles[0].text;throw o.errors&&o.errors.length>0?new Error(`esbuild bundling failed: ${o.errors.map(r=>r.text).join(`
|
|
9
|
-
`)}`):new Error("esbuild did not produce an output file.")}catch(e){throw console.error("esbuild bundling process failed:",e),e}}function Z(t,d,u){return c=>{const e=c.factory,a=()=>e.createExpressionStatement(e.createCallChain(e.createPropertyAccessExpression(e.createIdentifier(k.GLOBAL_CONTEXT_VARIABLE),"checkRun"),e.createToken(t.SyntaxKind.QuestionDotToken),void 0,[e.createStringLiteral(d),e.createNumericLiteral(u)])),l=r=>{const s=r.statements;let i=0;for(;i<s.length&&t.isExpressionStatement(s[i])&&t.isStringLiteral(s[i].expression);)i++;return e.updateBlock(r,[...s.slice(0,i),a(),...s.slice(i)])},o=r=>{if((s=>t.isForStatement(s)||t.isForInStatement(s)||t.isForOfStatement(s)||t.isWhileStatement(s)||t.isDoStatement(s))(r)){const s=r.statement;return t.visitEachChild(r,i=>{const f=o(i);return i===s?(m=f,t.isBlock(m)?l(m):e.createBlock([a(),m],!0)):f;var m},c)}if(t.isFunctionLike(r)&&r.body){const s=r.body;return t.visitEachChild(r,i=>{const f=o(i);return i===s?(m=f,t.isBlock(m)?l(m):e.createBlock([a(),e.createReturnStatement(m)],!0)):f;var m},c)}return t.visitEachChild(r,o,c)};return r=>t.visitNode(r,o)}}var ee=new Set(["TS2339","TS2551"]);function te(t,d,u){let c=null;const e=a=>{u<a.getStart(d)||u>=a.end||(a.getStart(d)===u&&(c=a),t.forEachChild(a,e))};return t.forEachChild(d,e),c}function ne(t,d){const u=d.parent;if(!u||!t.isPropertyAccessExpression(u)||u.name!==d)return!1;let c=u,e=u.parent;for(;e&&(t.isParenthesizedExpression(e)||t.isNonNullExpression(e));)c=e,e=e.parent;if(!e)return!1;if((t.isCallExpression(e)||t.isPropertyAccessExpression(e)||t.isElementAccessExpression(e))&&e.expression===c)return!!e.questionDotToken;if(t.isTypeOfExpression(e))return!0;if(t.isPrefixUnaryExpression(e))return e.operator===t.SyntaxKind.ExclamationToken;if(t.isConditionalExpression(e))return e.condition===c;if(t.isIfStatement(e)||t.isWhileStatement(e)||t.isDoStatement(e))return e.expression===c;if(t.isBinaryExpression(e)){const a=e.operatorToken.kind,l=t.SyntaxKind;if(a===l.AmpersandAmpersandToken||a===l.BarBarToken||a===l.QuestionQuestionToken)return e.left===c;if(a===l.EqualsEqualsEqualsToken||a===l.ExclamationEqualsEqualsToken||a===l.EqualsEqualsToken||a===l.ExclamationEqualsToken)return((o,r)=>r.kind===o.SyntaxKind.NullKeyword||o.isIdentifier(r)&&r.text==="undefined")(t,e.left===c?e.right:e.left)}return!1}var ie=async()=>`
|
|
10
|
-
interface FirstTest {
|
|
11
|
-
isTrue?: boolean;
|
|
12
|
-
}
|
|
13
|
-
`,w=null,R="sheetxl.d.ts",$="sheetxl-modules.d.ts",re=["lib.webworker.d.ts","lib.es2020.d.ts","lib.esnext.asynciterable.d.ts"],M=new Map,B=null,P=null;async function oe(){return P||(P=Promise.resolve().then(()=>require("./D5np5QScDyDDD_WJ.cjs")).then(async t=>{const d=await _();return t.readLibFile(d,"lib.es5.d.ts")!==void 0?t.readLibFile:null})),P}async function _(){if(w)return w;try{const t=await(await Promise.resolve().then(()=>require("./D5np5QScDyDDD_WJ.cjs"))).initialize();if(!t)throw new Error("TypeScript could not be loaded. Check your connection and try again.");return t}catch(t){throw w=null,t}finally{w=null}}exports.compileModule=async function(t){const d=t?.source??null;if(!d)return{module:null,diagnostics:[]};const u=(t.disableBundle||t.declarationsOnly)??!1,[c,e,a]=await Promise.all([ie(),_(),t.ambientTypes?oe():null]),l=a?t.ambientTypes??null:null;let o="";const r={allowJs:!0,declaration:!1,sourceMap:!1,inlineSourceMap:!1,inlineSources:!1,isolatedModules:!0,preserveConstEnums:!1,module:99,noResolve:!0,emitDeclarationOnly:!1,target:e.ScriptTarget.ES2020,...l?{lib:re,skipLibCheck:!0,strict:!0}:{},...l&&t.lenient?{noImplicitAny:!1}:{}},s="script",i=`${s}.ts`,f="lib.d.ts",m="global.d.ts",y={[i]:d,[f]:`
|
|
14
|
-
/**
|
|
15
|
-
* Represents the completion of an asynchronous operation
|
|
16
|
-
*/
|
|
17
|
-
interface Promise<T> {
|
|
18
|
-
/**
|
|
19
|
-
* Attaches a callback that is invoked when the Promise is settled (fulfilled or rejected). The
|
|
20
|
-
* resolved value cannot be modified from the callback.
|
|
21
|
-
* @param onfinally The callback to execute when the Promise is settled (fulfilled or rejected).
|
|
22
|
-
* @returns A Promise for the completion of the callback.
|
|
23
|
-
*/
|
|
24
|
-
finally(onfinally?: (() => void) | undefined | null): Promise<T>;
|
|
25
|
-
}
|
|
26
|
-
`,[m]:c,...l?{[R]:l,[$]:`declare module '@sheetxl/primitives' { export = SheetXL; }
|
|
27
|
-
`}:{}},C=n=>y[n]??(a&&n.startsWith("lib.")?a(e,n):void 0),z={getSourceFile:(n,b,D,h)=>{if(n===R)return B?.text!==l&&(B={text:l,file:e.createSourceFile(n,l,e.ScriptTarget.Latest,!1)}),B.file;if(y[n]===void 0){let p=M.get(n);if(!p){const x=C(n);if(x===void 0)return;p=e.createSourceFile(n,x,e.ScriptTarget.Latest,!1),M.set(n,p)}return p}return e.createSourceFile(n,y[n],e.ScriptTarget.Latest,!0)},fileExists:n=>C(n)!==void 0,readFile:C,writeFile:(n,b)=>{y[n]=b},getCurrentDirectory:()=>"./",getCanonicalFileName:n=>n,useCaseSensitiveFileNames:()=>!0,getDefaultLibFileName:n=>f,getNewLine:()=>`
|
|
28
|
-
`},E=e.createProgram([i,m,...l?[R,$]:[]],r,z),j=E.getTypeChecker(),T=E.getSourceFile(i),F=t.runGuard;E.emit(void 0,void 0,void 0,void 0,F?{before:[Z(e,F.key,F.timeoutMs)]}:void 0),o=y[`${s}.js`]??"";const O=n=>({start:n.start??0,length:n.length??0,severity:n.category===e.DiagnosticCategory.Warning?"warning":"error",code:`TS${n.code}`,message:e.flattenDiagnosticMessageText(n.messageText,`
|
|
29
|
-
`)}),G=E.getSyntacticDiagnostics(T).map(O),K=l?E.getSemanticDiagnostics(T).filter(n=>n.category===e.DiagnosticCategory.Error||n.category===e.DiagnosticCategory.Warning).map(O):[],L=Q.analyzeModule(e,T,j,{builtInNames:t.builtInNames,isBuiltIn:t.isBuiltIn,lenient:!!l&&t.lenient});let S=[...G,...K,...L.diagnostics];l&&t.lenient&&(S=(function(n,b,D){const h=[];for(const p of D)if(p.code!==U.DiagnosticCode.MissingType)if(p.severity!=="error")h.push(p);else if(p.code==="TS2774")h.push({...p,severity:"warning"});else if(ee.has(p.code)){const x=te(n,b,p.start);h.push(x&&ne(n,x)?{...p,severity:"warning",message:`${p.message} Read as a probe, it is undefined.`}:p)}else h.push(p);return h})(e,T,S));const V=L.functions,q=L.autoRun,W=S.some(n=>n.severity==="error"),X=`${J.CommonUtils.uuidV4()}-script`;let A=null;if(W)o="";else{try{u||(o=await Y(0,o,s))}catch{console.warn("Error bundling script")}const n=o.indexOf(N.SOURCEMAP_IDENTIFIER);n>-1&&(A=o.substring(n+N.SOURCEMAP_IDENTIFIER.length+1,o.length),o=o.substring(0,n),o=o.replaceAll("globalThis."+k.GLOBAL_CONTEXT_VARIABLE,k.GLOBAL_CONTEXT_VARIABLE))}const I={functions:V,commitId:X,source:d,language:"typescript",compiled:o};return A&&(I.sourceMap=A),q&&(I.autoRun=q),{module:I,diagnostics:S}};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var a=Object.create;var t=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var s=Object.getOwnPropertyNames;var u=Object.getPrototypeOf,p=Object.prototype.hasOwnProperty;var y=(r,i,l,e)=>{if(i&&typeof i=="object"||typeof i=="function")for(let n of s(i))!p.call(r,n)&&n!==l&&t(r,n,{get:()=>i[n],enumerable:!(e=c(i,n))||e.enumerable});return r};var f=(r,i,l)=>(l=r!=null?a(u(r)):{},y(i||!r||!r.__esModule?t(l,"default",{value:r,enumerable:!0}):l,r));var o=null;exports.initialize=async function(){return o||(o=new Promise(async(r,i)=>{let l=null;try{l=await import("https://esm.sh/typescript@5.7.2")}catch(e){console.error("Error initializing Browser TypeScript module:",e)}l||(console.log("use script fallback"),o=null),r(l)}))},exports.readLibFile=function(r,i){};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports,"SOURCEMAP_IDENTIFIER",{enumerable:!0,get:function(){return"//# sourceMappingURL"}});
|