Merge branch 'main' into rvermeulen/extend-init-complete-status-report

Signed-off-by: Remco Vermeulen <rvermeulen@github.com>
This commit is contained in:
Remco Vermeulen 2024-08-02 15:12:59 -07:00
commit 0f24d46599
32 changed files with 401 additions and 373 deletions

View file

@ -60,10 +60,9 @@ jobs:
- id: init
uses: ./../action/init
with:
# Swift is not supported on Ubuntu so we manually exclude it from the list here
languages: cpp,csharp,go,java,javascript,python,ruby
tools: ${{ steps.prepare-test.outputs.tools-url }}
- uses: ./../action/.github/actions/setup-swift
with:
codeql-path: ${{ steps.init.outputs.codeql-path }}
- name: Build code
shell: bash
run: ./build.sh

View file

@ -74,10 +74,6 @@ jobs:
exit 1
fi
- uses: ./../action/.github/actions/setup-swift
with:
codeql-path: ${{ steps.init.outputs.codeql-path }}
- name: Build code
shell: bash
run: ./build.sh

View file

@ -86,7 +86,7 @@ jobs:
run: |
cd "$RUNNER_TEMP/results"
expected_baseline_languages="c csharp go java kotlin javascript python ruby"
if [[ $RUNNER_OS != "Windows" ]]; then
if [[ $RUNNER_OS == "macOS" ]]; then
expected_baseline_languages+=" swift"
fi

View file

@ -29,14 +29,24 @@ jobs:
include:
- os: macos-12
version: stable-20230403
- os: ubuntu-latest
version: stable-20230403
- os: macos-12
version: stable-v2.13.5
- os: ubuntu-latest
version: stable-v2.13.5
- os: macos-12
version: stable-v2.14.6
- os: ubuntu-latest
version: stable-v2.14.6
- os: macos-latest
version: stable-v2.15.5
- os: ubuntu-latest
version: stable-v2.15.5
- os: macos-latest
version: stable-v2.16.6
- os: ubuntu-latest
version: stable-v2.16.6
- os: macos-latest
version: default
- os: ubuntu-latest
@ -85,9 +95,13 @@ jobs:
id: init
with:
db-location: ${{ runner.temp }}/customDbLocation
# Swift is not supported on Ubuntu so we manually exclude it from the list here
languages: ${{ runner.os == 'Linux' && 'cpp,csharp,go,java,javascript,python,ruby'
|| '' }}
tools: ${{ steps.prepare-test.outputs.tools-url }}
- uses: ./../action/.github/actions/setup-swift
if: runner.os == 'macOS'
with:
codeql-path: ${{ steps.init.outputs.codeql-path }}
@ -139,8 +153,8 @@ jobs:
exit 1
fi
- name: Check language autodetect for Swift
if: runner.os != 'Windows' && matrix.version != 'stable-20230403'
- name: Check language autodetect for Swift on MacOS
if: runner.os == 'macOS' && matrix.version != 'stable-20230403'
shell: bash
run: |
SWIFT_DB=${{ fromJson(steps.analysis.outputs.db-locations).swift }}

View file

@ -1,104 +0,0 @@
# Warning: This file is generated automatically, and should not be modified.
# Instead, please modify the template in the pr-checks directory and run:
# (cd pr-checks; pip install ruamel.yaml@0.17.31 && python3 sync.py)
# to regenerate this file.
name: PR Check - Scaling reserved RAM
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GO111MODULE: auto
on:
push:
branches:
- main
- releases/v*
pull_request:
types:
- opened
- synchronize
- reopened
- ready_for_review
schedule:
- cron: '0 5 * * *'
workflow_dispatch: {}
jobs:
scaling-reserved-ram:
strategy:
fail-fast: false
matrix:
include:
- os: macos-12
version: stable-20230403
- os: macos-12
version: stable-v2.13.5
- os: macos-12
version: stable-v2.14.6
- os: macos-latest
version: stable-v2.15.5
- os: macos-latest
version: stable-v2.16.6
- os: macos-latest
version: default
- os: ubuntu-latest
version: default
- os: macos-latest
version: linked
- os: ubuntu-latest
version: linked
- os: macos-latest
version: nightly-latest
- os: ubuntu-latest
version: nightly-latest
name: Scaling reserved RAM
permissions:
contents: read
security-events: write
timeout-minutes: 45
runs-on: ${{ matrix.os }}
steps:
- name: Setup Python on MacOS
uses: actions/setup-python@v5
if: >-
runner.os == 'macOS' && (
matrix.version == 'stable-20230403' ||
matrix.version == 'stable-v2.13.5' ||
matrix.version == 'stable-v2.14.6')
with:
python-version: '3.11'
- name: Check out repository
uses: actions/checkout@v4
- name: Prepare test
id: prepare-test
uses: ./.github/actions/prepare-test
with:
version: ${{ matrix.version }}
use-all-platform-bundle: 'false'
setup-kotlin: 'true'
- uses: actions/setup-go@v5
with:
go-version: '>=1.21.0'
- uses: ./../action/init
id: init
with:
db-location: ${{ runner.temp }}/customDbLocation
tools: ${{ steps.prepare-test.outputs.tools-url }}
- uses: ./../action/.github/actions/setup-swift
with:
codeql-path: ${{ steps.init.outputs.codeql-path }}
- name: Build code
shell: bash
run: ./build.sh
- uses: ./../action/analyze
id: analysis
with:
upload-database: false
env:
CODEQL_ACTION_SCALING_RESERVED_RAM: true
CODEQL_ACTION_TEST_MODE: true

View file

@ -29,16 +29,10 @@ jobs:
include:
- os: macos-latest
version: linked
- os: ubuntu-latest
version: linked
- os: macos-latest
version: default
- os: ubuntu-latest
version: default
- os: macos-latest
version: nightly-latest
- os: ubuntu-latest
version: nightly-latest
name: Swift analysis using a custom build command
permissions:
contents: read

View file

@ -66,10 +66,9 @@ jobs:
- id: init
uses: ./../action/init
with:
# Swift is not supported on Ubuntu so we manually exclude it from the list here
languages: cpp,csharp,go,java,javascript,python,ruby
tools: ./codeql-bundle-linux64.tar.gz
- uses: ./../action/.github/actions/setup-swift
with:
codeql-path: ${{ steps.init.outputs.codeql-path }}
- name: Build code
shell: bash
run: ./build.sh

View file

@ -27,6 +27,16 @@ jobs:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
version: stable-20230403
- os: ubuntu-latest
version: stable-v2.13.5
- os: ubuntu-latest
version: stable-v2.14.6
- os: ubuntu-latest
version: stable-v2.15.5
- os: ubuntu-latest
version: stable-v2.16.6
- os: ubuntu-latest
version: default
- os: ubuntu-latest
@ -65,10 +75,9 @@ jobs:
id: init
with:
db-location: ${{ runner.temp }}/customDbLocation
# Swift is not supported on Ubuntu so we manually exclude it from the list here
languages: cpp,csharp,go,java,javascript,python,ruby
tools: ${{ steps.prepare-test.outputs.tools-url }}
- uses: ./../action/.github/actions/setup-swift
with:
codeql-path: ${{ steps.init.outputs.codeql-path }}
- uses: actions/setup-go@v5
with:
go-version: '>=1.21.0'

View file

@ -52,9 +52,8 @@ jobs:
debug: true
debug-artifact-name: my-debug-artifacts
debug-database-name: my-db
- uses: ./../action/.github/actions/setup-swift
with:
codeql-path: ${{ steps.init.outputs.codeql-path }}
# We manually exclude Swift from the languages list here, as it is not supported on Ubuntu
languages: cpp,csharp,go,java,javascript,python,ruby
- name: Build code
shell: bash
run: ./build.sh

View file

@ -2,7 +2,6 @@ name: PR Checks
on:
push:
branches: [main, releases/v*]
pull_request:
# Run checks on reopened draft PRs to support triggering PR checks on draft PRs that were opened
# by other workflows.
@ -53,6 +52,7 @@ jobs:
run: .github/workflows/script/check-js.sh
check-node-modules:
if: github.event_name != 'push' || github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/releases/v')
name: Check modules up to date
runs-on: macos-latest
timeout-minutes: 45
@ -63,6 +63,7 @@ jobs:
run: .github/workflows/script/check-node-modules.sh
check-file-contents:
if: github.event_name != 'push' || github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/releases/v')
name: Check file contents
runs-on: ubuntu-latest
timeout-minutes: 45
@ -87,6 +88,7 @@ jobs:
run: .github/workflows/script/verify-pr-checks.sh
npm-test:
if: github.event_name != 'push' || github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/releases/v')
name: Unit Test
needs: [check-js, check-node-modules]
strategy:
@ -106,7 +108,7 @@ jobs:
npm test
check-node-version:
if: ${{ github.event.pull_request }}
if: github.event.pull_request
name: Check Action Node versions
runs-on: ubuntu-latest
timeout-minutes: 45

View file

@ -42,10 +42,9 @@ jobs:
- id: init
uses: ./../action/init
with:
# We manually exclude Swift from the languages list here, as it is not supported on Ubuntu
languages: cpp,csharp,go,java,javascript,python,ruby
tools: ${{ steps.prepare-test.outputs.tools-url }}
- uses: ./../action/.github/actions/setup-swift
with:
codeql-path: ${{ steps.init.outputs.codeql-path }}
- name: Build code
shell: bash
run: ./build.sh

View file

@ -6,7 +6,7 @@ Note that the only difference between `v2` and `v3` of the CodeQL Action is the
## [UNRELEASED]
No user facing changes.
- _Deprecation:_ Swift analysis on Ubuntu runner images is no longer supported. Please migrate to a macOS runner if this affects you. [#2403](https://github.com/github/codeql-action/pull/2403)
## 3.25.15 - 26 Jul 2024
@ -14,7 +14,7 @@ No user facing changes.
## 3.25.14 - 25 Jul 2024
- Experimental: add a new `start-proxy` action which starts the same HTTP proxy as used by [`github/dependabot-action`](https://github.com/github/dependabot-action). Do not use this in production as it is part of an internal experiment and subject to change at any time.
- Experimental: add a new `start-proxy` action which starts the same HTTP proxy as used by [`github/dependabot-action`](https://github.com/github/dependabot-action). Do not use this in production as it is part of an internal experiment and subject to change at any time. [#2376](https://github.com/github/codeql-action/pull/2376)
## 3.25.13 - 19 Jul 2024

4
lib/init-action.js generated
View file

@ -210,6 +210,10 @@ async function run() {
core.exportVariable("GOFLAGS", goFlags);
core.warning("Passing the GOFLAGS env parameter to the init action is deprecated. Please move this to the analyze action.");
}
if (config.languages.includes(languages_1.Language.swift) &&
process.platform === "linux") {
logger.warning(`Swift analysis on Ubuntu runner images is no longer supported. Please migrate to a macOS runner if this affects you.`);
}
if (config.languages.includes(languages_1.Language.go) &&
process.platform === "linux") {
try {

File diff suppressed because one or more lines are too long

12
node_modules/.package-lock.json generated vendored
View file

@ -455,9 +455,9 @@
}
},
"node_modules/@eslint/js": {
"version": "9.7.0",
"resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.7.0.tgz",
"integrity": "sha512-ChuWDQenef8OSFnvuxv0TCVxEwmu3+hPNKvM9B34qpM0rDRbjL8t5QkQeHHeAfsKQjuH9wS82WeCi1J/owatng==",
"version": "9.8.0",
"resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.8.0.tgz",
"integrity": "sha512-MfluB7EUfxXtv3i/++oh89uzAr4PDI4nn201hsp+qaXqsjAWzinlZEHEfPgAX4doIlKvPG/i0A9dpKxOLII8yA==",
"dev": true,
"engines": {
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
@ -5659,9 +5659,9 @@
}
},
"node_modules/typescript": {
"version": "5.5.3",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.5.3.tgz",
"integrity": "sha512-/hreyEujaB0w76zKo6717l3L0o/qEUtRgdvUBvlkhoWeOVMjMuHNHk0BRBzikzuGDqNmPQbg5ifMEqsHLiIUcQ==",
"version": "5.5.4",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.5.4.tgz",
"integrity": "sha512-Mtq29sKDAEYP7aljRgtPOpTvOfbwRWlS6dPRzwjdE+C0R4brX/GUyhHSecbHMFLNBLcJIPt9nl9yG5TZ1weH+Q==",
"dev": true,
"bin": {
"tsc": "bin/tsc",

View file

@ -1,6 +1,6 @@
{
"name": "@eslint/js",
"version": "9.7.0",
"version": "9.8.0",
"description": "ESLint JavaScript language implementation",
"main": "./src/index.js",
"scripts": {},

View file

@ -203,7 +203,7 @@ interface Int8Array {
/**
* Copies the array and returns the copy with the elements in reverse order.
*/
toReversed(): Uint8Array;
toReversed(): Int8Array;
/**
* Copies and sorts the array.
@ -211,11 +211,11 @@ interface Int8Array {
* a negative value if the first argument is less than the second argument, zero if they're equal, and a positive
* value otherwise. If omitted, the elements are sorted in ascending order.
* ```ts
* const myNums = Uint8Array.from([11, 2, 22, 1]);
* myNums.toSorted((a, b) => a - b) // Uint8Array(4) [1, 2, 11, 22]
* const myNums = Int8Array.from([11, 2, 22, 1]);
* myNums.toSorted((a, b) => a - b) // Int8Array(4) [1, 2, 11, 22]
* ```
*/
toSorted(compareFn?: (a: number, b: number) => number): Uint8Array;
toSorted(compareFn?: (a: number, b: number) => number): Int8Array;
/**
* Copies the array and inserts the given number at the provided index.
@ -224,7 +224,7 @@ interface Int8Array {
* @param value The value to insert into the copied array.
* @returns A copy of the original array with the inserted value.
*/
with(index: number, value: number): Uint8Array;
with(index: number, value: number): Int8Array;
}
interface Uint8Array {

205
node_modules/typescript/lib/tsc.js generated vendored
View file

@ -18,7 +18,7 @@ and limitations under the License.
// src/compiler/corePublic.ts
var versionMajorMinor = "5.5";
var version = "5.5.3";
var version = "5.5.4";
// src/compiler/core.ts
var emptyArray = [];
@ -2509,10 +2509,12 @@ function tryGetPerformance() {
if (isNodeLikeSystem()) {
try {
const { performance: performance2 } = require("perf_hooks");
return {
shouldWriteNativeEvents: false,
performance: performance2
};
if (performance2) {
return {
shouldWriteNativeEvents: false,
performance: performance2
};
}
} catch {
}
}
@ -8547,6 +8549,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
var tokenFlags;
var commentDirectives;
var skipJsDocLeadingAsterisks = 0;
var asteriskSeen = false;
var scriptKind = 0 /* Unknown */;
var jsDocParsingMode = 0 /* ParseAll */;
setText(text, start, length2);
@ -8598,6 +8601,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
resetTokenState,
setTextPos: resetTokenState,
setSkipJsDocLeadingAsterisks,
hasLeadingAsterisks,
tryScan,
lookAhead,
scanRange
@ -9204,7 +9208,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
function scan() {
fullStartPos = pos;
tokenFlags = 0 /* None */;
let asteriskSeen = false;
asteriskSeen = false;
while (true) {
tokenStart = pos;
if (pos >= end) {
@ -11007,6 +11011,9 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
function setSkipJsDocLeadingAsterisks(skip) {
skipJsDocLeadingAsterisks += skip ? 1 : -1;
}
function hasLeadingAsterisks() {
return asteriskSeen;
}
}
function codePointAt(s, i) {
return s.codePointAt(i);
@ -12745,7 +12752,7 @@ function getTokenPosOfNode(node, sourceFile, includeJsDoc) {
}
if (isJSDocNode(node) || node.kind === 12 /* JsxText */) {
return skipTrivia(
(sourceFile || getSourceFileOfNode(node)).text,
(sourceFile ?? getSourceFileOfNode(node)).text,
node.pos,
/*stopAfterLineBreak*/
false,
@ -12757,13 +12764,14 @@ function getTokenPosOfNode(node, sourceFile, includeJsDoc) {
return getTokenPosOfNode(node.jsDoc[0], sourceFile);
}
if (node.kind === 352 /* SyntaxList */) {
const first2 = firstOrUndefined(getNodeChildren(node));
sourceFile ?? (sourceFile = getSourceFileOfNode(node));
const first2 = firstOrUndefined(getNodeChildren(node, sourceFile));
if (first2) {
return getTokenPosOfNode(first2, sourceFile, includeJsDoc);
}
}
return skipTrivia(
(sourceFile || getSourceFileOfNode(node)).text,
(sourceFile ?? getSourceFileOfNode(node)).text,
node.pos,
/*stopAfterLineBreak*/
false,
@ -16086,11 +16094,11 @@ function getOwnEmitOutputFilePath(fileName, host, extension) {
return emitOutputFilePathWithoutExtension + extension;
}
function getDeclarationEmitOutputFilePath(fileName, host) {
return getDeclarationEmitOutputFilePathWorker(fileName, host.getCompilerOptions(), host.getCurrentDirectory(), host.getCommonSourceDirectory(), (f) => host.getCanonicalFileName(f));
return getDeclarationEmitOutputFilePathWorker(fileName, host.getCompilerOptions(), host);
}
function getDeclarationEmitOutputFilePathWorker(fileName, options, currentDirectory, commonSourceDirectory, getCanonicalFileName) {
function getDeclarationEmitOutputFilePathWorker(fileName, options, host) {
const outputDir = options.declarationDir || options.outDir;
const path = outputDir ? getSourceFilePathInNewDirWorker(fileName, outputDir, currentDirectory, commonSourceDirectory, getCanonicalFileName) : fileName;
const path = outputDir ? getSourceFilePathInNewDirWorker(fileName, outputDir, host.getCurrentDirectory(), host.getCommonSourceDirectory(), (f) => host.getCanonicalFileName(f)) : fileName;
const declarationExtension = getDeclarationEmitExtensionForPath(path);
return removeFileExtension(path) + declarationExtension;
}
@ -23436,7 +23444,7 @@ function createNodeFactory(flags, baseFactory2) {
}
function createSyntaxList(children) {
const node = createBaseNode(352 /* SyntaxList */);
setNodeChildren(node, children);
node._children = children;
return node;
}
function createNotEmittedStatement(original) {
@ -26204,17 +26212,31 @@ function isJSDocImportTag(node) {
}
// src/compiler/factory/nodeChildren.ts
var nodeChildren = /* @__PURE__ */ new WeakMap();
function getNodeChildren(node) {
if (!isNodeKind(node.kind)) return emptyArray;
return nodeChildren.get(node);
var sourceFileToNodeChildren = /* @__PURE__ */ new WeakMap();
function getNodeChildren(node, sourceFile) {
var _a;
const kind = node.kind;
if (!isNodeKind(kind)) {
return emptyArray;
}
if (kind === 352 /* SyntaxList */) {
return node._children;
}
return (_a = sourceFileToNodeChildren.get(sourceFile)) == null ? void 0 : _a.get(node);
}
function setNodeChildren(node, children) {
nodeChildren.set(node, children);
return children;
function unsetNodeChildren(node, origSourceFile) {
var _a;
if (node.kind === 352 /* SyntaxList */) {
Debug.fail("Did not expect to unset the children of a SyntaxList.");
}
(_a = sourceFileToNodeChildren.get(origSourceFile)) == null ? void 0 : _a.delete(node);
}
function unsetNodeChildren(node) {
nodeChildren.delete(node);
function transferSourceFileChildren(sourceFile, targetSourceFile) {
const map2 = sourceFileToNodeChildren.get(sourceFile);
if (map2 !== void 0) {
sourceFileToNodeChildren.delete(sourceFile);
sourceFileToNodeChildren.set(targetSourceFile, map2);
}
}
// src/compiler/factory/utilities.ts
@ -28849,7 +28871,7 @@ var Parser;
function createIdentifier(isIdentifier3, diagnosticMessage, privateIdentifierDiagnosticMessage) {
if (isIdentifier3) {
identifierCount++;
const pos = getNodePos();
const pos = scanner.hasLeadingAsterisks() ? scanner.getTokenStart() : getNodePos();
const originalKeywordKind = token();
const text = internIdentifier(scanner.getTokenValue());
const hasExtendedUnicodeEscape = scanner.hasExtendedUnicodeEscape();
@ -34785,6 +34807,7 @@ var IncrementalParser;
aggressiveChecks
);
result.impliedNodeFormat = sourceFile.impliedNodeFormat;
transferSourceFileChildren(sourceFile, result);
return result;
}
IncrementalParser2.updateSourceFile = updateSourceFile;
@ -34820,7 +34843,7 @@ var IncrementalParser;
}
}
}
function moveElementEntirelyPastChangeRange(element, isArray2, delta, oldText, newText, aggressiveChecks) {
function moveElementEntirelyPastChangeRange(element, origSourceFile, isArray2, delta, oldText, newText, aggressiveChecks) {
if (isArray2) {
visitArray2(element);
} else {
@ -34832,7 +34855,7 @@ var IncrementalParser;
if (aggressiveChecks && shouldCheckNode(node)) {
text = oldText.substring(node.pos, node.end);
}
unsetNodeChildren(node);
unsetNodeChildren(node, origSourceFile);
setTextRangePosEnd(node, node.pos + delta, node.end + delta);
if (aggressiveChecks && shouldCheckNode(node)) {
Debug.assert(text === newText.substring(node.pos, node.end));
@ -34906,6 +34929,7 @@ var IncrementalParser;
if (child.pos > changeRangeOldEnd) {
moveElementEntirelyPastChangeRange(
child,
sourceFile,
/*isArray*/
false,
delta,
@ -34918,7 +34942,7 @@ var IncrementalParser;
const fullEnd = child.end;
if (fullEnd >= changeStart) {
markAsIntersectingIncrementalChange(child);
unsetNodeChildren(child);
unsetNodeChildren(child, sourceFile);
adjustIntersectingElement(child, changeStart, changeRangeOldEnd, changeRangeNewEnd, delta);
forEachChild(child, visitNode3, visitArray2);
if (hasJSDocNodes(child)) {
@ -34936,6 +34960,7 @@ var IncrementalParser;
if (array.pos > changeRangeOldEnd) {
moveElementEntirelyPastChangeRange(
array,
sourceFile,
/*isArray*/
true,
delta,
@ -35636,7 +35661,6 @@ var commonOptionsWithBuild = [
affectsBuildInfo: true,
showInSimplifiedHelpView: true,
category: Diagnostics.Emit,
transpileOptionValue: void 0,
defaultValueDescription: false,
description: Diagnostics.Create_sourcemaps_for_d_ts_files
},
@ -35962,6 +35986,7 @@ var commandOptionsWithoutBuild = [
type: "boolean",
affectsEmit: true,
affectsBuildInfo: true,
affectsSourceFile: true,
category: Diagnostics.Emit,
description: Diagnostics.Allow_importing_helper_functions_from_tslib_once_per_project_instead_of_including_them_per_file,
defaultValueDescription: false
@ -36426,6 +36451,7 @@ var commandOptionsWithoutBuild = [
affectsEmit: true,
affectsBuildInfo: true,
affectsModuleResolution: true,
affectsSourceFile: true,
category: Diagnostics.Language_and_Environment,
description: Diagnostics.Specify_module_specifier_used_to_import_the_JSX_factory_functions_when_using_jsx_Colon_react_jsx_Asterisk,
defaultValueDescription: "react"
@ -45124,7 +45150,8 @@ function createTypeChecker(host) {
isUndefinedIdentifierExpression(node) {
Debug.assert(isExpressionNode(node));
return getSymbolAtLocation(node) === undefinedSymbol;
}
},
isDefinitelyReferenceToGlobalSymbolObject
});
var evaluate = createEvaluator({
evaluateElementAccessExpression,
@ -45954,6 +45981,7 @@ function createTypeChecker(host) {
};
var amalgamatedDuplicates;
var reverseMappedCache = /* @__PURE__ */ new Map();
var reverseHomomorphicMappedCache = /* @__PURE__ */ new Map();
var ambientModulesCache;
var patternAmbientModules;
var patternAmbientModuleAugmentations;
@ -46081,6 +46109,21 @@ function createTypeChecker(host) {
];
initializeTypeChecker();
return checker;
function isDefinitelyReferenceToGlobalSymbolObject(node) {
if (!isPropertyAccessExpression(node)) return false;
if (!isIdentifier(node.name)) return false;
if (!isPropertyAccessExpression(node.expression) && !isIdentifier(node.expression)) return false;
if (isIdentifier(node.expression)) {
return idText(node.expression) === "Symbol" && getResolvedSymbol(node.expression) === (getGlobalSymbol(
"Symbol",
111551 /* Value */ | 1048576 /* ExportValue */,
/*diagnostic*/
void 0
) || unknownSymbol);
}
if (!isIdentifier(node.expression.expression)) return false;
return idText(node.expression.name) === "Symbol" && idText(node.expression.expression) === "globalThis" && getResolvedSymbol(node.expression.expression) === globalThisSymbol;
}
function getCachedType(key) {
return key ? cachedTypes.get(key) : void 0;
}
@ -49293,11 +49336,11 @@ function createTypeChecker(host) {
function tryReuseExistingTypeNode(context, typeNode, type, host2, addUndefined) {
const originalType = type;
if (addUndefined) {
type = getOptionalType(type);
type = getOptionalType(type, !isParameter(host2));
}
const clone = tryReuseExistingNonParameterTypeNode(context, typeNode, type, host2);
if (clone) {
if (addUndefined && !someType(getTypeFromTypeNode2(context, typeNode), (t) => !!(t.flags & 32768 /* Undefined */))) {
if (addUndefined && containsNonMissingUndefinedType(type) && !someType(getTypeFromTypeNode2(context, typeNode), (t) => !!(t.flags & 32768 /* Undefined */))) {
return factory.createUnionTypeNode([clone, factory.createKeywordTypeNode(157 /* UndefinedKeyword */)]);
}
return clone;
@ -50157,7 +50200,21 @@ function createTypeChecker(host) {
}
function shouldUsePlaceholderForProperty(propertySymbol, context) {
var _a;
return !!(getCheckFlags(propertySymbol) & 8192 /* ReverseMapped */) && (contains(context.reverseMappedStack, propertySymbol) || ((_a = context.reverseMappedStack) == null ? void 0 : _a[0]) && !(getObjectFlags(last(context.reverseMappedStack).links.propertyType) & 16 /* Anonymous */));
const depth = 3;
return !!(getCheckFlags(propertySymbol) & 8192 /* ReverseMapped */) && (contains(context.reverseMappedStack, propertySymbol) || ((_a = context.reverseMappedStack) == null ? void 0 : _a[0]) && !(getObjectFlags(last(context.reverseMappedStack).links.propertyType) & 16 /* Anonymous */) || isDeeplyNestedReverseMappedTypeProperty());
function isDeeplyNestedReverseMappedTypeProperty() {
var _a2;
if ((((_a2 = context.reverseMappedStack) == null ? void 0 : _a2.length) ?? 0) < depth) {
return false;
}
for (let i = 0; i < depth; i++) {
const prop = context.reverseMappedStack[context.reverseMappedStack.length - 1 - i];
if (prop.links.mappedType.symbol !== propertySymbol.links.mappedType.symbol) {
return false;
}
}
return true;
}
}
function addPropertyToElementList(propertySymbol, context, typeElements) {
var _a;
@ -51244,8 +51301,8 @@ function createTypeChecker(host) {
return enclosingDeclaration;
}
function serializeTypeForDeclaration(context, declaration, type, symbol) {
var _a;
const addUndefined = declaration && (isParameter(declaration) || isJSDocParameterTag(declaration)) && requiresAddingImplicitUndefined(declaration);
var _a, _b;
const addUndefinedForParameter = declaration && (isParameter(declaration) || isJSDocParameterTag(declaration)) && requiresAddingImplicitUndefined(declaration);
const enclosingDeclaration = context.enclosingDeclaration;
const oldFlags = context.flags;
if (declaration && hasInferredType(declaration) && !(context.flags & -2147483648 /* NoSyntacticPrinter */)) {
@ -51256,6 +51313,7 @@ function createTypeChecker(host) {
const declWithExistingAnnotation = declaration && getNonlocalEffectiveTypeAnnotationNode(declaration) ? declaration : getDeclarationWithTypeAnnotation(symbol);
if (declWithExistingAnnotation && !isFunctionLikeDeclaration(declWithExistingAnnotation) && !isGetAccessorDeclaration(declWithExistingAnnotation)) {
const existing = getNonlocalEffectiveTypeAnnotationNode(declWithExistingAnnotation);
const addUndefined = addUndefinedForParameter || !!(symbol.flags & 4 /* Property */ && symbol.flags & 16777216 /* Optional */ && isOptionalDeclaration(declWithExistingAnnotation) && ((_a = symbol.links) == null ? void 0 : _a.mappedType) && containsNonMissingUndefinedType(type));
const result2 = !isTypePredicateNode(existing) && tryReuseExistingTypeNode(context, existing, type, declWithExistingAnnotation, addUndefined);
if (result2) {
context.flags = oldFlags;
@ -51266,9 +51324,9 @@ function createTypeChecker(host) {
if (type.flags & 8192 /* UniqueESSymbol */ && type.symbol === symbol && (!context.enclosingDeclaration || some(symbol.declarations, (d) => getSourceFileOfNode(d) === getSourceFileOfNode(context.enclosingDeclaration)))) {
context.flags |= 1048576 /* AllowUniqueESSymbolType */;
}
const decl = declaration ?? symbol.valueDeclaration ?? ((_a = symbol.declarations) == null ? void 0 : _a[0]);
const decl = declaration ?? symbol.valueDeclaration ?? ((_b = symbol.declarations) == null ? void 0 : _b[0]);
const expr = decl && isDeclarationWithPossibleInnerTypeNodeReuse(decl) ? getPossibleTypeNodeReuseExpression(decl) : void 0;
const result = expressionOrTypeToTypeNode(context, expr, type, addUndefined);
const result = expressionOrTypeToTypeNode(context, expr, type, addUndefinedForParameter);
context.flags = oldFlags;
return result;
}
@ -51303,9 +51361,9 @@ function createTypeChecker(host) {
const typePredicate = getTypePredicateOfSignature(signature);
const type = getReturnTypeOfSignature(signature);
if (context.enclosingDeclaration && (!isErrorType(type) || context.flags & 1 /* AllowUnresolvedNames */) && signature.declaration && !nodeIsSynthesized(signature.declaration)) {
const annotation = signature.declaration && getNonlocalEffectiveReturnTypeAnnotationNode(signature.declaration);
if (annotation && getTypeFromTypeNode2(context, annotation) === type) {
const result = tryReuseExistingTypeNodeHelper(context, annotation);
const annotation = getNonlocalEffectiveReturnTypeAnnotationNode(signature.declaration);
if (annotation) {
const result = tryReuseExistingTypeNode(context, annotation, type, context.enclosingDeclaration);
if (result) {
return result;
}
@ -51799,7 +51857,10 @@ function createTypeChecker(host) {
);
}
if (isNamedDeclaration(node) && node.name.kind === 167 /* ComputedPropertyName */ && !isLateBindableName(node.name)) {
if (!(context.flags & 1 /* AllowUnresolvedNames */ && hasDynamicName(node) && isEntityNameExpression(node.name.expression) && checkComputedPropertyName(node.name).flags & 1 /* Any */)) {
if (!hasDynamicName(node)) {
return visitEachChild2(node, visitExistingNodeTreeSymbols);
}
if (!(context.flags & 1 /* AllowUnresolvedNames */ && isEntityNameExpression(node.name.expression) && checkComputedPropertyName(node.name).flags & 1 /* Any */)) {
return void 0;
}
}
@ -51929,7 +51990,7 @@ function createTypeChecker(host) {
if (result) {
if (result.pos !== -1 || result.end !== -1) {
if (result === nodes) {
result = factory.createNodeArray(nodes, nodes.hasTrailingComma);
result = factory.createNodeArray(nodes.slice(), nodes.hasTrailingComma);
}
setTextRangePosEnd(result, -1, -1);
}
@ -57886,7 +57947,7 @@ function createTypeChecker(host) {
);
}
function createSignatureTypeMapper(signature, typeArguments) {
return createTypeMapper(signature.typeParameters, typeArguments);
return createTypeMapper(sameMap(signature.typeParameters, (tp) => tp.mapper ? instantiateType(tp, tp.mapper) : tp), typeArguments);
}
function getErasedSignature(signature) {
return signature.typeParameters ? signature.erasedSignatureCache || (signature.erasedSignatureCache = createErasedSignature(signature)) : signature;
@ -62529,6 +62590,10 @@ function createTypeChecker(host) {
function containsUndefinedType(type) {
return !!((type.flags & 1048576 /* Union */ ? type.types[0] : type).flags & 32768 /* Undefined */);
}
function containsNonMissingUndefinedType(type) {
const candidate = type.flags & 1048576 /* Union */ ? type.types[0] : type;
return !!(candidate.flags & 32768 /* Undefined */) && candidate !== missingType;
}
function isStringIndexSignatureOnlyType(type) {
return type.flags & 524288 /* Object */ && !isGenericMappedType(type) && getPropertiesOfType(type).length === 0 && getIndexInfosOfType(type).length === 1 && !!getIndexInfoOfType(type, stringType) || type.flags & 3145728 /* UnionOrIntersection */ && every(type.types, isStringIndexSignatureOnlyType) || false;
}
@ -66177,11 +66242,11 @@ function createTypeChecker(host) {
}
function inferTypeForHomomorphicMappedType(source, target, constraint) {
const cacheKey = source.id + "," + target.id + "," + constraint.id;
if (reverseMappedCache.has(cacheKey)) {
return reverseMappedCache.get(cacheKey);
if (reverseHomomorphicMappedCache.has(cacheKey)) {
return reverseHomomorphicMappedCache.get(cacheKey);
}
const type = createReverseMappedType(source, target, constraint);
reverseMappedCache.set(cacheKey, type);
reverseHomomorphicMappedCache.set(cacheKey, type);
return type;
}
function isPartiallyInferableType(type) {
@ -69409,7 +69474,7 @@ function createTypeChecker(host) {
if (!canCollectSymbolAliasAccessabilityData) {
return;
}
if (location.flags & 33554432 /* Ambient */) {
if (location.flags & 33554432 /* Ambient */ && !isPropertySignature(location) && !isPropertyDeclaration(location)) {
return;
}
switch (hint) {
@ -72413,7 +72478,7 @@ function createTypeChecker(host) {
checkGrammarJsxElement(node);
}
checkJsxPreconditions(node);
markLinkedReferences(node, 4 /* Jsx */);
markJsxAliasReferenced(node);
if (isNodeOpeningLikeElement) {
const jsxOpeningLikeNode = node;
const sig = getResolvedSignature(jsxOpeningLikeNode);
@ -85149,15 +85214,14 @@ function createTypeChecker(host) {
function checkChildIdentifiers(node2) {
forEachNodeRecursively(node2, checkIdentifiers);
}
function isExpressionNodeOrShorthandPropertyAssignmentName(node2) {
return isExpressionNode(node2) || isShorthandPropertyAssignment(node2.parent) && (node2.parent.objectAssignmentInitializer ?? node2.parent.name) === node2;
}
function checkSingleIdentifier(node2) {
const nodeLinks2 = getNodeLinks(node2);
nodeLinks2.calculatedFlags |= 536870912 /* ConstructorReference */ | 16384 /* CapturedBlockScopedBinding */ | 32768 /* BlockScopedBindingInLoop */;
if (isIdentifier(node2) && isExpressionNode(node2) && !(isPropertyAccessExpression(node2.parent) && node2.parent.name === node2)) {
const s = getSymbolAtLocation(
node2,
/*ignoreErrors*/
true
);
if (isIdentifier(node2) && isExpressionNodeOrShorthandPropertyAssignmentName(node2) && !(isPropertyAccessExpression(node2.parent) && node2.parent.name === node2)) {
const s = getResolvedSymbol(node2);
if (s && s !== unknownSymbol) {
checkIdentifierCalculateNodeCheckFlags(node2, s);
}
@ -85625,7 +85689,8 @@ function createTypeChecker(host) {
resolveExternalModuleSymbol(sym);
return !sym.exports ? [] : nodeBuilder.symbolTableToDeclarationStatements(sym.exports, node, flags, tracker);
},
isImportRequiredByAugmentation
isImportRequiredByAugmentation,
isDefinitelyReferenceToGlobalSymbolObject
};
function isImportRequiredByAugmentation(node) {
const file = getSourceFileOfNode(node);
@ -110759,6 +110824,7 @@ function transformDeclarations(context) {
}
function reportInferenceFallback(node) {
if (!isolatedDeclarations || isSourceFileJS(currentSourceFile)) return;
if (getSourceFileOfNode(node) !== currentSourceFile) return;
if (isVariableDeclaration(node) && resolver.isExpandoFunctionDeclaration(node)) {
reportExpandoFunctionErrors(node);
} else {
@ -111397,15 +111463,17 @@ function transformDeclarations(context) {
if (isDeclarationAndNotVisible(input)) return;
if (hasDynamicName(input)) {
if (isolatedDeclarations) {
if (isClassDeclaration(input.parent) || isObjectLiteralExpression(input.parent)) {
context.addDiagnostic(createDiagnosticForNode(input, Diagnostics.Computed_property_names_on_class_or_object_literals_cannot_be_inferred_with_isolatedDeclarations));
return;
} else if (
// Type declarations just need to double-check that the input computed name is an entity name expression
(isInterfaceDeclaration(input.parent) || isTypeLiteralNode(input.parent)) && !isEntityNameExpression(input.name.expression)
) {
context.addDiagnostic(createDiagnosticForNode(input, Diagnostics.Computed_properties_must_be_number_or_string_literals_variables_or_dotted_expressions_with_isolatedDeclarations));
return;
if (!resolver.isDefinitelyReferenceToGlobalSymbolObject(input.name.expression)) {
if (isClassDeclaration(input.parent) || isObjectLiteralExpression(input.parent)) {
context.addDiagnostic(createDiagnosticForNode(input, Diagnostics.Computed_property_names_on_class_or_object_literals_cannot_be_inferred_with_isolatedDeclarations));
return;
} else if (
// Type declarations just need to double-check that the input computed name is an entity name expression
(isInterfaceDeclaration(input.parent) || isTypeLiteralNode(input.parent)) && !isEntityNameExpression(input.name.expression)
) {
context.addDiagnostic(createDiagnosticForNode(input, Diagnostics.Computed_properties_must_be_number_or_string_literals_variables_or_dotted_expressions_with_isolatedDeclarations));
return;
}
}
} else if (!resolver.isLateBound(getParseTreeNode(input)) || !isEntityNameExpression(input.name.expression)) {
return;
@ -113130,7 +113198,7 @@ function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, decla
noEmitHelpers: true,
module: compilerOptions.module,
target: compilerOptions.target,
sourceMap: !forceDtsEmit && compilerOptions.declarationMap,
sourceMap: emitOnly !== 2 /* BuilderSignature */ && compilerOptions.declarationMap,
inlineSourceMap: compilerOptions.inlineSourceMap,
extendedDiagnostics: compilerOptions.extendedDiagnostics,
onlyPrintJsDocStyle: true,
@ -113353,7 +113421,8 @@ var notImplementedResolver = {
getJsxFragmentFactoryEntity: notImplemented,
isBindingCapturedByNode: notImplemented,
getDeclarationStatementsForSourceFile: notImplemented,
isImportRequiredByAugmentation: notImplemented
isImportRequiredByAugmentation: notImplemented,
isDefinitelyReferenceToGlobalSymbolObject: notImplemented
};
var createPrinterWithDefaults = /* @__PURE__ */ memoize(() => createPrinter({}));
var createPrinterWithRemoveComments = /* @__PURE__ */ memoize(() => createPrinter({ removeComments: true }));
@ -121383,7 +121452,8 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
if (options.outDir || // there is --outDir specified
options.rootDir || // there is --rootDir specified
options.sourceRoot || // there is --sourceRoot specified
options.mapRoot) {
options.mapRoot || // there is --mapRoot specified
getEmitDeclarations(options) && options.declarationDir) {
const dir = getCommonSourceDirectory2();
if (options.outDir && dir === "" && files.some((file) => getRootLength(file.fileName) > 1)) {
createDiagnosticForOptionName(Diagnostics.Cannot_find_the_common_subdirectory_path_for_the_input_files, "outDir");
@ -122468,8 +122538,7 @@ var BuilderState;
);
},
cancellationToken,
/*emitOnly*/
true,
2 /* BuilderSignature */,
/*customTransformers*/
void 0,
/*forceDtsEmit*/
@ -129606,7 +129675,7 @@ function createSyntacticTypeNodeBuilder(options, resolver) {
expression,
/*includeBigInt*/
false
)) {
) && !resolver.isDefinitelyReferenceToGlobalSymbolObject(expression)) {
context.tracker.reportInferenceFallback(prop.name);
result = false;
}

View file

@ -2254,6 +2254,7 @@ __export(typescript_exports, {
trace: () => trace,
tracing: () => tracing,
tracingEnabled: () => tracingEnabled,
transferSourceFileChildren: () => transferSourceFileChildren,
transform: () => transform,
transformClassFields: () => transformClassFields,
transformDeclarations: () => transformDeclarations,
@ -2366,7 +2367,7 @@ module.exports = __toCommonJS(typescript_exports);
// src/compiler/corePublic.ts
var versionMajorMinor = "5.5";
var version = "5.5.3";
var version = "5.5.4";
var Comparison = /* @__PURE__ */ ((Comparison3) => {
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@ -5239,10 +5240,12 @@ function tryGetPerformance() {
if (isNodeLikeSystem()) {
try {
const { performance: performance2 } = require("perf_hooks");
return {
shouldWriteNativeEvents: false,
performance: performance2
};
if (performance2) {
return {
shouldWriteNativeEvents: false,
performance: performance2
};
}
} catch {
}
}
@ -6280,6 +6283,7 @@ var FilePreprocessingDiagnosticsKind = /* @__PURE__ */ ((FilePreprocessingDiagno
var EmitOnly = /* @__PURE__ */ ((EmitOnly4) => {
EmitOnly4[EmitOnly4["Js"] = 0] = "Js";
EmitOnly4[EmitOnly4["Dts"] = 1] = "Dts";
EmitOnly4[EmitOnly4["BuilderSignature"] = 2] = "BuilderSignature";
return EmitOnly4;
})(EmitOnly || {});
var StructureIsReused = /* @__PURE__ */ ((StructureIsReused2) => {
@ -12149,6 +12153,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
var tokenFlags;
var commentDirectives;
var skipJsDocLeadingAsterisks = 0;
var asteriskSeen = false;
var scriptKind = 0 /* Unknown */;
var jsDocParsingMode = 0 /* ParseAll */;
setText(text, start, length2);
@ -12200,6 +12205,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
resetTokenState,
setTextPos: resetTokenState,
setSkipJsDocLeadingAsterisks,
hasLeadingAsterisks,
tryScan,
lookAhead,
scanRange
@ -12806,7 +12812,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
function scan() {
fullStartPos = pos;
tokenFlags = 0 /* None */;
let asteriskSeen = false;
asteriskSeen = false;
while (true) {
tokenStart = pos;
if (pos >= end) {
@ -14609,6 +14615,9 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
function setSkipJsDocLeadingAsterisks(skip) {
skipJsDocLeadingAsterisks += skip ? 1 : -1;
}
function hasLeadingAsterisks() {
return asteriskSeen;
}
}
function codePointAt(s, i) {
return s.codePointAt(i);
@ -16552,7 +16561,7 @@ function getTokenPosOfNode(node, sourceFile, includeJsDoc) {
}
if (isJSDocNode(node) || node.kind === 12 /* JsxText */) {
return skipTrivia(
(sourceFile || getSourceFileOfNode(node)).text,
(sourceFile ?? getSourceFileOfNode(node)).text,
node.pos,
/*stopAfterLineBreak*/
false,
@ -16564,13 +16573,14 @@ function getTokenPosOfNode(node, sourceFile, includeJsDoc) {
return getTokenPosOfNode(node.jsDoc[0], sourceFile);
}
if (node.kind === 352 /* SyntaxList */) {
const first2 = firstOrUndefined(getNodeChildren(node));
sourceFile ?? (sourceFile = getSourceFileOfNode(node));
const first2 = firstOrUndefined(getNodeChildren(node, sourceFile));
if (first2) {
return getTokenPosOfNode(first2, sourceFile, includeJsDoc);
}
}
return skipTrivia(
(sourceFile || getSourceFileOfNode(node)).text,
(sourceFile ?? getSourceFileOfNode(node)).text,
node.pos,
/*stopAfterLineBreak*/
false,
@ -20113,11 +20123,11 @@ function getOwnEmitOutputFilePath(fileName, host, extension) {
return emitOutputFilePathWithoutExtension + extension;
}
function getDeclarationEmitOutputFilePath(fileName, host) {
return getDeclarationEmitOutputFilePathWorker(fileName, host.getCompilerOptions(), host.getCurrentDirectory(), host.getCommonSourceDirectory(), (f) => host.getCanonicalFileName(f));
return getDeclarationEmitOutputFilePathWorker(fileName, host.getCompilerOptions(), host);
}
function getDeclarationEmitOutputFilePathWorker(fileName, options, currentDirectory, commonSourceDirectory, getCanonicalFileName) {
function getDeclarationEmitOutputFilePathWorker(fileName, options, host) {
const outputDir = options.declarationDir || options.outDir;
const path = outputDir ? getSourceFilePathInNewDirWorker(fileName, outputDir, currentDirectory, commonSourceDirectory, getCanonicalFileName) : fileName;
const path = outputDir ? getSourceFilePathInNewDirWorker(fileName, outputDir, host.getCurrentDirectory(), host.getCommonSourceDirectory(), (f) => host.getCanonicalFileName(f)) : fileName;
const declarationExtension = getDeclarationEmitExtensionForPath(path);
return removeFileExtension(path) + declarationExtension;
}
@ -27685,7 +27695,7 @@ function createNodeFactory(flags, baseFactory2) {
}
function createSyntaxList3(children) {
const node = createBaseNode(352 /* SyntaxList */);
setNodeChildren(node, children);
node._children = children;
return node;
}
function createNotEmittedStatement(original) {
@ -30578,17 +30588,43 @@ function isSyntaxList(n) {
}
// src/compiler/factory/nodeChildren.ts
var nodeChildren = /* @__PURE__ */ new WeakMap();
function getNodeChildren(node) {
if (!isNodeKind(node.kind)) return emptyArray;
return nodeChildren.get(node);
var sourceFileToNodeChildren = /* @__PURE__ */ new WeakMap();
function getNodeChildren(node, sourceFile) {
var _a;
const kind = node.kind;
if (!isNodeKind(kind)) {
return emptyArray;
}
if (kind === 352 /* SyntaxList */) {
return node._children;
}
return (_a = sourceFileToNodeChildren.get(sourceFile)) == null ? void 0 : _a.get(node);
}
function setNodeChildren(node, children) {
nodeChildren.set(node, children);
function setNodeChildren(node, sourceFile, children) {
if (node.kind === 352 /* SyntaxList */) {
Debug.fail("Should not need to re-set the children of a SyntaxList.");
}
let map2 = sourceFileToNodeChildren.get(sourceFile);
if (map2 === void 0) {
map2 = /* @__PURE__ */ new WeakMap();
sourceFileToNodeChildren.set(sourceFile, map2);
}
map2.set(node, children);
return children;
}
function unsetNodeChildren(node) {
nodeChildren.delete(node);
function unsetNodeChildren(node, origSourceFile) {
var _a;
if (node.kind === 352 /* SyntaxList */) {
Debug.fail("Did not expect to unset the children of a SyntaxList.");
}
(_a = sourceFileToNodeChildren.get(origSourceFile)) == null ? void 0 : _a.delete(node);
}
function transferSourceFileChildren(sourceFile, targetSourceFile) {
const map2 = sourceFileToNodeChildren.get(sourceFile);
if (map2 !== void 0) {
sourceFileToNodeChildren.delete(sourceFile);
sourceFileToNodeChildren.set(targetSourceFile, map2);
}
}
// src/compiler/factory/utilities.ts
@ -33264,7 +33300,7 @@ var Parser;
function createIdentifier(isIdentifier3, diagnosticMessage, privateIdentifierDiagnosticMessage) {
if (isIdentifier3) {
identifierCount++;
const pos = getNodePos();
const pos = scanner2.hasLeadingAsterisks() ? scanner2.getTokenStart() : getNodePos();
const originalKeywordKind = token();
const text = internIdentifier(scanner2.getTokenValue());
const hasExtendedUnicodeEscape = scanner2.hasExtendedUnicodeEscape();
@ -39200,6 +39236,7 @@ var IncrementalParser;
aggressiveChecks
);
result.impliedNodeFormat = sourceFile.impliedNodeFormat;
transferSourceFileChildren(sourceFile, result);
return result;
}
IncrementalParser2.updateSourceFile = updateSourceFile2;
@ -39235,7 +39272,7 @@ var IncrementalParser;
}
}
}
function moveElementEntirelyPastChangeRange(element, isArray2, delta, oldText, newText, aggressiveChecks) {
function moveElementEntirelyPastChangeRange(element, origSourceFile, isArray2, delta, oldText, newText, aggressiveChecks) {
if (isArray2) {
visitArray2(element);
} else {
@ -39247,7 +39284,7 @@ var IncrementalParser;
if (aggressiveChecks && shouldCheckNode(node)) {
text = oldText.substring(node.pos, node.end);
}
unsetNodeChildren(node);
unsetNodeChildren(node, origSourceFile);
setTextRangePosEnd(node, node.pos + delta, node.end + delta);
if (aggressiveChecks && shouldCheckNode(node)) {
Debug.assert(text === newText.substring(node.pos, node.end));
@ -39321,6 +39358,7 @@ var IncrementalParser;
if (child.pos > changeRangeOldEnd) {
moveElementEntirelyPastChangeRange(
child,
sourceFile,
/*isArray*/
false,
delta,
@ -39333,7 +39371,7 @@ var IncrementalParser;
const fullEnd = child.end;
if (fullEnd >= changeStart) {
markAsIntersectingIncrementalChange(child);
unsetNodeChildren(child);
unsetNodeChildren(child, sourceFile);
adjustIntersectingElement(child, changeStart, changeRangeOldEnd, changeRangeNewEnd, delta);
forEachChild(child, visitNode3, visitArray2);
if (hasJSDocNodes(child)) {
@ -39351,6 +39389,7 @@ var IncrementalParser;
if (array.pos > changeRangeOldEnd) {
moveElementEntirelyPastChangeRange(
array,
sourceFile,
/*isArray*/
true,
delta,
@ -40051,7 +40090,6 @@ var commonOptionsWithBuild = [
affectsBuildInfo: true,
showInSimplifiedHelpView: true,
category: Diagnostics.Emit,
transpileOptionValue: void 0,
defaultValueDescription: false,
description: Diagnostics.Create_sourcemaps_for_d_ts_files
},
@ -40377,6 +40415,7 @@ var commandOptionsWithoutBuild = [
type: "boolean",
affectsEmit: true,
affectsBuildInfo: true,
affectsSourceFile: true,
category: Diagnostics.Emit,
description: Diagnostics.Allow_importing_helper_functions_from_tslib_once_per_project_instead_of_including_them_per_file,
defaultValueDescription: false
@ -40841,6 +40880,7 @@ var commandOptionsWithoutBuild = [
affectsEmit: true,
affectsBuildInfo: true,
affectsModuleResolution: true,
affectsSourceFile: true,
category: Diagnostics.Language_and_Environment,
description: Diagnostics.Specify_module_specifier_used_to_import_the_JSX_factory_functions_when_using_jsx_Colon_react_jsx_Asterisk,
defaultValueDescription: "react"
@ -49888,7 +49928,8 @@ function createTypeChecker(host) {
isUndefinedIdentifierExpression(node) {
Debug.assert(isExpressionNode(node));
return getSymbolAtLocation(node) === undefinedSymbol;
}
},
isDefinitelyReferenceToGlobalSymbolObject
});
var evaluate = createEvaluator({
evaluateElementAccessExpression,
@ -50718,6 +50759,7 @@ function createTypeChecker(host) {
};
var amalgamatedDuplicates;
var reverseMappedCache = /* @__PURE__ */ new Map();
var reverseHomomorphicMappedCache = /* @__PURE__ */ new Map();
var ambientModulesCache;
var patternAmbientModules;
var patternAmbientModuleAugmentations;
@ -50845,6 +50887,21 @@ function createTypeChecker(host) {
];
initializeTypeChecker();
return checker;
function isDefinitelyReferenceToGlobalSymbolObject(node) {
if (!isPropertyAccessExpression(node)) return false;
if (!isIdentifier(node.name)) return false;
if (!isPropertyAccessExpression(node.expression) && !isIdentifier(node.expression)) return false;
if (isIdentifier(node.expression)) {
return idText(node.expression) === "Symbol" && getResolvedSymbol(node.expression) === (getGlobalSymbol(
"Symbol",
111551 /* Value */ | 1048576 /* ExportValue */,
/*diagnostic*/
void 0
) || unknownSymbol);
}
if (!isIdentifier(node.expression.expression)) return false;
return idText(node.expression.name) === "Symbol" && idText(node.expression.expression) === "globalThis" && getResolvedSymbol(node.expression.expression) === globalThisSymbol;
}
function getCachedType(key) {
return key ? cachedTypes.get(key) : void 0;
}
@ -54057,11 +54114,11 @@ function createTypeChecker(host) {
function tryReuseExistingTypeNode(context, typeNode, type, host2, addUndefined) {
const originalType = type;
if (addUndefined) {
type = getOptionalType(type);
type = getOptionalType(type, !isParameter(host2));
}
const clone2 = tryReuseExistingNonParameterTypeNode(context, typeNode, type, host2);
if (clone2) {
if (addUndefined && !someType(getTypeFromTypeNode2(context, typeNode), (t) => !!(t.flags & 32768 /* Undefined */))) {
if (addUndefined && containsNonMissingUndefinedType(type) && !someType(getTypeFromTypeNode2(context, typeNode), (t) => !!(t.flags & 32768 /* Undefined */))) {
return factory.createUnionTypeNode([clone2, factory.createKeywordTypeNode(157 /* UndefinedKeyword */)]);
}
return clone2;
@ -54921,7 +54978,21 @@ function createTypeChecker(host) {
}
function shouldUsePlaceholderForProperty(propertySymbol, context) {
var _a;
return !!(getCheckFlags(propertySymbol) & 8192 /* ReverseMapped */) && (contains(context.reverseMappedStack, propertySymbol) || ((_a = context.reverseMappedStack) == null ? void 0 : _a[0]) && !(getObjectFlags(last(context.reverseMappedStack).links.propertyType) & 16 /* Anonymous */));
const depth = 3;
return !!(getCheckFlags(propertySymbol) & 8192 /* ReverseMapped */) && (contains(context.reverseMappedStack, propertySymbol) || ((_a = context.reverseMappedStack) == null ? void 0 : _a[0]) && !(getObjectFlags(last(context.reverseMappedStack).links.propertyType) & 16 /* Anonymous */) || isDeeplyNestedReverseMappedTypeProperty());
function isDeeplyNestedReverseMappedTypeProperty() {
var _a2;
if ((((_a2 = context.reverseMappedStack) == null ? void 0 : _a2.length) ?? 0) < depth) {
return false;
}
for (let i = 0; i < depth; i++) {
const prop = context.reverseMappedStack[context.reverseMappedStack.length - 1 - i];
if (prop.links.mappedType.symbol !== propertySymbol.links.mappedType.symbol) {
return false;
}
}
return true;
}
}
function addPropertyToElementList(propertySymbol, context, typeElements) {
var _a;
@ -56008,8 +56079,8 @@ function createTypeChecker(host) {
return enclosingDeclaration;
}
function serializeTypeForDeclaration(context, declaration, type, symbol) {
var _a;
const addUndefined = declaration && (isParameter(declaration) || isJSDocParameterTag(declaration)) && requiresAddingImplicitUndefined(declaration);
var _a, _b;
const addUndefinedForParameter = declaration && (isParameter(declaration) || isJSDocParameterTag(declaration)) && requiresAddingImplicitUndefined(declaration);
const enclosingDeclaration = context.enclosingDeclaration;
const oldFlags = context.flags;
if (declaration && hasInferredType(declaration) && !(context.flags & -2147483648 /* NoSyntacticPrinter */)) {
@ -56020,6 +56091,7 @@ function createTypeChecker(host) {
const declWithExistingAnnotation = declaration && getNonlocalEffectiveTypeAnnotationNode(declaration) ? declaration : getDeclarationWithTypeAnnotation(symbol);
if (declWithExistingAnnotation && !isFunctionLikeDeclaration(declWithExistingAnnotation) && !isGetAccessorDeclaration(declWithExistingAnnotation)) {
const existing = getNonlocalEffectiveTypeAnnotationNode(declWithExistingAnnotation);
const addUndefined = addUndefinedForParameter || !!(symbol.flags & 4 /* Property */ && symbol.flags & 16777216 /* Optional */ && isOptionalDeclaration(declWithExistingAnnotation) && ((_a = symbol.links) == null ? void 0 : _a.mappedType) && containsNonMissingUndefinedType(type));
const result2 = !isTypePredicateNode(existing) && tryReuseExistingTypeNode(context, existing, type, declWithExistingAnnotation, addUndefined);
if (result2) {
context.flags = oldFlags;
@ -56030,9 +56102,9 @@ function createTypeChecker(host) {
if (type.flags & 8192 /* UniqueESSymbol */ && type.symbol === symbol && (!context.enclosingDeclaration || some(symbol.declarations, (d) => getSourceFileOfNode(d) === getSourceFileOfNode(context.enclosingDeclaration)))) {
context.flags |= 1048576 /* AllowUniqueESSymbolType */;
}
const decl = declaration ?? symbol.valueDeclaration ?? ((_a = symbol.declarations) == null ? void 0 : _a[0]);
const decl = declaration ?? symbol.valueDeclaration ?? ((_b = symbol.declarations) == null ? void 0 : _b[0]);
const expr = decl && isDeclarationWithPossibleInnerTypeNodeReuse(decl) ? getPossibleTypeNodeReuseExpression(decl) : void 0;
const result = expressionOrTypeToTypeNode(context, expr, type, addUndefined);
const result = expressionOrTypeToTypeNode(context, expr, type, addUndefinedForParameter);
context.flags = oldFlags;
return result;
}
@ -56067,9 +56139,9 @@ function createTypeChecker(host) {
const typePredicate = getTypePredicateOfSignature(signature);
const type = getReturnTypeOfSignature(signature);
if (context.enclosingDeclaration && (!isErrorType(type) || context.flags & 1 /* AllowUnresolvedNames */) && signature.declaration && !nodeIsSynthesized(signature.declaration)) {
const annotation = signature.declaration && getNonlocalEffectiveReturnTypeAnnotationNode(signature.declaration);
if (annotation && getTypeFromTypeNode2(context, annotation) === type) {
const result = tryReuseExistingTypeNodeHelper(context, annotation);
const annotation = getNonlocalEffectiveReturnTypeAnnotationNode(signature.declaration);
if (annotation) {
const result = tryReuseExistingTypeNode(context, annotation, type, context.enclosingDeclaration);
if (result) {
return result;
}
@ -56563,7 +56635,10 @@ function createTypeChecker(host) {
);
}
if (isNamedDeclaration(node) && node.name.kind === 167 /* ComputedPropertyName */ && !isLateBindableName(node.name)) {
if (!(context.flags & 1 /* AllowUnresolvedNames */ && hasDynamicName(node) && isEntityNameExpression(node.name.expression) && checkComputedPropertyName(node.name).flags & 1 /* Any */)) {
if (!hasDynamicName(node)) {
return visitEachChild2(node, visitExistingNodeTreeSymbols);
}
if (!(context.flags & 1 /* AllowUnresolvedNames */ && isEntityNameExpression(node.name.expression) && checkComputedPropertyName(node.name).flags & 1 /* Any */)) {
return void 0;
}
}
@ -56693,7 +56768,7 @@ function createTypeChecker(host) {
if (result) {
if (result.pos !== -1 || result.end !== -1) {
if (result === nodes) {
result = factory.createNodeArray(nodes, nodes.hasTrailingComma);
result = factory.createNodeArray(nodes.slice(), nodes.hasTrailingComma);
}
setTextRangePosEnd(result, -1, -1);
}
@ -62650,7 +62725,7 @@ function createTypeChecker(host) {
);
}
function createSignatureTypeMapper(signature, typeArguments) {
return createTypeMapper(signature.typeParameters, typeArguments);
return createTypeMapper(sameMap(signature.typeParameters, (tp) => tp.mapper ? instantiateType(tp, tp.mapper) : tp), typeArguments);
}
function getErasedSignature(signature) {
return signature.typeParameters ? signature.erasedSignatureCache || (signature.erasedSignatureCache = createErasedSignature(signature)) : signature;
@ -67293,6 +67368,10 @@ function createTypeChecker(host) {
function containsUndefinedType(type) {
return !!((type.flags & 1048576 /* Union */ ? type.types[0] : type).flags & 32768 /* Undefined */);
}
function containsNonMissingUndefinedType(type) {
const candidate = type.flags & 1048576 /* Union */ ? type.types[0] : type;
return !!(candidate.flags & 32768 /* Undefined */) && candidate !== missingType;
}
function isStringIndexSignatureOnlyType(type) {
return type.flags & 524288 /* Object */ && !isGenericMappedType(type) && getPropertiesOfType(type).length === 0 && getIndexInfosOfType(type).length === 1 && !!getIndexInfoOfType(type, stringType) || type.flags & 3145728 /* UnionOrIntersection */ && every(type.types, isStringIndexSignatureOnlyType) || false;
}
@ -70941,11 +71020,11 @@ function createTypeChecker(host) {
}
function inferTypeForHomomorphicMappedType(source, target, constraint) {
const cacheKey = source.id + "," + target.id + "," + constraint.id;
if (reverseMappedCache.has(cacheKey)) {
return reverseMappedCache.get(cacheKey);
if (reverseHomomorphicMappedCache.has(cacheKey)) {
return reverseHomomorphicMappedCache.get(cacheKey);
}
const type = createReverseMappedType(source, target, constraint);
reverseMappedCache.set(cacheKey, type);
reverseHomomorphicMappedCache.set(cacheKey, type);
return type;
}
function isPartiallyInferableType(type) {
@ -74173,7 +74252,7 @@ function createTypeChecker(host) {
if (!canCollectSymbolAliasAccessabilityData) {
return;
}
if (location.flags & 33554432 /* Ambient */) {
if (location.flags & 33554432 /* Ambient */ && !isPropertySignature(location) && !isPropertyDeclaration(location)) {
return;
}
switch (hint) {
@ -77177,7 +77256,7 @@ function createTypeChecker(host) {
checkGrammarJsxElement(node);
}
checkJsxPreconditions(node);
markLinkedReferences(node, 4 /* Jsx */);
markJsxAliasReferenced(node);
if (isNodeOpeningLikeElement) {
const jsxOpeningLikeNode = node;
const sig = getResolvedSignature(jsxOpeningLikeNode);
@ -89913,15 +89992,14 @@ function createTypeChecker(host) {
function checkChildIdentifiers(node2) {
forEachNodeRecursively(node2, checkIdentifiers);
}
function isExpressionNodeOrShorthandPropertyAssignmentName(node2) {
return isExpressionNode(node2) || isShorthandPropertyAssignment(node2.parent) && (node2.parent.objectAssignmentInitializer ?? node2.parent.name) === node2;
}
function checkSingleIdentifier(node2) {
const nodeLinks2 = getNodeLinks(node2);
nodeLinks2.calculatedFlags |= 536870912 /* ConstructorReference */ | 16384 /* CapturedBlockScopedBinding */ | 32768 /* BlockScopedBindingInLoop */;
if (isIdentifier(node2) && isExpressionNode(node2) && !(isPropertyAccessExpression(node2.parent) && node2.parent.name === node2)) {
const s = getSymbolAtLocation(
node2,
/*ignoreErrors*/
true
);
if (isIdentifier(node2) && isExpressionNodeOrShorthandPropertyAssignmentName(node2) && !(isPropertyAccessExpression(node2.parent) && node2.parent.name === node2)) {
const s = getResolvedSymbol(node2);
if (s && s !== unknownSymbol) {
checkIdentifierCalculateNodeCheckFlags(node2, s);
}
@ -90389,7 +90467,8 @@ function createTypeChecker(host) {
resolveExternalModuleSymbol(sym);
return !sym.exports ? [] : nodeBuilder.symbolTableToDeclarationStatements(sym.exports, node, flags, tracker);
},
isImportRequiredByAugmentation
isImportRequiredByAugmentation,
isDefinitelyReferenceToGlobalSymbolObject
};
function isImportRequiredByAugmentation(node) {
const file = getSourceFileOfNode(node);
@ -115705,6 +115784,7 @@ function transformDeclarations(context) {
}
function reportInferenceFallback(node) {
if (!isolatedDeclarations || isSourceFileJS(currentSourceFile)) return;
if (getSourceFileOfNode(node) !== currentSourceFile) return;
if (isVariableDeclaration(node) && resolver.isExpandoFunctionDeclaration(node)) {
reportExpandoFunctionErrors(node);
} else {
@ -116343,15 +116423,17 @@ function transformDeclarations(context) {
if (isDeclarationAndNotVisible(input)) return;
if (hasDynamicName(input)) {
if (isolatedDeclarations) {
if (isClassDeclaration(input.parent) || isObjectLiteralExpression(input.parent)) {
context.addDiagnostic(createDiagnosticForNode(input, Diagnostics.Computed_property_names_on_class_or_object_literals_cannot_be_inferred_with_isolatedDeclarations));
return;
} else if (
// Type declarations just need to double-check that the input computed name is an entity name expression
(isInterfaceDeclaration(input.parent) || isTypeLiteralNode(input.parent)) && !isEntityNameExpression(input.name.expression)
) {
context.addDiagnostic(createDiagnosticForNode(input, Diagnostics.Computed_properties_must_be_number_or_string_literals_variables_or_dotted_expressions_with_isolatedDeclarations));
return;
if (!resolver.isDefinitelyReferenceToGlobalSymbolObject(input.name.expression)) {
if (isClassDeclaration(input.parent) || isObjectLiteralExpression(input.parent)) {
context.addDiagnostic(createDiagnosticForNode(input, Diagnostics.Computed_property_names_on_class_or_object_literals_cannot_be_inferred_with_isolatedDeclarations));
return;
} else if (
// Type declarations just need to double-check that the input computed name is an entity name expression
(isInterfaceDeclaration(input.parent) || isTypeLiteralNode(input.parent)) && !isEntityNameExpression(input.name.expression)
) {
context.addDiagnostic(createDiagnosticForNode(input, Diagnostics.Computed_properties_must_be_number_or_string_literals_variables_or_dotted_expressions_with_isolatedDeclarations));
return;
}
}
} else if (!resolver.isLateBound(getParseTreeNode(input)) || !isEntityNameExpression(input.name.expression)) {
return;
@ -118087,7 +118169,7 @@ function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, decla
noEmitHelpers: true,
module: compilerOptions.module,
target: compilerOptions.target,
sourceMap: !forceDtsEmit && compilerOptions.declarationMap,
sourceMap: emitOnly !== 2 /* BuilderSignature */ && compilerOptions.declarationMap,
inlineSourceMap: compilerOptions.inlineSourceMap,
extendedDiagnostics: compilerOptions.extendedDiagnostics,
onlyPrintJsDocStyle: true,
@ -118310,7 +118392,8 @@ var notImplementedResolver = {
getJsxFragmentFactoryEntity: notImplemented,
isBindingCapturedByNode: notImplemented,
getDeclarationStatementsForSourceFile: notImplemented,
isImportRequiredByAugmentation: notImplemented
isImportRequiredByAugmentation: notImplemented,
isDefinitelyReferenceToGlobalSymbolObject: notImplemented
};
var createPrinterWithDefaults = /* @__PURE__ */ memoize(() => createPrinter({}));
var createPrinterWithRemoveComments = /* @__PURE__ */ memoize(() => createPrinter({ removeComments: true }));
@ -126383,7 +126466,8 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
if (options.outDir || // there is --outDir specified
options.rootDir || // there is --rootDir specified
options.sourceRoot || // there is --sourceRoot specified
options.mapRoot) {
options.mapRoot || // there is --mapRoot specified
getEmitDeclarations(options) && options.declarationDir) {
const dir = getCommonSourceDirectory2();
if (options.outDir && dir === "" && files.some((file) => getRootLength(file.fileName) > 1)) {
createDiagnosticForOptionName(Diagnostics.Cannot_find_the_common_subdirectory_path_for_the_input_files, "outDir");
@ -127482,8 +127566,7 @@ var BuilderState;
);
},
cancellationToken,
/*emitOnly*/
true,
2 /* BuilderSignature */,
/*customTransformers*/
void 0,
/*forceDtsEmit*/
@ -134703,7 +134786,7 @@ function createSyntacticTypeNodeBuilder(options, resolver) {
expression,
/*includeBigInt*/
false
)) {
) && !resolver.isDefinitelyReferenceToGlobalSymbolObject(expression)) {
context.tracker.reportInferenceFallback(prop.name);
result = false;
}
@ -138675,6 +138758,7 @@ function isImportableSymbol(symbol, checker) {
function forEachNameOfDefaultExport(defaultExport, checker, compilerOptions, preferCapitalizedNames, cb) {
let chain;
let current = defaultExport;
const seen = /* @__PURE__ */ new Map();
while (current) {
const fromDeclaration = getDefaultLikeExportNameFromDeclaration(current);
if (fromDeclaration) {
@ -138686,6 +138770,7 @@ function forEachNameOfDefaultExport(defaultExport, checker, compilerOptions, pre
if (final) return final;
}
chain = append(chain, current);
if (!addToSeen(seen, current)) break;
current = current.flags & 2097152 /* Alias */ ? checker.getImmediateAliasedSymbol(current) : void 0;
}
for (const symbol of chain ?? emptyArray) {
@ -141124,7 +141209,7 @@ function getSourceMapper(host) {
}
const options = program.getCompilerOptions();
const outPath = options.outFile;
const declarationPath = outPath ? removeFileExtension(outPath) + ".d.ts" /* Dts */ : getDeclarationEmitOutputFilePathWorker(info.fileName, program.getCompilerOptions(), currentDirectory, program.getCommonSourceDirectory(), getCanonicalFileName);
const declarationPath = outPath ? removeFileExtension(outPath) + ".d.ts" /* Dts */ : getDeclarationEmitOutputFilePathWorker(info.fileName, program.getCompilerOptions(), program);
if (declarationPath === void 0) return void 0;
const newLoc = getDocumentPositionMapper2(declarationPath, info.fileName).getGeneratedPosition(info);
return newLoc === info ? void 0 : newLoc;
@ -147943,9 +148028,9 @@ var NodeObject = class {
getChildAt(index, sourceFile) {
return this.getChildren(sourceFile)[index];
}
getChildren(sourceFile) {
getChildren(sourceFile = getSourceFileOfNode(this)) {
this.assertHasRealPosition("Node without a real position cannot be scanned and thus has no token nodes - use forEachChild and collect the result if that's fine");
return getNodeChildren(this) ?? setNodeChildren(this, createChildren(this, sourceFile));
return getNodeChildren(this, sourceFile) ?? setNodeChildren(this, sourceFile, createChildren(this, sourceFile));
}
getFirstToken(sourceFile) {
this.assertHasRealPosition();
@ -148026,7 +148111,7 @@ function createSyntaxList(nodes, parent2) {
pos = node.end;
}
addSyntheticNodes(children, pos, nodes.end, parent2);
setNodeChildren(list, children);
list._children = children;
return list;
}
var TokenOrIdentifierObject = class {
@ -161234,6 +161319,14 @@ function tryGetAutoImportableReferenceFromTypeNode(importTypeNode, scriptTarget)
function visit(node) {
if (isLiteralImportTypeNode(node) && node.qualifier) {
const firstIdentifier = getFirstIdentifier(node.qualifier);
if (!firstIdentifier.symbol) {
return visitEachChild(
node,
visit,
/*context*/
void 0
);
}
const name = getNameForExportedSymbol(firstIdentifier.symbol, scriptTarget);
const qualifier = name !== firstIdentifier.text ? replaceFirstIdentifierOfEntityName(node.qualifier, factory.createIdentifier(name)) : node.qualifier;
symbols = append(symbols, firstIdentifier.symbol);
@ -167625,7 +167718,7 @@ function getContainingModuleSymbol(importer, checker) {
return checker.getMergedSymbol(getSourceFileLikeForImportDeclaration(importer).symbol);
}
function getSourceFileLikeForImportDeclaration(node) {
if (node.kind === 213 /* CallExpression */) {
if (node.kind === 213 /* CallExpression */ || node.kind === 351 /* JSDocImportTag */) {
return node.getSourceFile();
}
const { parent: parent2 } = node;
@ -180368,6 +180461,7 @@ __export(ts_exports2, {
trace: () => trace,
tracing: () => tracing,
tracingEnabled: () => tracingEnabled,
transferSourceFileChildren: () => transferSourceFileChildren,
transform: () => transform,
transformClassFields: () => transformClassFields,
transformDeclarations: () => transformDeclarations,
@ -183190,7 +183284,7 @@ var Project3 = class _Project {
this.generatedFilesMap.forEach((watcher, source) => {
const sourceFile = this.program.getSourceFileByPath(source);
if (!sourceFile || sourceFile.resolvedPath !== source || !this.isValidGeneratedFileWatcher(
getDeclarationEmitOutputFilePathWorker(sourceFile.fileName, this.compilerOptions, this.currentDirectory, this.program.getCommonSourceDirectory(), this.getCanonicalFileName),
getDeclarationEmitOutputFilePathWorker(sourceFile.fileName, this.compilerOptions, this.program),
watcher
)) {
closeFileWatcherOf(watcher);
@ -194798,6 +194892,7 @@ if (typeof console !== "undefined") {
trace,
tracing,
tracingEnabled,
transferSourceFileChildren,
transform,
transformClassFields,
transformDeclarations,

View file

@ -2,7 +2,7 @@
"name": "typescript",
"author": "Microsoft Corp.",
"homepage": "https://www.typescriptlang.org/",
"version": "5.5.3",
"version": "5.5.4",
"license": "Apache-2.0",
"description": "TypeScript is a language for application scale JavaScript development",
"keywords": [
@ -112,5 +112,5 @@
"node": "20.1.0",
"npm": "8.19.4"
},
"gitHead": "f0e992167440686f948965e5441a918b34251886"
"gitHead": "c8a7d589e647e19c94150d9892909f3aa93e48eb"
}

16
package-lock.json generated
View file

@ -43,7 +43,7 @@
"@ava/typescript": "4.1.0",
"@eslint/compat": "^1.1.1",
"@eslint/eslintrc": "^3.1.0",
"@eslint/js": "^9.7.0",
"@eslint/js": "^9.8.0",
"@types/adm-zip": "^0.5.5",
"@types/console-log-level": "^1.4.5",
"@types/get-folder-size": "^2.0.0",
@ -64,7 +64,7 @@
"nock": "^13.5.4",
"removeNPMAbsolutePaths": "3.0.1",
"sinon": "^18.0.0",
"typescript": "^5.5.3"
"typescript": "^5.5.4"
}
},
"node_modules/@aashutoshrathi/word-wrap": {
@ -518,9 +518,9 @@
}
},
"node_modules/@eslint/js": {
"version": "9.7.0",
"resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.7.0.tgz",
"integrity": "sha512-ChuWDQenef8OSFnvuxv0TCVxEwmu3+hPNKvM9B34qpM0rDRbjL8t5QkQeHHeAfsKQjuH9wS82WeCi1J/owatng==",
"version": "9.8.0",
"resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.8.0.tgz",
"integrity": "sha512-MfluB7EUfxXtv3i/++oh89uzAr4PDI4nn201hsp+qaXqsjAWzinlZEHEfPgAX4doIlKvPG/i0A9dpKxOLII8yA==",
"dev": true,
"engines": {
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
@ -5722,9 +5722,9 @@
}
},
"node_modules/typescript": {
"version": "5.5.3",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.5.3.tgz",
"integrity": "sha512-/hreyEujaB0w76zKo6717l3L0o/qEUtRgdvUBvlkhoWeOVMjMuHNHk0BRBzikzuGDqNmPQbg5ifMEqsHLiIUcQ==",
"version": "5.5.4",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.5.4.tgz",
"integrity": "sha512-Mtq29sKDAEYP7aljRgtPOpTvOfbwRWlS6dPRzwjdE+C0R4brX/GUyhHSecbHMFLNBLcJIPt9nl9yG5TZ1weH+Q==",
"dev": true,
"bin": {
"tsc": "bin/tsc",

View file

@ -58,7 +58,7 @@
"@ava/typescript": "4.1.0",
"@eslint/compat": "^1.1.1",
"@eslint/eslintrc": "^3.1.0",
"@eslint/js": "^9.7.0",
"@eslint/js": "^9.8.0",
"@types/adm-zip": "^0.5.5",
"@types/console-log-level": "^1.4.5",
"@types/get-folder-size": "^2.0.0",
@ -79,7 +79,7 @@
"nock": "^13.5.4",
"removeNPMAbsolutePaths": "3.0.1",
"sinon": "^18.0.0",
"typescript": "^5.5.3"
"typescript": "^5.5.4"
},
"overrides": {
"@actions/tool-cache": {

View file

@ -7,10 +7,9 @@ steps:
- id: init
uses: ./../action/init
with:
# Swift is not supported on Ubuntu so we manually exclude it from the list here
languages: cpp,csharp,go,java,javascript,python,ruby
tools: ${{ steps.prepare-test.outputs.tools-url }}
- uses: ./../action/.github/actions/setup-swift
with:
codeql-path: ${{ steps.init.outputs.codeql-path }}
- name: Build code
shell: bash
run: ./build.sh

View file

@ -20,10 +20,6 @@ steps:
exit 1
fi
- uses: ./../action/.github/actions/setup-swift
with:
codeql-path: ${{ steps.init.outputs.codeql-path }}
- name: Build code
shell: bash
run: ./build.sh

View file

@ -29,7 +29,7 @@ steps:
run: |
cd "$RUNNER_TEMP/results"
expected_baseline_languages="c csharp go java kotlin javascript python ruby"
if [[ $RUNNER_OS != "Windows" ]]; then
if [[ $RUNNER_OS == "macOS" ]]; then
expected_baseline_languages+=" swift"
fi

View file

@ -1,14 +1,6 @@
name: "Multi-language repository"
description: "An end-to-end integration test of a multi-language repository using automatic language detection"
description: "An end-to-end integration test of a multi-language repository using automatic language detection for MacOS"
operatingSystems: ["macos", "ubuntu"]
excludeOsAndVersionCombination: [
# Known failure for Swift on Linux before CLI v2.17.4.
[ "ubuntu", "stable-20230403" ],
[ "ubuntu", "stable-v2.13.5" ],
[ "ubuntu", "stable-v2.14.6" ],
[ "ubuntu", "stable-v2.15.5" ],
[ "ubuntu", "stable-v2.16.6" ],
]
steps:
- uses: actions/setup-go@v5
with:
@ -18,9 +10,12 @@ steps:
id: init
with:
db-location: "${{ runner.temp }}/customDbLocation"
# Swift is not supported on Ubuntu so we manually exclude it from the list here
languages: ${{ runner.os == 'Linux' && 'cpp,csharp,go,java,javascript,python,ruby' || '' }}
tools: ${{ steps.prepare-test.outputs.tools-url }}
- uses: ./../action/.github/actions/setup-swift
if: runner.os == 'macOS'
with:
codeql-path: ${{ steps.init.outputs.codeql-path }}
@ -72,8 +67,8 @@ steps:
exit 1
fi
- name: Check language autodetect for Swift
if: runner.os != 'Windows' && matrix.version != 'stable-20230403'
- name: Check language autodetect for Swift on MacOS
if: runner.os == 'macOS' && matrix.version != 'stable-20230403'
shell: bash
run: |
SWIFT_DB=${{ fromJson(steps.analysis.outputs.db-locations).swift }}

View file

@ -1,36 +0,0 @@
name: "Scaling reserved RAM"
description: "An end-to-end integration test of a multi-language repository with the scaling_reserved_ram feature flag enabled"
operatingSystems: ["macos", "ubuntu"]
excludeOsAndVersionCombination: [
# Known failure for Swift on Linux before CLI v2.17.4.
[ "ubuntu", "stable-20230403" ],
[ "ubuntu", "stable-v2.13.5" ],
[ "ubuntu", "stable-v2.14.6" ],
[ "ubuntu", "stable-v2.15.5" ],
[ "ubuntu", "stable-v2.16.6" ],
]
env:
CODEQL_ACTION_SCALING_RESERVED_RAM: true
steps:
- uses: actions/setup-go@v5
with:
go-version: ">=1.21.0"
- uses: ./../action/init
id: init
with:
db-location: "${{ runner.temp }}/customDbLocation"
tools: ${{ steps.prepare-test.outputs.tools-url }}
- uses: ./../action/.github/actions/setup-swift
with:
codeql-path: ${{ steps.init.outputs.codeql-path }}
- name: Build code
shell: bash
run: ./build.sh
- uses: ./../action/analyze
id: analysis
with:
upload-database: false

View file

@ -1,7 +1,7 @@
name: "Swift analysis using a custom build command"
description: "Tests creation of a Swift database using custom build"
versions: ["linked", "default", "nightly-latest"]
operatingSystems: ["macos", "ubuntu"]
operatingSystems: ["macos"]
env:
DOTNET_GENERATE_ASPNET_CERTIFICATE: "false"
steps:

View file

@ -12,10 +12,9 @@ steps:
- id: init
uses: ./../action/init
with:
# Swift is not supported on Ubuntu so we manually exclude it from the list here
languages: cpp,csharp,go,java,javascript,python,ruby
tools: ./codeql-bundle-linux64.tar.gz
- uses: ./../action/.github/actions/setup-swift
with:
codeql-path: ${{ steps.init.outputs.codeql-path }}
- name: Build code
shell: bash
run: ./build.sh

View file

@ -1,24 +1,15 @@
name: "Test unsetting environment variables"
description: "An end-to-end integration test that unsets some environment variables"
operatingSystems: ["ubuntu"]
excludeOsAndVersionCombination: [
# Known failure for Swift on Linux before CLI v2.17.4.
[ "ubuntu", "stable-20230403" ],
[ "ubuntu", "stable-v2.13.5" ],
[ "ubuntu", "stable-v2.14.6" ],
[ "ubuntu", "stable-v2.15.5" ],
[ "ubuntu", "stable-v2.16.6" ],
]
steps:
- uses: ./../action/init
id: init
with:
db-location: ${{ runner.temp }}/customDbLocation
# Swift is not supported on Ubuntu so we manually exclude it from the list here
languages: cpp,csharp,go,java,javascript,python,ruby
tools: ${{ steps.prepare-test.outputs.tools-url }}
- uses: ./../action/.github/actions/setup-swift
with:
codeql-path: ${{ steps.init.outputs.codeql-path }}
- uses: actions/setup-go@v5
with:
go-version: '>=1.21.0'

View file

@ -375,6 +375,15 @@ async function run() {
);
}
if (
config.languages.includes(Language.swift) &&
process.platform === "linux"
) {
logger.warning(
`Swift analysis on Ubuntu runner images is no longer supported. Please migrate to a macOS runner if this affects you.`,
);
}
if (
config.languages.includes(Language.go) &&
process.platform === "linux"

View file

@ -8,7 +8,7 @@ javac Main.java
go build main.go
if [[ "$OSTYPE" == "darwin"* || "$OSTYPE" == "linux-gnu"* ]]; then
if [[ "$OSTYPE" == "darwin"* ]]; then
swift build
fi