@bluestep-systems/b6p-cli 0.8.1 → 0.8.2
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/CHANGELOG.md +13 -0
- package/README.md +17 -1
- package/dist/cli.js +2 -2
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,19 @@ All notable changes to `@bluestep-systems/b6p-cli` will be documented in this fi
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [0.8.2] — 2026-10-20
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
|
|
12
|
+
- **`b6p pull` no longer stops part-way with `Could not parse upstairs etag`**
|
|
13
|
+
([#35](https://github.com/Bluestep-Systems/b6p-cli/issues/35)). Files last saved on the platform
|
|
14
|
+
before about May 2026 come back with a weak numeric ETag (`W/"<ms>-<id>"`) that the pull didn't
|
|
15
|
+
recognise, so it stopped at the first such file, exited `1`, and never refreshed `declarations/`.
|
|
16
|
+
It now treats those files like other files that carry no content hash: it skips the integrity
|
|
17
|
+
check and keeps going, and the file keeps its push/pull record. Comes from
|
|
18
|
+
[b6p-core 0.8.1](https://github.com/Bluestep-Systems/b6p-core/releases/tag/v0.8.1), now bundled.
|
|
19
|
+
If you used the `.gitignore` workaround from the issue, take the entries out and pull again.
|
|
20
|
+
|
|
8
21
|
## [0.8.1] — 2026-09-29
|
|
9
22
|
|
|
10
23
|
### Fixed
|
package/README.md
CHANGED
|
@@ -59,6 +59,22 @@ clear it with `xattr -d com.apple.quarantine ~/.bluestep/bin/b6p` and make it ex
|
|
|
59
59
|
|
|
60
60
|
The npm install above is unchanged and remains the recommended path wherever Node is available.
|
|
61
61
|
|
|
62
|
+
## Signing in
|
|
63
|
+
|
|
64
|
+
`b6p` signs in with your BlueStep platform access token, which starts with `b6pt_`. It is the same
|
|
65
|
+
token the BlueStep AI tools use for the gateway MCP (`B6PT_TOKEN`), so if you already have one, use it
|
|
66
|
+
here too. To make one: **Tools → Organization Admin → Super → Global Users → Access Tokens → Create
|
|
67
|
+
New Token**.
|
|
68
|
+
|
|
69
|
+
Store it with:
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
b6p auth set
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
If no token is stored, the first command you run asks for it. A `401` with a `b6pt_` token usually
|
|
76
|
+
means the token expired or its account lost access, not that it is the wrong kind of token.
|
|
77
|
+
|
|
62
78
|
## Commands
|
|
63
79
|
|
|
64
80
|
| Command | Purpose |
|
|
@@ -73,7 +89,7 @@ The npm install above is unchanged and remains the recommended path wherever Nod
|
|
|
73
89
|
| `b6p deploy <config.json>` | Multi-target deploy from a config file |
|
|
74
90
|
| `b6p setup --file <path>` | Print the web-UI setup URL for a script |
|
|
75
91
|
| `b6p report` | Report cached state |
|
|
76
|
-
| `b6p auth set` | Store or replace your platform access token (`b6pt_
|
|
92
|
+
| `b6p auth set` | Store or replace your platform access token (`b6pt_…`, see [Signing in](#signing-in)) |
|
|
77
93
|
|
|
78
94
|
Most commands accept `--json` for machine-readable output and `--yes` to answer every question with
|
|
79
95
|
its default (and print what it answered). Run `b6p <command> --help` for full options.
|
package/dist/cli.js
CHANGED
|
@@ -465,7 +465,7 @@ Project '${_.projectName}' (${jA[_.projectKind]}) ${o}
|
|
|
465
465
|
`&&(!_||_.length===0||aat(_,o))){let{lineText:u,absolutePosition:g}=s.textStorage.getAbsolutePositionAndLineText(t.line);if(u&&u.search("\\S")<0){let d=i.getIndentationAtPosition(n,o,c),h=0,S,x;for(S=0,x=u.length;S<x;S++)if(u.charAt(S)===" ")h++;else if(u.charAt(S)===" ")h+=c.tabSize;else break;if(d!==h){let k=g+S;_.push({span:ll(g,k),newText:Ol.getIndentationString(d,c)})}}}if(_)return _.map(u=>({start:s.positionToLineOffset(u.span.start),end:s.positionToLineOffset(Nc(u.span)),newText:u.newText?u.newText:""}))}getCompletions(t,n){let{file:i,project:s}=this.getFileAndProject(t),o=this.projectService.getScriptInfoForNormalizedPath(i),c=this.getPosition(t,o),_=s.getLanguageService().getCompletionsAtPosition(i,c,{...Yde(this.getPreferences(i)),triggerCharacter:t.triggerCharacter,triggerKind:t.triggerKind,includeExternalModuleExports:t.includeExternalModuleExports,includeInsertTextCompletions:t.includeInsertTextCompletions},s.projectService.getFormatCodeOptions(i));if(_===void 0)return;if(n==="completions-full")return _;let u=t.prefix||"",g=Ji(_.entries,h=>{if(_.isMemberCompletion||ms(h.name.toLowerCase(),u.toLowerCase())){let S=h.replacementSpan?Ag(h.replacementSpan,o):void 0;return{...h,replacementSpan:S,hasAction:h.hasAction||void 0,symbol:void 0}}});return n==="completions"?(_.metadata&&(g.metadata=_.metadata),g):{..._,optionalReplacementSpan:_.optionalReplacementSpan&&Ag(_.optionalReplacementSpan,o),entries:g}}getCompletionEntryDetails(t,n){let{file:i,project:s}=this.getFileAndProject(t),o=this.projectService.getScriptInfoForNormalizedPath(i),c=this.getPosition(t,o),_=s.projectService.getFormatCodeOptions(i),u=!!this.getPreferences(i).displayPartsForJSDoc,g=Ji(t.entryNames,d=>{let{name:h,source:S,data:x}=typeof d=="string"?{name:d,source:void 0,data:void 0}:d;return s.getLanguageService().getCompletionEntryDetails(i,c,h,_,S,this.getPreferences(i),x?sa(x,bat):void 0)});return n?u?g:g.map(d=>({...d,tags:this.mapJSDocTagInfo(d.tags,s,!1)})):g.map(d=>({...d,codeActions:Sr(d.codeActions,h=>this.mapCodeAction(h)),documentation:this.mapDisplayParts(d.documentation,s),tags:this.mapJSDocTagInfo(d.tags,s,u)}))}getCompileOnSaveAffectedFileList(t){let n=this.getProjects(t,!0,!0),i=this.projectService.getScriptInfo(t.file);return i?cat(i,s=>this.projectService.getScriptInfoForPath(s),n,(s,o)=>{if(!s.compileOnSaveEnabled||!s.languageServiceEnabled||s.isOrphan())return;let c=s.getCompilationSettings();if(!(c.noEmit||_u(o.fileName)&&!sat(c)))return{projectFileName:s.getProjectName(),fileNames:s.getCompileOnSaveAffectedFileList(o),projectUsesOutFile:!!c.outFile}}):Yl}emitFile(t){let{file:n,project:i}=this.getFileAndProject(t);if(i||Hy.ThrowNoProject(),!i.languageServiceEnabled)return t.richResponse?{emitSkipped:!0,diagnostics:[]}:!1;let s=i.getScriptInfo(n),{emitSkipped:o,diagnostics:c}=i.emitFile(s,(_,u,g)=>this.host.writeFile(_,u,g));return t.richResponse?{emitSkipped:o,diagnostics:t.includeLinePosition?this.convertToDiagnosticsWithLinePositionFromDiagnosticFile(c):c.map(_=>JO(_,!0))}:!o}getSignatureHelpItems(t,n){let{file:i,project:s}=this.getFileAndProject(t),o=this.projectService.getScriptInfoForNormalizedPath(i),c=this.getPosition(t,o),_=s.getLanguageService().getSignatureHelpItems(i,c,t),u=!!this.getPreferences(i).displayPartsForJSDoc;if(_&&n){let g=_.applicableSpan;return{..._,applicableSpan:{start:o.positionToLineOffset(g.start),end:o.positionToLineOffset(g.start+g.length)},items:this.mapSignatureHelpItems(_.items,s,u)}}else return u||!_?_:{..._,items:_.items.map(g=>({...g,tags:this.mapJSDocTagInfo(g.tags,s,!1)}))}}toPendingErrorCheck(t){let n=Oo(t),i=this.projectService.tryGetDefaultProjectForFile(n);return i&&{fileName:n,project:i}}getDiagnostics(t,n,i){this.suppressDiagnosticEvents||i.length>0&&this.updateErrorCheck(t,i,n)}change(t){let n=this.projectService.getScriptInfo(t.file);w.assert(!!n),n.textStorage.switchToScriptVersionCache();let i=n.lineOffsetToPosition(t.line,t.offset),s=n.lineOffsetToPosition(t.endLine,t.endOffset);i>=0&&(this.changeSeq++,this.projectService.applyChangesToFile(n,FS({span:{start:i,length:s-i},newText:t.insertString})))}reload(t){let n=Oo(t.file),i=t.tmpfile===void 0?void 0:Oo(t.tmpfile),s=this.projectService.getScriptInfoForNormalizedPath(n);s&&(this.changeSeq++,s.reloadFromFile(i))}saveToTmp(t,n){let i=this.projectService.getScriptInfo(t);i&&i.saveTo(n)}closeClientFile(t){if(!t)return;let n=ha(t);this.projectService.closeClientFile(n)}mapLocationNavigationBarItems(t,n){return Sr(t,i=>({text:i.text,kind:i.kind,kindModifiers:i.kindModifiers,spans:i.spans.map(s=>Ag(s,n)),childItems:this.mapLocationNavigationBarItems(i.childItems,n),indent:i.indent}))}getNavigationBarItems(t,n){let{file:i,languageService:s}=this.getFileAndLanguageServiceForSyntacticOperation(t),o=s.getNavigationBarItems(i);return o?n?this.mapLocationNavigationBarItems(o,this.projectService.getScriptInfoForNormalizedPath(i)):o:void 0}toLocationNavigationTree(t,n){return{text:t.text,kind:t.kind,kindModifiers:t.kindModifiers,spans:t.spans.map(i=>Ag(i,n)),nameSpan:t.nameSpan&&Ag(t.nameSpan,n),childItems:Sr(t.childItems,i=>this.toLocationNavigationTree(i,n))}}getNavigationTree(t,n){let{file:i,languageService:s}=this.getFileAndLanguageServiceForSyntacticOperation(t),o=s.getNavigationTree(i);return o?n?this.toLocationNavigationTree(o,this.projectService.getScriptInfoForNormalizedPath(i)):o:void 0}getNavigateToItems(t,n){let i=this.getFullNavigateToItems(t);return n?Da(i,({project:s,navigateToItems:o})=>o.map(c=>{let _=s.getScriptInfo(c.fileName),u={name:c.name,kind:c.kind,kindModifiers:c.kindModifiers,isCaseSensitive:c.isCaseSensitive,matchKind:c.matchKind,file:c.fileName,start:_.positionToLineOffset(c.textSpan.start),end:_.positionToLineOffset(Nc(c.textSpan))};return c.kindModifiers&&c.kindModifiers!==""&&(u.kindModifiers=c.kindModifiers),c.containerName&&c.containerName.length>0&&(u.containerName=c.containerName),c.containerKind&&c.containerKind.length>0&&(u.containerKind=c.containerKind),u})):Da(i,({navigateToItems:s})=>s)}getFullNavigateToItems(t){let{currentFileOnly:n,searchValue:i,maxResultCount:s,projectFileName:o}=t;if(n){w.assertIsDefined(t.file);let{file:S,project:x}=this.getFileAndProject(t);return[{project:x,navigateToItems:x.getLanguageService().getNavigateToItems(i,s,S)}]}let c=this.getHostPreferences(),_=[],u=new Map;if(!t.file&&!o)this.projectService.loadAncestorProjectTree(),this.projectService.forEachEnabledProject(S=>g(S));else{let S=this.getProjects(t);q3e(S,void 0,x=>g(x))}return _;function g(S){let x=S.getLanguageService().getNavigateToItems(i,s,void 0,S.isNonTsProject(),c.excludeLibrarySymbolsInNavTo),k=ln(x,P=>d(P)&&!qX(BA(P),S));k.length&&_.push({project:S,navigateToItems:k})}function d(S){let x=S.name;if(!u.has(x))return u.set(x,[S]),!0;let k=u.get(x);for(let P of k)if(h(P,S))return!1;return k.push(S),!0}function h(S,x){return S===x?!0:!S||!x?!1:S.containerKind===x.containerKind&&S.containerName===x.containerName&&S.fileName===x.fileName&&S.isCaseSensitive===x.isCaseSensitive&&S.kind===x.kind&&S.kindModifiers===x.kindModifiers&&S.matchKind===x.matchKind&&S.name===x.name&&S.textSpan.start===x.textSpan.start&&S.textSpan.length===x.textSpan.length}}getSupportedCodeFixes(t){if(!t)return cG();if(t.file){let{file:i,project:s}=this.getFileAndProject(t);return s.getLanguageService().getSupportedCodeFixes(i)}let n=this.getProject(t.projectFileName);return n||Hy.ThrowNoProject(),n.getLanguageService().getSupportedCodeFixes()}isLocation(t){return t.line!==void 0}extractPositionOrRange(t,n){let i,s;return this.isLocation(t)?i=o(t):s=this.getRange(t,n),w.checkDefined(i===void 0?s:i);function o(c){return c.position!==void 0?c.position:n.lineOffsetToPosition(c.line,c.offset)}}getRange(t,n){let{startPosition:i,endPosition:s}=this.getStartAndEndPosition(t,n);return{pos:i,end:s}}getApplicableRefactors(t){let{file:n,project:i}=this.getFileAndProject(t),s=i.getScriptInfoForNormalizedPath(n);return i.getLanguageService().getApplicableRefactors(n,this.extractPositionOrRange(t,s),this.getPreferences(n),t.triggerReason,t.kind,t.includeInteractiveActions).map(c=>({...c,actions:c.actions.map(_=>({..._,range:_.range?{start:rD({line:_.range.start.line,character:_.range.start.offset}),end:rD({line:_.range.end.line,character:_.range.end.offset})}:void 0}))}))}getEditsForRefactor(t,n){let{file:i,project:s}=this.getFileAndProject(t),o=s.getScriptInfoForNormalizedPath(i),c=s.getLanguageService().getEditsForRefactor(i,this.getFormatOptions(i),this.extractPositionOrRange(t,o),t.refactor,t.action,this.getPreferences(i),t.interactiveRefactorArguments);if(c===void 0)return{edits:[]};if(n){let{renameFilename:_,renameLocation:u,edits:g}=c,d;if(_!==void 0&&u!==void 0){let h=s.getScriptInfoForNormalizedPath(Oo(_));d=hme(Gk(h.getSnapshot()),_,u,g)}return{renameLocation:d,renameFilename:_,edits:this.mapTextChangesToCodeEdits(g),notApplicableReason:c.notApplicableReason}}return c}getMoveToRefactoringFileSuggestions(t){let{file:n,project:i}=this.getFileAndProject(t),s=i.getScriptInfoForNormalizedPath(n);return i.getLanguageService().getMoveToRefactoringFileSuggestions(n,this.extractPositionOrRange(t,s),this.getPreferences(n))}preparePasteEdits(t){let{file:n,project:i}=this.getFileAndProject(t);return i.getLanguageService().preparePasteEditsForFile(n,t.copiedTextSpan.map(s=>this.getRange({file:n,startLine:s.start.line,startOffset:s.start.offset,endLine:s.end.line,endOffset:s.end.offset},this.projectService.getScriptInfoForNormalizedPath(n))))}getPasteEdits(t){let{file:n,project:i}=this.getFileAndProject(t);if(RA(n))return;let s=t.copiedFrom?{file:t.copiedFrom.file,range:t.copiedFrom.spans.map(c=>this.getRange({file:t.copiedFrom.file,startLine:c.start.line,startOffset:c.start.offset,endLine:c.end.line,endOffset:c.end.offset},i.getScriptInfoForNormalizedPath(Oo(t.copiedFrom.file))))}:void 0,o=i.getLanguageService().getPasteEdits({targetFile:n,pastedText:t.pastedText,pasteLocations:t.pasteLocations.map(c=>this.getRange({file:n,startLine:c.start.line,startOffset:c.start.offset,endLine:c.end.line,endOffset:c.end.offset},i.getScriptInfoForNormalizedPath(n))),copiedFrom:s,preferences:this.getPreferences(n)},this.getFormatOptions(n));return o&&this.mapPasteEditsAction(o)}organizeImports(t,n){w.assert(t.scope.type==="file");let{file:i,project:s}=this.getFileAndProject(t.scope.args),o=s.getLanguageService().organizeImports({fileName:i,mode:t.mode??(t.skipDestructiveCodeActions?"SortAndCombine":void 0),type:"file"},this.getFormatOptions(i),this.getPreferences(i));return n?this.mapTextChangesToCodeEdits(o):o}getEditsForFileRename(t,n){let i=Oo(t.oldFilePath),s=Oo(t.newFilePath),o=this.getHostFormatOptions(),c=this.getHostPreferences(),_=new Set,u=[];return this.projectService.loadAncestorProjectTree(),this.projectService.forEachEnabledProject(g=>{let d=g.getLanguageService().getEditsForFileRename(i,s,o,c),h=[];for(let S of d)_.has(S.fileName)||(u.push(S),h.push(S.fileName));for(let S of h)_.add(S)}),n?u.map(g=>this.mapTextChangeToCodeEdit(g)):u}getCodeFixes(t,n){let{file:i,project:s}=this.getFileAndProject(t),o=s.getScriptInfoForNormalizedPath(i),{startPosition:c,endPosition:_}=this.getStartAndEndPosition(t,o),u;try{u=s.getLanguageService().getCodeFixesAtPosition(i,c,_,t.errorCodes,this.getFormatOptions(i),this.getPreferences(i))}catch(g){let d=g instanceof Error?g:new Error(g),h=s.getLanguageService(),S=[...h.getSyntacticDiagnostics(i),...h.getSemanticDiagnostics(i),...h.getSuggestionDiagnostics(i)].filter(k=>e4(c,_-c,k.start,k.length)).map(k=>k.code),x=t.errorCodes.find(k=>!S.includes(k));throw x!==void 0&&(d.message+=`
|
|
466
466
|
Additional information: BADCLIENT: Bad error code, ${x} not found in range ${c}..${_} (found: ${S.join(", ")})`),d}return n?u.map(g=>this.mapCodeFixAction(g)):u}getCombinedCodeFix({scope:t,fixId:n},i){w.assert(t.type==="file");let{file:s,project:o}=this.getFileAndProject(t.args),c=o.getLanguageService().getCombinedCodeFix({type:"file",fileName:s},n,this.getFormatOptions(s),this.getPreferences(s));return i?{changes:this.mapTextChangesToCodeEdits(c.changes),commands:c.commands}:c}applyCodeActionCommand(t){let n=t.command;for(let i of Gv(n)){let{file:s,project:o}=this.getFileAndProject(i);o.getLanguageService().applyCodeActionCommand(i,this.getFormatOptions(s)).then(c=>{},c=>{})}return{}}getStartAndEndPosition(t,n){let i,s;return t.startPosition!==void 0?i=t.startPosition:(i=n.lineOffsetToPosition(t.startLine,t.startOffset),t.startPosition=i),t.endPosition!==void 0?s=t.endPosition:(s=n.lineOffsetToPosition(t.endLine,t.endOffset),t.endPosition=s),{startPosition:i,endPosition:s}}mapCodeAction({description:t,changes:n,commands:i}){return{description:t,changes:this.mapTextChangesToCodeEdits(n),commands:i}}mapCodeFixAction({fixName:t,description:n,changes:i,commands:s,fixId:o,fixAllDescription:c}){return{fixName:t,description:n,changes:this.mapTextChangesToCodeEdits(i),commands:s,fixId:o,fixAllDescription:c}}mapPasteEditsAction({edits:t,fixId:n}){return{edits:this.mapTextChangesToCodeEdits(t),fixId:n}}mapTextChangesToCodeEdits(t){return t.map(n=>this.mapTextChangeToCodeEdit(n))}mapTextChangeToCodeEdit(t){let n=this.projectService.getScriptInfoOrConfig(t.fileName);return!!t.isNewFile==!!n&&(n||this.projectService.logErrorForScriptInfoNotFound(t.fileName),w.fail("Expected isNewFile for (only) new files. "+JSON.stringify({isNewFile:!!t.isNewFile,hasScriptInfo:!!n}))),n?{fileName:t.fileName,textChanges:t.textChanges.map(i=>dat(i,n))}:hat(t)}convertTextChangeToCodeEdit(t,n){return{start:n.positionToLineOffset(t.span.start),end:n.positionToLineOffset(t.span.start+t.span.length),newText:t.newText?t.newText:""}}getBraceMatching(t,n){let{file:i,languageService:s}=this.getFileAndLanguageServiceForSyntacticOperation(t),o=this.projectService.getScriptInfoForNormalizedPath(i),c=this.getPosition(t,o),_=s.getBraceMatchingAtPosition(i,c);return _?n?_.map(u=>Ag(u,o)):_:void 0}getDiagnosticsForProject(t,n,i){if(this.suppressDiagnosticEvents)return;let{fileNames:s,languageServiceDisabled:o}=this.getProjectInfoWorker(i,void 0,!0,void 0,!0);if(o)return;let c=s.filter(P=>!P.includes("lib.d.ts"));if(c.length===0)return;let _=[],u=[],g=[],d=[],h=Oo(i),S=this.projectService.ensureDefaultProjectForFile(h);for(let P of c)this.getCanonicalFileName(P)===this.getCanonicalFileName(i)?_.push(P):this.projectService.getScriptInfo(P).isScriptOpen()?u.push(P):_u(P)?d.push(P):g.push(P);let k=[..._,...u,...g,...d].map(P=>({fileName:P,project:S}));this.updateErrorCheck(t,k,n,!1)}configurePlugin(t){this.projectService.configurePlugin(t)}getSmartSelectionRange(t,n){let{locations:i}=t,{file:s,languageService:o}=this.getFileAndLanguageServiceForSyntacticOperation(t),c=w.checkDefined(this.projectService.getScriptInfo(s));return Sr(i,_=>{let u=this.getPosition(_,c),g=o.getSmartSelectionRange(s,u);return n?this.mapSelectionRange(g,c):g})}toggleLineComment(t,n){let{file:i,languageService:s}=this.getFileAndLanguageServiceForSyntacticOperation(t),o=this.projectService.getScriptInfo(i),c=this.getRange(t,o),_=s.toggleLineComment(i,c);if(n){let u=this.projectService.getScriptInfoForNormalizedPath(i);return _.map(g=>this.convertTextChangeToCodeEdit(g,u))}return _}toggleMultilineComment(t,n){let{file:i,languageService:s}=this.getFileAndLanguageServiceForSyntacticOperation(t),o=this.projectService.getScriptInfoForNormalizedPath(i),c=this.getRange(t,o),_=s.toggleMultilineComment(i,c);if(n){let u=this.projectService.getScriptInfoForNormalizedPath(i);return _.map(g=>this.convertTextChangeToCodeEdit(g,u))}return _}commentSelection(t,n){let{file:i,languageService:s}=this.getFileAndLanguageServiceForSyntacticOperation(t),o=this.projectService.getScriptInfoForNormalizedPath(i),c=this.getRange(t,o),_=s.commentSelection(i,c);if(n){let u=this.projectService.getScriptInfoForNormalizedPath(i);return _.map(g=>this.convertTextChangeToCodeEdit(g,u))}return _}uncommentSelection(t,n){let{file:i,languageService:s}=this.getFileAndLanguageServiceForSyntacticOperation(t),o=this.projectService.getScriptInfoForNormalizedPath(i),c=this.getRange(t,o),_=s.uncommentSelection(i,c);if(n){let u=this.projectService.getScriptInfoForNormalizedPath(i);return _.map(g=>this.convertTextChangeToCodeEdit(g,u))}return _}mapSelectionRange(t,n){let i={textSpan:Ag(t.textSpan,n)};return t.parent&&(i.parent=this.mapSelectionRange(t.parent,n)),i}getScriptInfoFromProjectService(t){let n=Oo(t),i=this.projectService.getScriptInfoForNormalizedPath(n);return i||(this.projectService.logErrorForScriptInfoNotFound(n),Hy.ThrowNoProject())}toProtocolCallHierarchyItem(t){let n=this.getScriptInfoFromProjectService(t.file);return{name:t.name,kind:t.kind,kindModifiers:t.kindModifiers,file:t.file,containerName:t.containerName,span:Ag(t.span,n),selectionSpan:Ag(t.selectionSpan,n)}}toProtocolCallHierarchyIncomingCall(t){let n=this.getScriptInfoFromProjectService(t.from.file);return{from:this.toProtocolCallHierarchyItem(t.from),fromSpans:t.fromSpans.map(i=>Ag(i,n))}}toProtocolCallHierarchyOutgoingCall(t,n){return{to:this.toProtocolCallHierarchyItem(t.to),fromSpans:t.fromSpans.map(i=>Ag(i,n))}}prepareCallHierarchy(t){let{file:n,project:i}=this.getFileAndProject(t),s=this.projectService.getScriptInfoForNormalizedPath(n);if(s){let o=this.getPosition(t,s),c=i.getLanguageService().prepareCallHierarchy(n,o);return c&&y$(c,_=>this.toProtocolCallHierarchyItem(_))}}provideCallHierarchyIncomingCalls(t){let{file:n,project:i}=this.getFileAndProject(t),s=this.getScriptInfoFromProjectService(n);return i.getLanguageService().provideCallHierarchyIncomingCalls(n,this.getPosition(t,s)).map(c=>this.toProtocolCallHierarchyIncomingCall(c))}provideCallHierarchyOutgoingCalls(t){let{file:n,project:i}=this.getFileAndProject(t),s=this.getScriptInfoFromProjectService(n);return i.getLanguageService().provideCallHierarchyOutgoingCalls(n,this.getPosition(t,s)).map(c=>this.toProtocolCallHierarchyOutgoingCall(c,s))}getCanonicalFileName(t){let n=this.host.useCaseSensitiveFileNames?t:Ph(t);return ha(n)}exit(){}notRequired(t){return t&&this.doOutput(void 0,t.command,t.seq,!0,this.performanceData),{responseRequired:!1,performanceData:this.performanceData}}requiredResponse(t){return{response:t,responseRequired:!0,performanceData:this.performanceData}}addProtocolHandler(t,n){if(this.handlers.has(t))throw new Error(`Protocol handler already exists for command "${t}"`);this.handlers.set(t,n)}setCurrentRequest(t){w.assert(this.currentRequestId===void 0),this.currentRequestId=t,this.cancellationToken.setRequest(t)}resetCurrentRequest(t){w.assert(this.currentRequestId===t),this.currentRequestId=void 0,this.cancellationToken.resetRequest(t)}executeWithRequestId(t,n,i){let s=this.performanceData;try{return this.performanceData=i,this.setCurrentRequest(t),n()}finally{this.resetCurrentRequest(t),this.performanceData=s}}executeCommand(t){let n=this.handlers.get(t.command);if(n){let i=this.executeWithRequestId(t.seq,()=>n(t),void 0);return this.projectService.enableRequestedPlugins(),i}else return this.logger.msg(`Unrecognized JSON command:${Db(t)}`,"Err"),this.doOutput(void 0,"unknown",t.seq,!1,void 0,`Unrecognized JSON command: ${t.command}`),{responseRequired:!1}}onMessage(t){var n,i,s,o,c,_,u;this.gcTimer.scheduleCollect();let g,d=this.performanceData;this.logger.hasLevel(2)&&(g=this.hrtime(),this.logger.hasLevel(3)&&this.logger.info(`request:${lA(this.toStringMessage(t))}`));let h,S;try{h=this.parseMessage(t),S=h.arguments&&h.arguments.file?h.arguments:void 0,(n=Dn)==null||n.instant(Dn.Phase.Session,"request",{seq:h.seq,command:h.command}),(i=Dn)==null||i.push(Dn.Phase.Session,"executeCommand",{seq:h.seq,command:h.command},!0);let{response:x,responseRequired:k,performanceData:P}=this.executeCommand(h);if((s=Dn)==null||s.pop(),this.logger.hasLevel(2)){let N=iat(this.hrtime(g)).toFixed(4);k?this.logger.perftrc(`${h.seq}::${h.command}: elapsed time (in milliseconds) ${N}`):this.logger.perftrc(`${h.seq}::${h.command}: async elapsed time (in milliseconds) ${N}`)}(o=Dn)==null||o.instant(Dn.Phase.Session,"response",{seq:h.seq,command:h.command,success:!!x}),x?this.doOutput(x,h.command,h.seq,!0,P):k&&this.doOutput(void 0,h.command,h.seq,!1,P,"No content available.")}catch(x){if((c=Dn)==null||c.popAll(),x instanceof s6){(_=Dn)==null||_.instant(Dn.Phase.Session,"commandCanceled",{seq:h?.seq,command:h?.command}),this.doOutput({canceled:!0},h.command,h.seq,!0,this.performanceData);return}this.logErrorWorker(x,this.toStringMessage(t),S),(u=Dn)==null||u.instant(Dn.Phase.Session,"commandError",{seq:h?.seq,command:h?.command,message:x.message}),this.doOutput(void 0,h?h.command:"unknown",h?h.seq:0,!1,this.performanceData,"Error processing request. "+x.message+`
|
|
467
467
|
`+x.stack)}finally{this.performanceData=d}}parseMessage(t){return JSON.parse(t)}toStringMessage(t){return t}getFormatOptions(t){return this.projectService.getFormatCodeOptions(t)}getPreferences(t){return this.projectService.getPreferences(t)}getHostFormatOptions(){return this.projectService.getHostFormatCodeOptions()}getHostPreferences(){return this.projectService.getHostPreferences()}};function K3e(e){let t=e.diagnosticsDuration&&ks(e.diagnosticsDuration,([n,i])=>({...i,file:n}));return{...e,diagnosticsDuration:t}}function Ag(e,t){return{start:t.positionToLineOffset(e.start),end:t.positionToLineOffset(Nc(e))}}function gme(e,t,n){let i=Ag(e,n),s=t&&Ag(t,n);return s?{...i,contextStart:s.start,contextEnd:s.end}:i}function dat(e,t){return{start:Z3e(t,e.span.start),end:Z3e(t,Nc(e.span)),newText:e.newText}}function Z3e(e,t){return lme(e)?gat(e.getLineAndCharacterOfPosition(t)):e.positionToLineOffset(t)}function mat(e,t){let n=e.ranges.map(i=>({start:t.positionToLineOffset(i.start),end:t.positionToLineOffset(i.start+i.length)}));return e.wordPattern?{ranges:n,wordPattern:e.wordPattern}:{ranges:n}}function gat(e){return{line:e.line+1,offset:e.character+1}}function hat(e){w.assert(e.textChanges.length===1);let t=ka(e.textChanges);return w.assert(t.span.start===0&&t.span.length===0),{fileName:e.fileName,textChanges:[{start:{line:0,offset:0},end:{line:0,offset:0},newText:t.newText}]}}function hme(e,t,n,i){let s=yat(e,t,i),{line:o,character:c}=hw(BC(s),n);return{line:o+1,offset:c+1}}function yat(e,t,n){for(let{fileName:i,textChanges:s}of n)if(i===t)for(let o=s.length-1;o>=0;o--){let{newText:c,span:{start:_,length:u}}=s[o];e=e.slice(0,_)+c+e.slice(_+u)}return e}function e8e(e,{fileName:t,textSpan:n,contextSpan:i,isWriteAccess:s,isDefinition:o},{disableLineTextInReferences:c}){let _=w.checkDefined(e.getScriptInfo(t)),u=gme(n,i,_),g=c?void 0:vat(_,u);return{file:t,...u,lineText:g,isWriteAccess:s,isDefinition:o}}function vat(e,t){let n=e.lineToTextSpan(t.start.line-1);return e.getSnapshot().getText(n.start,Nc(n)).replace(/\r|\n/g,"")}function bat(e){return e===void 0||e&&typeof e=="object"&&typeof e.exportName=="string"&&(e.fileName===void 0||typeof e.fileName=="string")&&(e.ambientModuleName===void 0||typeof e.ambientModuleName=="string"&&(e.isPackageJsonImport===void 0||typeof e.isPackageJsonImport=="boolean"))}var nD=4,yme=(e=>(e[e.PreStart=0]="PreStart",e[e.Start=1]="Start",e[e.Entire=2]="Entire",e[e.Mid=3]="Mid",e[e.End=4]="End",e[e.PostEnd=5]="PostEnd",e))(yme||{}),Sat=class{constructor(){this.goSubtree=!0,this.lineIndex=new UO,this.endBranch=[],this.state=2,this.initialText="",this.trailingText="",this.lineIndex.root=new iD,this.startPath=[this.lineIndex.root],this.stack=[this.lineIndex.root]}get done(){return!1}insertLines(e,t){t&&(this.trailingText=""),e?e=this.initialText+e+this.trailingText:e=this.initialText+this.trailingText;let i=UO.linesFromText(e).lines;i.length>1&&i[i.length-1]===""&&i.pop();let s,o;for(let _=this.endBranch.length-1;_>=0;_--)this.endBranch[_].updateCounts(),this.endBranch[_].charCount()===0&&(o=this.endBranch[_],_>0?s=this.endBranch[_-1]:s=this.branchNode);o&&s.remove(o);let c=this.startPath[this.startPath.length-1];if(i.length>0)if(c.text=i[0],i.length>1){let _=new Array(i.length-1),u=c;for(let h=1;h<i.length;h++)_[h-1]=new sj(i[h]);let g=this.startPath.length-2;for(;g>=0;){let h=this.startPath[g];_=h.insertAt(u,_),g--,u=h}let d=_.length;for(;d>0;){let h=new iD;h.add(this.lineIndex.root),_=h.insertAt(this.lineIndex.root,_),d=_.length,this.lineIndex.root=h}this.lineIndex.root.updateCounts()}else for(let _=this.startPath.length-2;_>=0;_--)this.startPath[_].updateCounts();else{this.startPath[this.startPath.length-2].remove(c);for(let u=this.startPath.length-2;u>=0;u--)this.startPath[u].updateCounts()}return this.lineIndex}post(e,t,n){n===this.lineCollectionAtBranch&&(this.state=4),this.stack.pop()}pre(e,t,n,i,s){let o=this.stack[this.stack.length-1];this.state===2&&s===1&&(this.state=1,this.branchNode=o,this.lineCollectionAtBranch=n);let c;function _(u){return u.isLeaf()?new sj(""):new iD}switch(s){case 0:this.goSubtree=!1,this.state!==4&&o.add(n);break;case 1:this.state===4?this.goSubtree=!1:(c=_(n),o.add(c),this.startPath.push(c));break;case 2:this.state!==4?(c=_(n),o.add(c),this.startPath.push(c)):n.isLeaf()||(c=_(n),o.add(c),this.endBranch.push(c));break;case 3:this.goSubtree=!1;break;case 4:this.state!==4?this.goSubtree=!1:n.isLeaf()||(c=_(n),o.add(c),this.endBranch.push(c));break;case 5:this.goSubtree=!1,this.state!==1&&o.add(n);break}this.goSubtree&&this.stack.push(c)}leaf(e,t,n){this.state===1?this.initialText=n.text.substring(0,e):this.state===2?(this.initialText=n.text.substring(0,e),this.trailingText=n.text.substring(e+t)):this.trailingText=n.text.substring(e+t)}},Tat=class{constructor(e,t,n){this.pos=e,this.deleteLen=t,this.insertedText=n}getTextChangeRange(){return t4(Ou(this.pos,this.deleteLen),this.insertedText?this.insertedText.length:0)}},HX=class hC{constructor(){this.changes=[],this.versions=new Array(hC.maxVersions),this.minVersion=0,this.currentVersion=0}versionToIndex(t){if(!(t<this.minVersion||t>this.currentVersion))return t%hC.maxVersions}currentVersionToIndex(){return this.currentVersion%hC.maxVersions}edit(t,n,i){this.changes.push(new Tat(t,n,i)),(this.changes.length>hC.changeNumberThreshold||n>hC.changeLengthThreshold||i&&i.length>hC.changeLengthThreshold)&&this.getSnapshot()}getSnapshot(){return this._getSnapshot()}_getSnapshot(){let t=this.versions[this.currentVersionToIndex()];if(this.changes.length>0){let n=t.index;for(let i of this.changes)n=n.edit(i.pos,i.deleteLen,i.insertedText);t=new t8e(this.currentVersion+1,this,n,this.changes),this.currentVersion=t.version,this.versions[this.currentVersionToIndex()]=t,this.changes=[],this.currentVersion-this.minVersion>=hC.maxVersions&&(this.minVersion=this.currentVersion-hC.maxVersions+1)}return t}getSnapshotVersion(){return this._getSnapshot().version}getAbsolutePositionAndLineText(t){return this._getSnapshot().index.lineNumberToInfo(t)}lineOffsetToPosition(t,n){return this._getSnapshot().index.absolutePositionOfStartOfLine(t)+(n-1)}positionToLineOffset(t){return this._getSnapshot().index.positionToLineOffset(t)}lineToTextSpan(t){let n=this._getSnapshot().index,{lineText:i,absolutePosition:s}=n.lineNumberToInfo(t+1),o=i!==void 0?i.length:n.absolutePositionOfStartOfLine(t+2)-s;return Ou(s,o)}getTextChangesBetweenVersions(t,n){if(t<n)if(t>=this.minVersion){let i=[];for(let s=t+1;s<=n;s++){let o=this.versions[this.versionToIndex(s)];for(let c of o.changesSincePreviousVersion)i.push(c.getTextChangeRange())}return tte(i)}else return;else return AF}getLineCount(){return this._getSnapshot().index.getLineCount()}static fromString(t){let n=new hC,i=new t8e(0,n,new UO);n.versions[n.currentVersion]=i;let s=UO.linesFromText(t);return i.index.load(s.lines),n}};HX.changeNumberThreshold=8,HX.changeLengthThreshold=256,HX.maxVersions=8;var $X=HX,t8e=class mRe{constructor(t,n,i,s=Yl){this.version=t,this.cache=n,this.index=i,this.changesSincePreviousVersion=s}getText(t,n){return this.index.getText(t,n-t)}getLength(){return this.index.getLength()}getChangeRange(t){if(t instanceof mRe&&this.cache===t.cache)return this.version<=t.version?AF:this.cache.getTextChangesBetweenVersions(t.version,this.version)}},UO=class a1e{constructor(){this.checkEdits=!1}absolutePositionOfStartOfLine(t){return this.lineNumberToInfo(t).absolutePosition}positionToLineOffset(t){let{oneBasedLine:n,zeroBasedColumn:i}=this.root.charOffsetToLineInfo(1,t);return{line:n,offset:i+1}}positionToColumnAndLineText(t){return this.root.charOffsetToLineInfo(1,t)}getLineCount(){return this.root.lineCount()}lineNumberToInfo(t){let n=this.getLineCount();if(t<=n){let{position:i,leaf:s}=this.root.lineNumberToInfo(t,0);return{absolutePosition:i,lineText:s&&s.text}}else return{absolutePosition:this.root.charCount(),lineText:void 0}}load(t){if(t.length>0){let n=[];for(let i=0;i<t.length;i++)n[i]=new sj(t[i]);this.root=a1e.buildTreeFromBottom(n)}else this.root=new iD}walk(t,n,i){this.root.walk(t,n,i)}getText(t,n){let i="";return n>0&&t<this.root.charCount()&&this.walk(t,n,{goSubtree:!0,done:!1,leaf:(s,o,c)=>{i=i.concat(c.text.substring(s,s+o))}}),i}getLength(){return this.root.charCount()}every(t,n,i){i||(i=this.root.charCount());let s={goSubtree:!0,done:!1,leaf(o,c,_){t(_,o,c)||(this.done=!0)}};return this.walk(n,i-n,s),!s.done}edit(t,n,i){if(this.root.charCount()===0)return w.assert(n===0),i!==void 0?(this.load(a1e.linesFromText(i).lines),this):void 0;{let s;if(this.checkEdits){let _=this.getText(0,this.root.charCount());s=_.slice(0,t)+i+_.slice(t+n)}let o=new Sat,c=!1;if(t>=this.root.charCount()){t=this.root.charCount()-1;let _=this.getText(t,1);i?i=_+i:i=_,n=0,c=!0}else if(n>0){let _=t+n,{zeroBasedColumn:u,lineText:g}=this.positionToColumnAndLineText(_);u===0&&(n+=g.length,i=i?i+g:g)}if(this.root.walk(t,n,o),o.insertLines(i,c),this.checkEdits){let _=o.lineIndex.getText(0,o.lineIndex.getLength());w.assert(s===_,"buffer edit mismatch")}return o.lineIndex}}static buildTreeFromBottom(t){if(t.length<nD)return new iD(t);let n=new Array(Math.ceil(t.length/nD)),i=0;for(let s=0;s<n.length;s++){let o=Math.min(i+nD,t.length);n[s]=new iD(t.slice(i,o)),i=o}return this.buildTreeFromBottom(n)}static linesFromText(t){let n=BC(t);if(n.length===0)return{lines:[],lineMap:n};let i=new Array(n.length),s=n.length-1;for(let c=0;c<s;c++)i[c]=t.substring(n[c],n[c+1]);let o=t.substring(n[s]);return o.length>0?i[s]=o:i.pop(),{lines:i,lineMap:n}}},iD=class o1e{constructor(t=[]){this.children=t,this.totalChars=0,this.totalLines=0,t.length&&this.updateCounts()}isLeaf(){return!1}updateCounts(){this.totalChars=0,this.totalLines=0;for(let t of this.children)this.totalChars+=t.charCount(),this.totalLines+=t.lineCount()}execWalk(t,n,i,s,o){return i.pre&&i.pre(t,n,this.children[s],this,o),i.goSubtree?(this.children[s].walk(t,n,i),i.post&&i.post(t,n,this.children[s],this,o)):i.goSubtree=!0,i.done}skipChild(t,n,i,s,o){s.pre&&!s.done&&(s.pre(t,n,this.children[i],this,o),s.goSubtree=!0)}walk(t,n,i){if(this.children.length===0)return;let s=0,o=this.children[s].charCount(),c=t;for(;c>=o;)this.skipChild(c,n,s,i,0),c-=o,s++,o=this.children[s].charCount();if(c+n<=o){if(this.execWalk(c,n,i,s,2))return}else{if(this.execWalk(c,o-c,i,s,1))return;let _=n-(o-c);for(s++,o=this.children[s].charCount();_>o;){if(this.execWalk(0,o,i,s,3))return;_-=o,s++,o=this.children[s].charCount()}if(_>0&&this.execWalk(0,_,i,s,4))return}if(i.pre){let _=this.children.length;if(s<_-1)for(let u=s+1;u<_;u++)this.skipChild(0,0,u,i,5)}}charOffsetToLineInfo(t,n){if(this.children.length===0)return{oneBasedLine:t,zeroBasedColumn:n,lineText:void 0};for(let o of this.children){if(o.charCount()>n)return o.isLeaf()?{oneBasedLine:t,zeroBasedColumn:n,lineText:o.text}:o.charOffsetToLineInfo(t,n);n-=o.charCount(),t+=o.lineCount()}let i=this.lineCount();if(i===0)return{oneBasedLine:1,zeroBasedColumn:0,lineText:void 0};let s=w.checkDefined(this.lineNumberToInfo(i,0).leaf);return{oneBasedLine:i,zeroBasedColumn:s.charCount(),lineText:void 0}}lineNumberToInfo(t,n){for(let i of this.children){let s=i.lineCount();if(s>=t)return i.isLeaf()?{position:n,leaf:i}:i.lineNumberToInfo(t,n);t-=s,n+=i.charCount()}return{position:n,leaf:void 0}}splitAfter(t){let n,i=this.children.length;t++;let s=t;if(t<i){for(n=new o1e;t<i;)n.add(this.children[t]),t++;n.updateCounts()}return this.children.length=s,n}remove(t){let n=this.findChildIndex(t),i=this.children.length;if(n<i-1)for(let s=n;s<i-1;s++)this.children[s]=this.children[s+1];this.children.pop()}findChildIndex(t){let n=this.children.indexOf(t);return w.assert(n!==-1),n}insertAt(t,n){let i=this.findChildIndex(t),s=this.children.length,o=n.length;if(s<nD&&i===s-1&&o===1)return this.add(n[0]),this.updateCounts(),[];{let c=this.splitAfter(i),_=0;for(i++;i<nD&&_<o;)this.children[i]=n[_],i++,_++;let u=[],g=0;if(_<o){g=Math.ceil((o-_)/nD),u=new Array(g);let d=0;for(let S=0;S<g;S++)u[S]=new o1e;let h=u[0];for(;_<o;)h.add(n[_]),_++,h.children.length===nD&&(d++,h=u[d]);for(let S=u.length-1;S>=0;S--)u[S].children.length===0&&u.pop()}c&&u.push(c),this.updateCounts();for(let d=0;d<g;d++)u[d].updateCounts();return u}}add(t){this.children.push(t),w.assert(this.children.length<=nD)}charCount(){return this.totalChars}lineCount(){return this.totalLines}},sj=class{constructor(e){this.text=e}isLeaf(){return!0}walk(e,t,n){n.leaf(e,t,this)}charCount(){return this.text.length}lineCount(){return 1}},r8e=class gRe{constructor(t,n,i,s,o,c){this.telemetryEnabled=t,this.logger=n,this.host=i,this.globalTypingsCacheLocation=s,this.event=o,this.maxActiveRequestCount=c,this.activeRequestCount=0,this.requestQueue=lw(),this.requestMap=new Map,this.requestedRegistry=!1,this.packageInstallId=0}isKnownTypesPackageName(t){var n;return cv.validatePackageName(t)!==cv.NameValidationResult.Ok?!1:(this.requestedRegistry||(this.requestedRegistry=!0,this.installer.send({kind:"typesRegistry"})),!!((n=this.typesRegistryCache)!=null&&n.has(t)))}installPackage(t){this.packageInstallId++;let n={kind:"installPackage",...t,id:this.packageInstallId},i=new Promise((s,o)=>{(this.packageInstalledPromise??(this.packageInstalledPromise=new Map)).set(this.packageInstallId,{resolve:s,reject:o})});return this.installer.send(n),i}attach(t){this.projectService=t,this.installer=this.createInstallerProcess()}onProjectClosed(t){this.installer.send({projectName:t.getProjectName(),kind:"closeProject"})}enqueueInstallTypingsRequest(t,n,i){let s=kde(t,n,i);this.logger.hasLevel(3)&&this.logger.info(`TIAdapter:: Scheduling throttled operation:${Db(s)}`),this.activeRequestCount<this.maxActiveRequestCount?this.scheduleRequest(s):(this.logger.hasLevel(3)&&this.logger.info(`TIAdapter:: Deferring request for: ${s.projectName}`),this.requestQueue.enqueue(s),this.requestMap.set(s.projectName,s))}handleMessage(t){var n,i;switch(this.logger.hasLevel(3)&&this.logger.info(`TIAdapter:: Received response:${Db(t)}`),t.kind){case hH:this.typesRegistryCache=new Map(Object.entries(t.typesRegistry));break;case CL:{let s=(n=this.packageInstalledPromise)==null?void 0:n.get(t.id);w.assertIsDefined(s,"Should find the promise for package install"),(i=this.packageInstalledPromise)==null||i.delete(t.id),t.success?s.resolve({successMessage:t.message}):s.reject(t.message),this.projectService.updateTypingsForProject(t),this.event(t,"setTypings");break}case Ace:{let s={message:t.message};this.event(s,"typesInstallerInitializationFailed");break}case yH:{let s={eventId:t.eventId,packages:t.packagesToInstall};this.event(s,"beginInstallTypes");break}case vH:{if(this.telemetryEnabled){let c={telemetryEventName:"typingsInstalled",payload:{installedPackages:t.packagesToInstall.join(","),installSuccess:t.installSuccess,typingsInstallerVersion:t.typingsInstallerVersion}};this.event(c,"telemetry")}let s={eventId:t.eventId,packages:t.packagesToInstall,success:t.installSuccess};this.event(s,"endInstallTypes");break}case xL:{this.projectService.updateTypingsForProject(t);break}case TL:{for(this.activeRequestCount>0?this.activeRequestCount--:w.fail("TIAdapter:: Received too many responses");!this.requestQueue.isEmpty();){let s=this.requestQueue.dequeue();if(this.requestMap.get(s.projectName)===s){this.requestMap.delete(s.projectName),this.scheduleRequest(s);break}this.logger.hasLevel(3)&&this.logger.info(`TIAdapter:: Skipping defunct request for: ${s.projectName}`)}this.projectService.updateTypingsForProject(t),this.event(t,"setTypings");break}case L8:this.projectService.watchTypingLocations(t);break;default:}}scheduleRequest(t){this.logger.hasLevel(3)&&this.logger.info(`TIAdapter:: Scheduling request for: ${t.projectName}`),this.activeRequestCount++,this.host.setTimeout(()=>{this.logger.hasLevel(3)&&this.logger.info(`TIAdapter:: Sending request:${Db(t)}`),this.installer.send(t)},gRe.requestDelayMillis,`${t.projectName}::${t.kind}`)}};r8e.requestDelayMillis=100;var n8e=r8e,i8e={};Re(i8e,{ActionInvalidate:()=>xL,ActionPackageInstalled:()=>CL,ActionSet:()=>TL,ActionWatchTypingLocations:()=>L8,Arguments:()=>bH,AutoImportProviderProject:()=>Hde,AuxiliaryProject:()=>Vde,CharRangeSection:()=>yme,CloseFileWatcherEvent:()=>MX,CommandNames:()=>z3e,ConfigFileDiagEvent:()=>NX,ConfiguredProject:()=>$de,ConfiguredProjectLoadKind:()=>Zde,CreateDirectoryWatcherEvent:()=>FX,CreateFileWatcherEvent:()=>OX,Errors:()=>Hy,EventBeginInstallTypes:()=>yH,EventEndInstallTypes:()=>vH,EventInitializationFailed:()=>Ace,EventTypesRegistry:()=>hH,ExternalProject:()=>CX,GcTimer:()=>Ide,InferredProject:()=>zde,LargeFileReferencedEvent:()=>DX,LineIndex:()=>UO,LineLeaf:()=>sj,LineNode:()=>iD,LogLevel:()=>xde,Msg:()=>Cde,OpenFileInfoTelemetryEvent:()=>Gde,Project:()=>cE,ProjectInfoTelemetryEvent:()=>IX,ProjectKind:()=>jA,ProjectLanguageServiceStateEvent:()=>AX,ProjectLoadingFinishEvent:()=>PX,ProjectLoadingStartEvent:()=>wX,ProjectService:()=>cme,ProjectsUpdatedInBackgroundEvent:()=>rj,ScriptInfo:()=>Lde,ScriptVersionCache:()=>$X,Session:()=>Y3e,TextStorage:()=>Mde,ThrottledOperations:()=>Ade,TypingsInstallerAdapter:()=>n8e,allFilesAreJsOrDts:()=>Jde,allRootFilesAreJsOrDts:()=>Bde,asNormalizedPath:()=>m3e,convertCompilerOptions:()=>nj,convertFormatOptions:()=>tD,convertScriptKindName:()=>RX,convertTypeAcquisition:()=>Qde,convertUserPreferences:()=>Yde,convertWatchOptions:()=>BO,countEachFileTypes:()=>MO,createInstallTypingsRequest:()=>kde,createModuleSpecifierCache:()=>_me,createNormalizedPathMap:()=>g3e,createPackageJsonCache:()=>fme,createSortedArray:()=>Nde,emptyArray:()=>Yl,findArgument:()=>gCe,formatDiagnosticToProtocol:()=>JO,formatMessage:()=>pme,getBaseConfigFileName:()=>xX,getDetailWatchInfo:()=>UX,getLocationInNewDocument:()=>hme,hasArgument:()=>mCe,hasNoTypeScriptSource:()=>Ude,indent:()=>lA,isBackgroundProject:()=>RO,isConfigFile:()=>lme,isConfiguredProject:()=>H0,isDynamicFileName:()=>RA,isExternalProject:()=>LO,isInferredProject:()=>eD,isInferredProjectName:()=>Ede,isProjectDeferredClose:()=>jO,makeAutoImportProviderProjectName:()=>Pde,makeAuxiliaryProjectName:()=>Dde,makeInferredProjectName:()=>wde,maxFileSize:()=>EX,maxProgramSizeForNonTsFiles:()=>kX,normalizedPathToPath:()=>ZP,nowString:()=>hCe,nullCancellationToken:()=>J3e,nullTypingsInstaller:()=>ij,protocol:()=>Ode,scriptInfoIsContainedByBackgroundProject:()=>Rde,scriptInfoIsContainedByDeferredClosedProject:()=>jde,stringifyIndented:()=>Db,toEvent:()=>dme,toNormalizedPath:()=>Oo,tryConvertScriptKindName:()=>LX,typingsInstaller:()=>Tde,updateProjectIfDirty:()=>Jd}),typeof console<"u"&&(w.loggingHost={log(e,t){switch(e){case 1:return console.error(t);case 2:return console.warn(t);case 3:return console.log(t);case 4:return console.log(t)}}})})({get exports(){return lRe},set exports(ie){lRe=ie,typeof HK<"u"&&HK.exports&&(HK.exports=ie)}})});var GK=Qa(yC=>{"use strict";var E1t=yC&&yC.__createBinding||(Object.create?(function(ie,T,I,W){W===void 0&&(W=I);var ne=Object.getOwnPropertyDescriptor(T,I);(!ne||("get"in ne?!T.__esModule:ne.writable||ne.configurable))&&(ne={enumerable:!0,get:function(){return T[I]}}),Object.defineProperty(ie,W,ne)}):(function(ie,T,I,W){W===void 0&&(W=I),ie[W]=T[I]})),w1t=yC&&yC.__setModuleDefault||(Object.create?(function(ie,T){Object.defineProperty(ie,"default",{enumerable:!0,value:T})}):function(ie,T){ie.default=T}),P1t=yC&&yC.__importStar||(function(){var ie=function(T){return ie=Object.getOwnPropertyNames||function(I){var W=[];for(var ne in I)Object.prototype.hasOwnProperty.call(I,ne)&&(W[W.length]=ne);return W},ie(T)};return function(T){if(T&&T.__esModule)return T;var I={};if(T!=null)for(var W=ie(T),ne=0;ne<W.length;ne++)W[ne]!=="default"&&E1t(I,T,W[ne]);return w1t(I,T),I}})();Object.defineProperty(yC,"__esModule",{value:!0});yC.GlobMatcher=void 0;var hRe=P1t(require("path")),c1e=class ie{basePath;regexes;constructor(T,I){this.basePath=T,this.regexes=I.map(W=>ie.globToRegex(W))}matches(T){let W=hRe.relative(this.basePath,T).split(hRe.sep).join("/");return this.regexes.some(ne=>ne.test(W))}static globToRegex(T){let I="",W=0;for(;W<T.length;){let ne=T[W];if(ne==="*")T[W+1]==="*"?T[W+2]==="/"?(I+="(?:.+/)?",W+=3):(I+=".*",W+=2):(I+="[^/]*",W++);else if(ne==="?")I+="[^/]",W++;else if(ne==="{"){let Re=T.indexOf("}",W);if(Re!==-1){let _t=T.slice(W+1,Re).split(",").map(ie.escapeRegex);I+=`(?:${_t.join("|")})`,W=Re+1}else I+="\\{",W++}else if(ne==="["){let Re=T.indexOf("]",W);Re!==-1?(I+=T.slice(W,Re+1),W=Re+1):(I+="\\[",W++)}else".+^$|()".includes(ne)?(I+="\\"+ne,W++):(I+=ne,W++)}return new RegExp(`^${I}$`)}static escapeRegex(T){return T.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}};yC.GlobMatcher=c1e});var Y7=Qa(vC=>{"use strict";var D1t=vC&&vC.__createBinding||(Object.create?(function(ie,T,I,W){W===void 0&&(W=I);var ne=Object.getOwnPropertyDescriptor(T,I);(!ne||("get"in ne?!T.__esModule:ne.writable||ne.configurable))&&(ne={enumerable:!0,get:function(){return T[I]}}),Object.defineProperty(ie,W,ne)}):(function(ie,T,I,W){W===void 0&&(W=I),ie[W]=T[I]})),N1t=vC&&vC.__setModuleDefault||(Object.create?(function(ie,T){Object.defineProperty(ie,"default",{enumerable:!0,value:T})}):function(ie,T){ie.default=T}),A1t=vC&&vC.__importStar||(function(){var ie=function(T){return ie=Object.getOwnPropertyNames||function(I){var W=[];for(var ne in I)Object.prototype.hasOwnProperty.call(I,ne)&&(W[W.length]=ne);return W},ie(T)};return function(T){if(T&&T.__esModule)return T;var I={};if(T!=null)for(var W=ie(T),ne=0;ne<W.length;ne++)W[ne]!=="default"&&D1t(I,T,W[ne]);return N1t(I,T),I}})();Object.defineProperty(vC,"__esModule",{value:!0});vC.TsConfig=void 0;var I1t=A1t(require("path")),O1t=Cm(),F1t=Ch(),l1e=class ie{rawUri;static NAME="tsconfig.json";sf;scriptRoot;constructor(T,I){if(this.rawUri=T,!this.path().endsWith(ie.NAME))throw new O1t.Err.InvalidResourceTypeError("tsconfig.json file");this.scriptRoot=I,this.sf=I.factory.createFile(T,I)}equals(T){return T instanceof ie?this.sf.equals(T.sf):!1}path(){return this.rawUri.fsPath}uri(){return this.rawUri}folder(){return this.scriptRoot.factory.createFolder(this.rawUri.dirname,this.scriptRoot)}async isCopacetic(){if(!await this.sf.exists())return!1;let I=await this.scriptRoot.ctx.fs.readFile(this.uri()),W=Buffer.from(I).toString("utf-8");try{let ne=JSON.parse(W);return!!(ne.compilerOptions&&ne.include)}catch{return!1}}async getBuildFolder(){let T=await this.scriptRoot.ctx.fs.readFile(this.uri()),I=JSON.parse(Buffer.from(T).toString("utf-8")),W=ie.resolveOutDir(I.compilerOptions?.outDir);return W!==I.compilerOptions?.outDir&&this.scriptRoot.ctx.logger.info(`tsconfig at ${this.path()} has no usable outDir; defaulting build folder to "${W}".`),this.scriptRoot.factory.createFolder(this.folder().uri().joinPath(W),this.scriptRoot)}static resolveOutDir(T){return typeof T=="string"&&T.trim().length>0?T:F1t.FolderNames.DOT_BUILD}async relativePathToBuildFolder(){let T=await this.getBuildFolder();return I1t.relative(this.uri().fsPath,T.uri().fsPath)}};vC.TsConfig=l1e});var XK=Qa(bC=>{"use strict";var M1t=bC&&bC.__createBinding||(Object.create?(function(ie,T,I,W){W===void 0&&(W=I);var ne=Object.getOwnPropertyDescriptor(T,I);(!ne||("get"in ne?!T.__esModule:ne.writable||ne.configurable))&&(ne={enumerable:!0,get:function(){return T[I]}}),Object.defineProperty(ie,W,ne)}):(function(ie,T,I,W){W===void 0&&(W=I),ie[W]=T[I]})),L1t=bC&&bC.__setModuleDefault||(Object.create?(function(ie,T){Object.defineProperty(ie,"default",{enumerable:!0,value:T})}):function(ie,T){ie.default=T}),R1t=bC&&bC.__importStar||(function(){var ie=function(T){return ie=Object.getOwnPropertyNames||function(I){var W=[];for(var ne in I)Object.prototype.hasOwnProperty.call(I,ne)&&(W[W.length]=ne);return W},ie(T)};return function(T){if(T&&T.__esModule)return T;var I={};if(T!=null)for(var W=ie(T),ne=0;ne<W.length;ne++)W[ne]!=="default"&&M1t(I,T,W[ne]);return L1t(I,T),I}})();Object.defineProperty(bC,"__esModule",{value:!0});bC.ScriptNode=void 0;var yRe=R1t(require("path")),zB=Ch(),j1t=UB(),B1t=GK(),wS=Cm(),u1e=Y7(),J1t=ES(),_1e=class{downstairsUri;parser;scriptRoot;_exists;constructor(T,I){this.downstairsUri=T,this.parser=new j1t.DownstairsPathParser(T.fsPath),this.scriptRoot=I}get ctx(){return this.scriptRoot.ctx}get factory(){return this.scriptRoot.factory}uri(){return this.downstairsUri}path(){return this.uri().fsPath}async getUpstairsLastModified(){let I=(await this.ctx.sessionManager.fetch(await this.upstairsUrl(),{method:zB.Http.Methods.HEAD})).headers.get("Last-Modified");if(!I)throw new wS.Err.ModificationTimeError;return new Date(I)}async getUpstairsContent(){let T=await this.ctx.sessionManager.fetch(await this.upstairsUrl(),{method:zB.Http.Methods.GET,headers:{[zB.Http.Headers.ACCEPT]:zB.Http.Headers.ACCEPT_ALL}});if(T.status>=400)throw new wS.Err.HttpResponseError(`Error fetching upstairs file. Status: ${T.status}.
|
|
468
|
-
${T.statusText}`);return await T.text()}b6pUri(){return this.uri()}async writeContent(T){let I=this.b6pUri(),W=J1t.B6PUri.fromFsPath(I.fsPath+".b6p-tmp");await this.ctx.fs.writeFile(W,Buffer.from(T));try{await this.ctx.fs.rename(W,I)}catch(ne){try{await this.ctx.fs.delete(W,{recursive:!1})}catch{}this.ctx.logger.warn(`Atomic rename into ${I.fsPath} failed (${ne instanceof Error?ne.message:ne}); falling back to a direct write.`),await this.ctx.fs.writeFile(I,Buffer.from(T))}this._exists=!0}async exists(){if(this._exists)return this._exists;try{return await this.ctx.fs.stat(this.b6pUri()),this._exists=!0,!0}catch{return this._exists=!1,!1}}async stat(){try{return await this.ctx.fs.stat(this.b6pUri())}catch{return null}}async lastModifiedTime(){let T=await this.stat();if(!T)throw new wS.Err.NodeNotFoundError;return new Date(T.mtime)}getScriptRoot(T){return T&&this.scriptRoot.withParser(T),this.scriptRoot}withScriptRoot(T){if(this.scriptRoot=T,this.parser.type==="metadata")throw new wS.Err.MetadataFileOperationError("overwrite script root");return this}withParser(T){return this.parser=T,this}equals(T){return this.path()===T.path()}isInDeclarations(){return this.parser.type==="declarations"}isInSnapshot(){return this.parser.type==="snapshot"}isInDraft(){return this.parser.type==="draft"}async isCopacetic(){return await this.exists()}async isInGitIgnore(){let T=this.getScriptRoot(),I=await T.getGitIgnore();return new B1t.GlobMatcher(T.getRootUri().fsPath,I).matches(this.uri().fsPath)}async getRest(){return(await this.upstairsUrl()).pathname}folder(){return this.factory.createFolder(this.uri().dirname,this.scriptRoot)}async getMatchingTsConfigFile(){return await this.getClosestTsConfigFile()}async getClosestTsConfigFile(){let T=await this.getClosestTsConfigUri();if(!T)throw new wS.Err.ConfigFileError(u1e.TsConfig.NAME,0);return this.factory.createTsConfig(T,this.scriptRoot)}async getClosestTsConfigUri(){return await this.ctx.fs.closest(this.b6pUri(),u1e.TsConfig.NAME)}async closest(T){return await this.ctx.fs.closest(this.b6pUri(),T)}async isInItsRespectiveBuildFolder(){return(await this.getBuildFolder()).contains(this)}async getBuildFolder(){return await(await this.getMatchingTsConfigFile()).getBuildFolder()}pathWithRespectToDraftRoot(){return yRe.relative(this.getScriptRoot().getRootUri().joinPath(zB.FolderNames.DRAFT).fsPath,this.uri().fsPath)}async pathWithRespectToTsConfigFolder(){let T=await this.getClosestTsConfigFile();if(!T)throw new wS.Err.ConfigFileError(u1e.TsConfig.NAME,0);let I=T.folder().uri();return yRe.relative(I.fsPath,this.uri().fsPath)}async isFolder(){return(await this.ctx.fs.stat(this.b6pUri())).type==="directory"}async isFile(){return!await this.isFolder()}async copyDraftFileToBuild(){if(await this.isInItsRespectiveBuildFolder())throw new wS.Err.BuildFolderOperationError("copy",this.path());if(!await this.isCopacetic())throw new wS.Err.ScriptNotCopaceticError;let T=await this.getClosestTsConfigFile(),I=T.folder().uri().joinPath(await T.relativePathToBuildFolder(),await this.pathWithRespectToTsConfigFolder());await this.copyTo(I)}async readContents(){return await this.ctx.fs.readFile(this.b6pUri())}async copyTo(T){if(await this.isInItsRespectiveBuildFolder())throw new wS.Err.BuildFolderOperationError("copy",this.path());if(!await this.isCopacetic())throw new wS.Err.ScriptNotCopaceticError;await this.ctx.fs.copy(this.b6pUri(),T,{overwrite:!0})}async delete(){if(await this.isCopacetic())await this.ctx.fs.delete(this.b6pUri(),{recursive:!0}),this._exists=!1;else throw new wS.Err.ScriptNotCopaceticError}async rename(T){if(await this.isCopacetic(),this.uri().fsPath===this.scriptRoot.getRootUri().fsPath)throw new wS.Err.ScriptOperationError("Cannot rename the script root folder; the folder name is used as a metadata lookup key.");if(this.name()===T){this.ctx.logger.info("Ignoring rename operation; new name is the same as the current name.");return}let W=this.uri().dirname.joinPath(T);await this.ctx.fs.rename(this.uri(),W)}};bC.ScriptNode=_1e});var YK=Qa(SC=>{"use strict";var U1t=SC&&SC.__createBinding||(Object.create?(function(ie,T,I,W){W===void 0&&(W=I);var ne=Object.getOwnPropertyDescriptor(T,I);(!ne||("get"in ne?!T.__esModule:ne.writable||ne.configurable))&&(ne={enumerable:!0,get:function(){return T[I]}}),Object.defineProperty(ie,W,ne)}):(function(ie,T,I,W){W===void 0&&(W=I),ie[W]=T[I]})),W1t=SC&&SC.__setModuleDefault||(Object.create?(function(ie,T){Object.defineProperty(ie,"default",{enumerable:!0,value:T})}):function(ie,T){ie.default=T}),z1t=SC&&SC.__importStar||(function(){var ie=function(T){return ie=Object.getOwnPropertyNames||function(I){var W=[];for(var ne in I)Object.prototype.hasOwnProperty.call(I,ne)&&(W[W.length]=ne);return W},ie(T)};return function(T){if(T&&T.__esModule)return T;var I={};if(T!=null)for(var W=ie(T),ne=0;ne<W.length;ne++)W[ne]!=="default"&&U1t(I,T,W[ne]);return W1t(I,T),I}})();Object.defineProperty(SC,"__esModule",{value:!0});SC.ScriptFile=void 0;var II=z1t(require("path")),V1t=require("node:crypto"),Yd=Ch(),S1=Cm(),QK=LB(),q1t=XK(),H1t=Y7(),f1e=ES(),p1e=class ie extends q1t.ScriptNode{static ComplexEtagPattern=/^"?\d{10,13}-\{.*?"class":\s*"myassn\.document\.(Proxy|LibraryServlet)MemoryDocumentKey".*?"classId":\s*\d+.*?\}"?$/;static NumericEtagPattern=/^"?\d{10,13}-[\d_]+"?$/;static EtagPattern=/^"[a-f0-9]{128}"$/;static WeakEtagPattern=/^W\/"[a-f0-9]{128}"$/;createFamilial(T){if(!this.scriptRoot.getAsFolder().contains(T))throw new S1.Err.ScriptOperationError("The provided URI is not a proper sibling within the same script root.");return new ie(T,this.scriptRoot)}_reasonToNotPush;async getHash(){await this.requireExists();let T=await this.ctx.fs.readFile(f1e.B6PUri.fromFsPath(this.uri().fsPath));return ie.computeHash(T)}static async computeHash(T){let I=await V1t.webcrypto.subtle.digest(Yd.CryptoAlgorithms.SHA_512,T),W=Array.from(new Uint8Array(I));if(W.length!==64)throw new S1.Err.HashCalculationError;return W.map(ne=>ne.toString(16).padStart(2,"0")).join("").toLowerCase()}async getUpstairsHash(T){let I=await this.ctx.sessionManager.fetch(T?.upstairsOverride||await this.upstairsUrl(),{method:Yd.Http.Methods.HEAD}),W=this.hashFromEtag(I.headers.get(Yd.Http.Headers.ETAG));if(!W){if(T?.required)throw new S1.Err.HashCalculationError;return null}return W}hashFromEtag(T){let I=null;return ie.EtagPattern.test(T||"")?I=JSON.parse(T?.toLowerCase()||"null"):ie.WeakEtagPattern.test(T||"")?(this.ctx.logger.debug("weak etagHeader:",T),I=JSON.parse(T?.substring(2).toLowerCase()||"null")):ie.NumericEtagPattern.test(T||"")?this.ctx.logger.debug("numeric etagHeader:",T):this.ctx.logger.debug("complex etagHeader:",T),I?I.toLowerCase():null}async getLastVerifiedHash(){await this.requireExists();let T=await this.getScriptRoot().getMetaData();if(!T)return null;let I=T.pushPullRecords.find(W=>W.downstairsPath===this.uri().fsPath);return I?I.lastVerifiedHash:null}async currentIntegrityStatus(T){let I=await this.getHash(),W=await this.getUpstairsHash(T),ne=W===null?"indeterminate":I===W?"match":"mismatch";return this.ctx.logger.debug("filename:",this.name(),`
|
|
468
|
+
${T.statusText}`);return await T.text()}b6pUri(){return this.uri()}async writeContent(T){let I=this.b6pUri(),W=J1t.B6PUri.fromFsPath(I.fsPath+".b6p-tmp");await this.ctx.fs.writeFile(W,Buffer.from(T));try{await this.ctx.fs.rename(W,I)}catch(ne){try{await this.ctx.fs.delete(W,{recursive:!1})}catch{}this.ctx.logger.warn(`Atomic rename into ${I.fsPath} failed (${ne instanceof Error?ne.message:ne}); falling back to a direct write.`),await this.ctx.fs.writeFile(I,Buffer.from(T))}this._exists=!0}async exists(){if(this._exists)return this._exists;try{return await this.ctx.fs.stat(this.b6pUri()),this._exists=!0,!0}catch{return this._exists=!1,!1}}async stat(){try{return await this.ctx.fs.stat(this.b6pUri())}catch{return null}}async lastModifiedTime(){let T=await this.stat();if(!T)throw new wS.Err.NodeNotFoundError;return new Date(T.mtime)}getScriptRoot(T){return T&&this.scriptRoot.withParser(T),this.scriptRoot}withScriptRoot(T){if(this.scriptRoot=T,this.parser.type==="metadata")throw new wS.Err.MetadataFileOperationError("overwrite script root");return this}withParser(T){return this.parser=T,this}equals(T){return this.path()===T.path()}isInDeclarations(){return this.parser.type==="declarations"}isInSnapshot(){return this.parser.type==="snapshot"}isInDraft(){return this.parser.type==="draft"}async isCopacetic(){return await this.exists()}async isInGitIgnore(){let T=this.getScriptRoot(),I=await T.getGitIgnore();return new B1t.GlobMatcher(T.getRootUri().fsPath,I).matches(this.uri().fsPath)}async getRest(){return(await this.upstairsUrl()).pathname}folder(){return this.factory.createFolder(this.uri().dirname,this.scriptRoot)}async getMatchingTsConfigFile(){return await this.getClosestTsConfigFile()}async getClosestTsConfigFile(){let T=await this.getClosestTsConfigUri();if(!T)throw new wS.Err.ConfigFileError(u1e.TsConfig.NAME,0);return this.factory.createTsConfig(T,this.scriptRoot)}async getClosestTsConfigUri(){return await this.ctx.fs.closest(this.b6pUri(),u1e.TsConfig.NAME)}async closest(T){return await this.ctx.fs.closest(this.b6pUri(),T)}async isInItsRespectiveBuildFolder(){return(await this.getBuildFolder()).contains(this)}async getBuildFolder(){return await(await this.getMatchingTsConfigFile()).getBuildFolder()}pathWithRespectToDraftRoot(){return yRe.relative(this.getScriptRoot().getRootUri().joinPath(zB.FolderNames.DRAFT).fsPath,this.uri().fsPath)}async pathWithRespectToTsConfigFolder(){let T=await this.getClosestTsConfigFile();if(!T)throw new wS.Err.ConfigFileError(u1e.TsConfig.NAME,0);let I=T.folder().uri();return yRe.relative(I.fsPath,this.uri().fsPath)}async isFolder(){return(await this.ctx.fs.stat(this.b6pUri())).type==="directory"}async isFile(){return!await this.isFolder()}async copyDraftFileToBuild(){if(await this.isInItsRespectiveBuildFolder())throw new wS.Err.BuildFolderOperationError("copy",this.path());if(!await this.isCopacetic())throw new wS.Err.ScriptNotCopaceticError;let T=await this.getClosestTsConfigFile(),I=T.folder().uri().joinPath(await T.relativePathToBuildFolder(),await this.pathWithRespectToTsConfigFolder());await this.copyTo(I)}async readContents(){return await this.ctx.fs.readFile(this.b6pUri())}async copyTo(T){if(await this.isInItsRespectiveBuildFolder())throw new wS.Err.BuildFolderOperationError("copy",this.path());if(!await this.isCopacetic())throw new wS.Err.ScriptNotCopaceticError;await this.ctx.fs.copy(this.b6pUri(),T,{overwrite:!0})}async delete(){if(await this.isCopacetic())await this.ctx.fs.delete(this.b6pUri(),{recursive:!0}),this._exists=!1;else throw new wS.Err.ScriptNotCopaceticError}async rename(T){if(await this.isCopacetic(),this.uri().fsPath===this.scriptRoot.getRootUri().fsPath)throw new wS.Err.ScriptOperationError("Cannot rename the script root folder; the folder name is used as a metadata lookup key.");if(this.name()===T){this.ctx.logger.info("Ignoring rename operation; new name is the same as the current name.");return}let W=this.uri().dirname.joinPath(T);await this.ctx.fs.rename(this.uri(),W)}};bC.ScriptNode=_1e});var YK=Qa(SC=>{"use strict";var U1t=SC&&SC.__createBinding||(Object.create?(function(ie,T,I,W){W===void 0&&(W=I);var ne=Object.getOwnPropertyDescriptor(T,I);(!ne||("get"in ne?!T.__esModule:ne.writable||ne.configurable))&&(ne={enumerable:!0,get:function(){return T[I]}}),Object.defineProperty(ie,W,ne)}):(function(ie,T,I,W){W===void 0&&(W=I),ie[W]=T[I]})),W1t=SC&&SC.__setModuleDefault||(Object.create?(function(ie,T){Object.defineProperty(ie,"default",{enumerable:!0,value:T})}):function(ie,T){ie.default=T}),z1t=SC&&SC.__importStar||(function(){var ie=function(T){return ie=Object.getOwnPropertyNames||function(I){var W=[];for(var ne in I)Object.prototype.hasOwnProperty.call(I,ne)&&(W[W.length]=ne);return W},ie(T)};return function(T){if(T&&T.__esModule)return T;var I={};if(T!=null)for(var W=ie(T),ne=0;ne<W.length;ne++)W[ne]!=="default"&&U1t(I,T,W[ne]);return W1t(I,T),I}})();Object.defineProperty(SC,"__esModule",{value:!0});SC.ScriptFile=void 0;var II=z1t(require("path")),V1t=require("node:crypto"),Yd=Ch(),S1=Cm(),QK=LB(),q1t=XK(),H1t=Y7(),f1e=ES(),p1e=class ie extends q1t.ScriptNode{static ComplexEtagPattern=/^"?\d{10,13}-\{.*?"class":\s*"myassn\.document\.(Proxy|LibraryServlet)MemoryDocumentKey".*?"classId":\s*\d+.*?\}"?$/;static NumericEtagPattern=/^(?:W\/)?"?\d{10,13}-[\d_]+"?$/;static EtagPattern=/^"[a-f0-9]{128}"$/;static WeakEtagPattern=/^W\/"[a-f0-9]{128}"$/;createFamilial(T){if(!this.scriptRoot.getAsFolder().contains(T))throw new S1.Err.ScriptOperationError("The provided URI is not a proper sibling within the same script root.");return new ie(T,this.scriptRoot)}_reasonToNotPush;async getHash(){await this.requireExists();let T=await this.ctx.fs.readFile(f1e.B6PUri.fromFsPath(this.uri().fsPath));return ie.computeHash(T)}static async computeHash(T){let I=await V1t.webcrypto.subtle.digest(Yd.CryptoAlgorithms.SHA_512,T),W=Array.from(new Uint8Array(I));if(W.length!==64)throw new S1.Err.HashCalculationError;return W.map(ne=>ne.toString(16).padStart(2,"0")).join("").toLowerCase()}async getUpstairsHash(T){let I=await this.ctx.sessionManager.fetch(T?.upstairsOverride||await this.upstairsUrl(),{method:Yd.Http.Methods.HEAD}),W=this.hashFromEtag(I.headers.get(Yd.Http.Headers.ETAG));if(!W){if(T?.required)throw new S1.Err.HashCalculationError;return null}return W}hashFromEtag(T){let I=null;return ie.EtagPattern.test(T||"")?I=JSON.parse(T?.toLowerCase()||"null"):ie.WeakEtagPattern.test(T||"")?(this.ctx.logger.debug("weak etagHeader:",T),I=JSON.parse(T?.substring(2).toLowerCase()||"null")):ie.NumericEtagPattern.test(T||"")?this.ctx.logger.debug("numeric etagHeader:",T):this.ctx.logger.debug("complex etagHeader:",T),I?I.toLowerCase():null}async getLastVerifiedHash(){await this.requireExists();let T=await this.getScriptRoot().getMetaData();if(!T)return null;let I=T.pushPullRecords.find(W=>W.downstairsPath===this.uri().fsPath);return I?I.lastVerifiedHash:null}async currentIntegrityStatus(T){let I=await this.getHash(),W=await this.getUpstairsHash(T),ne=W===null?"indeterminate":I===W?"match":"mismatch";return this.ctx.logger.debug("filename:",this.name(),`
|
|
469
469
|
`,"status:",ne,`
|
|
470
470
|
`,"local:",I,`
|
|
471
471
|
`,"upstairs:",W),ne}async readBackStatus(T){let I=await this.ctx.sessionManager.fetch(T,{method:Yd.Http.Methods.HEAD});if(I.status===QK.ResponseCodes.NOT_FOUND)return"missing";if(!I.ok)return this.ctx.logger.debug("read-back of",T.href,"answered",I.status),"unreadable";let W=this.hashFromEtag(I.headers.get(Yd.Http.Headers.ETAG));return W===null?"indeterminate":W===await this.getHash()?"match":"mismatch"}async currentIntegrityMatches(T){return await this.currentIntegrityStatus(T)==="match"}async platformChangeAtRisk(T){if(this.isInSnapshot()||await this.isInItsRespectiveBuildFolder())return null;let I=await this.ctx.sessionManager.fetch(T??await this.upstairsUrl(),{method:Yd.Http.Methods.HEAD});if(I.status===QK.ResponseCodes.NOT_FOUND)return null;let W=this.hashFromEtag(I.headers.get(Yd.Http.Headers.ETAG)),ne=await this.getLastVerifiedHash();return W!==null&&(W===await this.getHash()||W===ne)?null:ne?"changed":"unsynced"}async oldIntegrityMatches(T){let I=await this.getLastVerifiedHash();if(!I)return!1;let W=await this.getUpstairsHash(T),ne=I===W;return this.ctx.logger.debug("filename:",this.name(),`
|
|
@@ -683,7 +683,7 @@ try {
|
|
|
683
683
|
Write-Output '[]'
|
|
684
684
|
}
|
|
685
685
|
exit 0
|
|
686
|
-
`;var VD=Vv(require("fs")),KRe=Vv(require("os")),zD=Vv(require("path")),Kbt="ts-libs.json",ZRe="lib.d.ts";function eje(){let ie=Zbt();if(ie?.isSea()){let I=eSt(ie);return I?[I]:[]}let T=zD.join(__dirname,"lib");return VD.existsSync(zD.join(T,ZRe))?[T]:[]}function Zbt(){try{return require("node:sea")}catch{return}}function eSt(ie){try{let T=JSON.parse(ie.getAsset(Kbt,"utf8")),I=zD.join(KRe.tmpdir(),"b6p-ts-libs","0.8.
|
|
686
|
+
`;var VD=Vv(require("fs")),KRe=Vv(require("os")),zD=Vv(require("path")),Kbt="ts-libs.json",ZRe="lib.d.ts";function eje(){let ie=Zbt();if(ie?.isSea()){let I=eSt(ie);return I?[I]:[]}let T=zD.join(__dirname,"lib");return VD.existsSync(zD.join(T,ZRe))?[T]:[]}function Zbt(){try{return require("node:sea")}catch{return}}function eSt(ie){try{let T=JSON.parse(ie.getAsset(Kbt,"utf8")),I=zD.join(KRe.tmpdir(),"b6p-ts-libs","0.8.2");VD.mkdirSync(I,{recursive:!0});for(let[W,ne]of Object.entries(T)){if(zD.basename(W)!==W||!W.startsWith("lib.")||!W.endsWith(".d.ts"))continue;let Re=zD.join(I,W);VD.existsSync(Re)||VD.writeFileSync(Re,ne)}return VD.existsSync(zD.join(I,ZRe))?I:void 0}catch{return}}function tje(ie){return ie&&(!ie.pushed||!ie.historyRecorded||ie.liveVerified===!1||ie.typeCheckDiagnostics!==null&&ie.typeCheckDiagnostics>0)?1:0}function rje(ie){return{...ie,declinedOverwrites:[]}}function nje(ie){return{pushed:!1,historyRecorded:!1,typeCheckDiagnostics:null,liveVerified:null,liveMismatches:[],keptPlatformOnly:[],declinedOverwrites:[...ie]}}function ije(ie=process.platform,T=process.env){return ie!=="win32"||T.MSYSTEM||T.SHELL?"posix":"powershell"}function sje(ie,T){return(T==="posix"?/^[A-Za-z0-9_\-./:%+,@][A-Za-z0-9_\-./:=%+,@]*$/:/^[A-Za-z0-9_\-./:=%+]+$/).test(ie)?ie:`'${T==="posix"?ie.replace(/'/g,"'\\''"):ie.replace(/'/g,"''")}'`}function aje(ie,T,I){return["b6p",...[...ie,...T.flatMap(ne=>["--overwrite",ne])].map(ne=>sje(ne,I))].join(" ")}function oje(ie,T){let W=["b6p",...ie.filter(ne=>ne!=="--yes").map(ne=>sje(ne,T))].join(" ");return T==="posix"?`printf 'Yes\\n' | ${W}`:`'Yes' | ${W}`}function nw(ie){return RI.resolve(process.cwd(),ie)}async function NS(ie,T="Working\u2026"){let I=new uZ({autoYes:ie.yes,json:ie.json}),W=new _Z({verbose:ie.verbose}),ne=new fZ({quiet:ie.quiet||ie.json}),Re=new pZ(T,{enabled:!ie.json&&!ie.quiet&&process.stderr.isTTY===!0});I.setActivityPauser(Re),W.setActivityPauser(Re),ne.setActivityPauser(Re);let _t=new lje.SharedFilePersistence(void 0,new dZ);await tSt(_t);let Qt=new mZ.B6PCore({fs:new cZ,persistence:_t,prompt:I,logger:W,progress:ne,typescriptLibDirs:eje()});return Re.start(),{core:Qt,prompt:I,logger:W,spinner:Re}}async function tSt(ie){let T=RI.join(cje.homedir(),".b6p"),I=RI.join(T,"secrets.json"),W=RI.join(T,"state");await ie.seedIfMissing({publicEntries:async()=>{let ne=[];try{let _t=await HB.readdir(W);for(let Qt of _t){if(!Qt.endsWith(".json"))continue;let Br=RI.join(W,Qt);try{let nn=await HB.readFile(Br,"utf-8"),gn=JSON.parse(nn);ne.push({size:nn.length,data:gn})}catch{}}}catch{}ne.sort((_t,Qt)=>_t.size-Qt.size);let Re={};for(let _t of ne)Object.assign(Re,_t.data);return Re},secretEntries:async()=>{try{let ne=await HB.readFile(I,"utf-8");return JSON.parse(ne)}catch{return{}}}})}var qp=new uLe("b6p").description("BlueStep B6P script management CLI").version("0.8.2").option("--yes","Answer every confirmation with its default and print what it answered. Overwrite and delete questions default to Cancel/No, so --yes never overwrites or deletes platform files (see push --overwrite)").option("--json","Machine-readable JSON output").option("--verbose","Verbose logging").option("--quiet","Suppress progress output"),rSt=`
|
|
687
687
|
Questions a push can ask (both default to the safe answer, which --yes and an empty answer take):
|
|
688
688
|
1. Before uploading anything, when files would overwrite a platform version nobody here has
|
|
689
689
|
seen: [Cancel] / Overwrite all. Cancel stops the push with nothing uploaded (exit 1).
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bluestep-systems/b6p-cli",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.2",
|
|
4
4
|
"description": "Command-line interface for BlueStep B6P script management",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://github.com/Bluestep-Systems/b6p-cli#readme",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"prepublishOnly": "npm run clean && npm run check-types && npm run compile"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@bluestep-systems/b6p-core": "^0.8.
|
|
40
|
+
"@bluestep-systems/b6p-core": "^0.8.1",
|
|
41
41
|
"@types/node": "^22.20.1",
|
|
42
42
|
"commander": "^14.0.3",
|
|
43
43
|
"esbuild": "^0.27.4",
|