@sheetxl/scripting 0.8.0-beta.9 → 1.0.0
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/browser/esm/BidIa4lARdYGHm03.mjs +4017 -0
- package/{node/esm/byRhqE863Yd8YyB5.mjs → browser/esm/CUERvTrIURHqOWKm.mjs} +281 -282
- package/browser/esm/{8IBYT7vkExASLJms.mjs → CwhaPB7R93eqixfq.mjs} +2 -2
- package/browser/esm/{DJmAxtGDsADOLRhd.mjs → DMYFyfVN7tu3bUMi.mjs} +1 -1
- package/browser/esm/DfSFyaySrD6y1NJY.mjs +17 -0
- package/browser/esm/index.mjs +3 -3
- package/node/esm/{DlnqsBJLAzuuPNOx.mjs → 2OiXgLd8VwO6IeDg.mjs} +1 -1
- package/node/esm/{Bj3F3BUcrLYUg3Dv.mjs → BDIcVjo-h3KFdXXo.mjs} +1 -1
- package/node/esm/BLO91PRuOQIsW_Ow.mjs +580 -0
- package/node/esm/index.mjs +9 -9
- package/node/esm/{Dp_cerCAQ8jL3dyP.mjs → oWHIRxwwLexnOwAn.mjs} +1 -1
- package/package.json +12 -8
- package/types/src/type/CompileOptions.d.ts +1 -1
- 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/12MLcWR439OVCXwt.cjs +0 -1
- 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/D5np5QScDyDDD_WJ.cjs +0 -1
- package/browser/cjs/DLi7EA_dfez5uwwY.cjs +0 -1
- package/browser/cjs/DcxyEv9XIOa5qfCm.cjs +0 -1
- package/browser/cjs/ZKJrH74dcPwEAgmF.cjs +0 -7
- package/browser/cjs/Zvz3TLLPKgPcJHB4.cjs +0 -3703
- package/browser/cjs/index.cjs +0 -1
- package/browser/cjs/stpzUglP-nPdX-Zi.cjs +0 -29
- package/browser/esm/B73J41HhbJvswDz1.mjs +0 -17
- package/browser/esm/BXhWTnlrRShaRGS5.mjs +0 -581
- package/browser/esm/ChXuG8IaqC3qeOH3.mjs +0 -3774
package/browser/cjs/index.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./C83wXnFq94exmYt9.cjs"),c=require("./Bn3oEXST6uP5oPU2.cjs");let m=require("@sheetxl/utils");var w=s.__exportAll({RUN_INTERRUPTED:()=>a,abort:()=>v,check:()=>g,isInterrupted:()=>b,release:()=>C}),o=new Map,y=256,h=16,a="RunInterrupted";function d(e){const t=new Error(e);return t.name=a,t}function p(e){let t=o.get(e);if(!t){if(o.size>=y){const n=o.keys().next().value;n!==void 0&&o.delete(n)}t={started:Date.now(),calls:0,stopped:null},o.set(e,t)}return t}function g(e,t){const n=p(e);if(n.stopped)throw n.stopped;if(++n.calls%h===0&&Date.now()-n.started>t)throw n.stopped=d(`Run stopped: it exceeded the ${Math.round(t/1e3)} s time limit.`),n.stopped}function v(e,t="Run cancelled."){p(e).stopped=d(t)}function C(e){o.delete(e)}function b(e){return e?.name===a}var u=null,l=null,r=null,i=null;async function P(){return i||(i=(async()=>{const e=await(await Promise.resolve().then(()=>require("./D5np5QScDyDDD_WJ.cjs"))).initialize();if(!e)throw new Error("TypeScript could not be loaded. Check your connection and try again.");return e})()).catch(()=>{i=null}),i}var q=Object.freeze({compile:async function(e){if(!e?.source)return{module:null,diagnostics:[]};if(l&&m.CommonUtils.deepEqual(l,e))return u;const t=await(await(async function(){if(r)return r;const{TypeScriptCompiler:n}=await Promise.resolve().then(()=>require("./12MLcWR439OVCXwt.cjs"));return r=new n})()).compileModule(e);return u=t,l=e,t},lint:async function(e,t){if(!e)return[];const[n,{lintScript:f}]=await Promise.all([P(),Promise.resolve().then(()=>require("./ZKJrH74dcPwEAgmF.cjs"))]);return f(n,e,t)},cleanup:function(){r&&(r.terminate(),r=null,u=null)}});Object.defineProperty(exports,"Constants",{enumerable:!0,get:function(){return s.Constants_exports}}),exports.DiagnosticCode=c.DiagnosticCode,exports.DocTags=c.DocTags,Object.defineProperty(exports,"RunGuard",{enumerable:!0,get:function(){return w}}),exports.ScriptCompiler=q,exports.loadCompiledModule=async function(e,t){const{loadCompiledModule:n}=await Promise.resolve().then(()=>require("./B6RS19boKbA_QGQ6.cjs"));return n(e,t)};
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
const w=require("./C83wXnFq94exmYt9.cjs"),W=require("./Bn3oEXST6uP5oPU2.cjs"),U=require("./ZKJrH74dcPwEAgmF.cjs"),D=require("./DLi7EA_dfez5uwwY.cjs");let J=require("@sheetxl/utils");var g=null,v=null,K={compilerOptions:{target:"esnext"}};async function Q(t,m,p="/script.js",u=w.GLOBAL_CONTEXT_VARIABLE,i=!1){try{const d=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 n,o;v=new Promise((r,l)=>{n=r,o=l});try{const{initialize:r}=await Promise.resolve().then(()=>require("./DcxyEv9XIOa5qfCm.cjs"));return g=await r(),n(),g}catch(r){throw console.error("Failed to import or initialize esbuild:",r),v=null,o(r),r}})(),c="@sheetxl/primitives",s=`
|
|
2
|
-
export const FormulaContext = globalThis.${u}?.FormulaContext;
|
|
3
|
-
export const ScalarType = globalThis.${u}?.ScalarType;
|
|
4
|
-
export const Observable = globalThis.${u}?.Observable;
|
|
5
|
-
export const IRange = globalThis.${u}?.IRange;
|
|
6
|
-
export const FormulaError = globalThis.${u}?.FormulaError;
|
|
7
|
-
// Add more exports as needed
|
|
8
|
-
`,a=await d.build({entryPoints:[p],bundle:!0,write:!1,format:"esm",plugins:[{name:"sheetxl-esbuild-in-memory",setup(n){const o="sheetxl-"+new Date().getTime();n.onResolve({filter:new RegExp(`^(${p.replace("/","\\/")}|${c})$`)},r=>({path:r.path,namespace:o})),n.onResolve({filter:/.*/},r=>{if(r.namespace!==o)return console.warn(`esbuild: Treating import "${r.path}" as external.`),{path:r.path,external:!0}}),n.onLoad({filter:/.*/,namespace:o},r=>{let l;if(r.path===p)l=m;else{if(r.path!==c)return{errors:[{text:`Cannot load unknown path in ${o}: ${r.path}`}]};l=s}return{contents:l,loader:"ts"}})}}],sourcemap:"inline",tsconfigRaw:K,minify:i,platform:"neutral"});if(a.outputFiles&&a.outputFiles.length>0)return a.outputFiles[0].text;throw a.errors&&a.errors.length>0?new Error(`esbuild bundling failed: ${a.errors.map(n=>n.text).join(`
|
|
9
|
-
`)}`):new Error("esbuild did not produce an output file.")}catch(d){throw console.error("esbuild bundling process failed:",d),d}}function H(t,m,p){return u=>{const i=u.factory,d=()=>i.createExpressionStatement(i.createCallChain(i.createPropertyAccessExpression(i.createIdentifier(w.GLOBAL_CONTEXT_VARIABLE),"checkRun"),i.createToken(t.SyntaxKind.QuestionDotToken),void 0,[i.createStringLiteral(m),i.createNumericLiteral(p)])),c=a=>{const n=a.statements;let o=0;for(;o<n.length&&t.isExpressionStatement(n[o])&&t.isStringLiteral(n[o].expression);)o++;return i.updateBlock(a,[...n.slice(0,o),d(),...n.slice(o)])},s=a=>{if((n=>t.isForStatement(n)||t.isForInStatement(n)||t.isForOfStatement(n)||t.isWhileStatement(n)||t.isDoStatement(n))(a)){const n=a.statement;return t.visitEachChild(a,o=>{const r=s(o);return o===n?(l=r,t.isBlock(l)?c(l):i.createBlock([d(),l],!0)):r;var l},u)}if(t.isFunctionLike(a)&&a.body){const n=a.body;return t.visitEachChild(a,o=>{const r=s(o);return o===n?(l=r,t.isBlock(l)?c(l):i.createBlock([d(),i.createReturnStatement(l)],!0)):r;var l},u)}return t.visitEachChild(a,s,u)};return a=>t.visitNode(a,s)}}var Y=async()=>`
|
|
10
|
-
interface FirstTest {
|
|
11
|
-
isTrue?: boolean;
|
|
12
|
-
}
|
|
13
|
-
`,T=null,R="sheetxl.d.ts",P="sheetxl-modules.d.ts",Z=["lib.webworker.d.ts","lib.es2020.d.ts","lib.esnext.asynciterable.d.ts"],N=new Map,A=null,I=null;async function ee(){return I||(I=Promise.resolve().then(()=>require("./D5np5QScDyDDD_WJ.cjs")).then(async t=>{const m=await M();return t.readLibFile(m,"lib.es5.d.ts")!==void 0?t.readLibFile:null})),I}async function M(){if(T)return T;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 T=null,t}finally{T=null}}exports.compileModule=async function(t){const m=t?.source??null;if(!m)return{module:null,diagnostics:[]};const p=(t.disableBundle||t.declarationsOnly)??!1,[u,i,d]=await Promise.all([Y(),M(),t.ambientTypes?ee():null]),c=d?t.ambientTypes??null:null;let s="";const a={allowJs:!0,declaration:!1,sourceMap:!1,inlineSourceMap:!1,inlineSources:!1,isolatedModules:!0,preserveConstEnums:!1,module:99,noResolve:!0,emitDeclarationOnly:!1,target:i.ScriptTarget.ES2020,...c?{lib:Z,skipLibCheck:!0,strict:!0}:{}},n="script",o=`${n}.ts`,r="lib.d.ts",l="global.d.ts",h={[o]:m,[r]:`
|
|
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
|
-
`,[l]:u,...c?{[R]:c,[P]:`declare module '@sheetxl/primitives' { export = SheetXL; }
|
|
27
|
-
`}:{}},x=e=>h[e]??(d&&e.startsWith("lib.")?d(i,e):void 0),_={getSourceFile:(e,k,te,ie)=>{if(e===R)return A?.text!==c&&(A={text:c,file:i.createSourceFile(e,c,i.ScriptTarget.Latest,!1)}),A.file;if(h[e]===void 0){let y=N.get(e);if(!y){const $=x(e);if($===void 0)return;y=i.createSourceFile(e,$,i.ScriptTarget.Latest,!1),N.set(e,y)}return y}return i.createSourceFile(e,h[e],i.ScriptTarget.Latest,!0)},fileExists:e=>x(e)!==void 0,readFile:x,writeFile:(e,k)=>{h[e]=k},getCurrentDirectory:()=>"./",getCanonicalFileName:e=>e,useCaseSensitiveFileNames:()=>!0,getDefaultLibFileName:e=>r,getNewLine:()=>`
|
|
28
|
-
`},f=i.createProgram([o,l,...c?[R,P]:[]],a,_),q=f.getTypeChecker(),S=f.getSourceFile(o),E=t.runGuard;f.emit(void 0,void 0,void 0,void 0,E?{before:[H(i,E.key,E.timeoutMs)]}:void 0),s=h[`${n}.js`]??"";const B=e=>({start:e.start??0,length:e.length??0,severity:e.category===i.DiagnosticCategory.Warning?"warning":"error",code:`TS${e.code}`,message:i.flattenDiagnosticMessageText(e.messageText,`
|
|
29
|
-
`)}),j=f.getSyntacticDiagnostics(S).map(B),z=c?f.getSemanticDiagnostics(S).filter(e=>e.category===i.DiagnosticCategory.Error||e.category===i.DiagnosticCategory.Warning).map(B):[],F=U.analyzeModule(i,S,q,{builtInNames:t.builtInNames,isBuiltIn:t.isBuiltIn,lenient:t.lenient});let b=[...j,...z,...F.diagnostics];t.lenient&&(b=b.filter(e=>e.code!==W.DiagnosticCode.MissingType));const G=F.functions,O=F.autoRun,V=b.some(e=>e.severity==="error"),X=`${J.CommonUtils.uuidV4()}-script`;let C=null;if(V)s="";else{try{p||(s=await Q(0,s,n,void 0,t.minify??!1))}catch{console.warn("Error bundling script")}const e=s.indexOf(D.SOURCEMAP_IDENTIFIER);e>-1&&(C=s.substring(e+D.SOURCEMAP_IDENTIFIER.length+1,s.length),s=s.substring(0,e),s=s.replaceAll("globalThis."+w.GLOBAL_CONTEXT_VARIABLE,w.GLOBAL_CONTEXT_VARIABLE))}const L={functions:G,commitId:X,source:m,language:"typescript",compiled:s};return C&&(L.sourceMap=C),O&&(L.autoRun=O),{module:L,diagnostics:b}};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
var i = 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." }], r = (() => {
|
|
2
|
-
const n = /* @__PURE__ */ new Map();
|
|
3
|
-
for (const e of a) if (n.set(e.name, e), e.aliases) for (const t of e.aliases) n.set(t, e);
|
|
4
|
-
return n;
|
|
5
|
-
})();
|
|
6
|
-
function o(n) {
|
|
7
|
-
return (function(e) {
|
|
8
|
-
if (!e) return;
|
|
9
|
-
const t = (e.startsWith("@") ? e.slice(1) : e).toLowerCase();
|
|
10
|
-
return r.get(t);
|
|
11
|
-
})(n)?.standalone === !0;
|
|
12
|
-
}
|
|
13
|
-
export {
|
|
14
|
-
o as n,
|
|
15
|
-
i as r,
|
|
16
|
-
a as t
|
|
17
|
-
};
|