diff --git a/README.md b/README.md index a7b2fb64b95..a506c6af0e1 100644 --- a/README.md +++ b/README.md @@ -177,6 +177,7 @@ These GitHub repositories provide supplementary resources for Rush Stack: | [/build-tests/heft-parameter-plugin](./build-tests/heft-parameter-plugin/) | This project contains a Heft plugin that adds a custom parameter to built-in actions | | [/build-tests/heft-parameter-plugin-test](./build-tests/heft-parameter-plugin-test/) | This project exercises a built-in Heft action with a custom parameter | | [/build-tests/heft-sass-test](./build-tests/heft-sass-test/) | This project illustrates a minimal tutorial Heft project targeting the web browser runtime | +| [/build-tests/heft-swc-test](./build-tests/heft-swc-test/) | Building this project tests building with SWC | | [/build-tests/heft-typescript-composite-test](./build-tests/heft-typescript-composite-test/) | Building this project tests behavior of Heft when the tsconfig.json file uses project references. | | [/build-tests/heft-typescript-v2-test](./build-tests/heft-typescript-v2-test/) | Building this project tests building with TypeScript v2 | | [/build-tests/heft-typescript-v3-test](./build-tests/heft-typescript-v3-test/) | Building this project tests building with TypeScript v3 | diff --git a/build-tests/heft-swc-test/.eslintrc.js b/build-tests/heft-swc-test/.eslintrc.js new file mode 100644 index 00000000000..51cf9a4cb28 --- /dev/null +++ b/build-tests/heft-swc-test/.eslintrc.js @@ -0,0 +1,9 @@ +// This is a workaround for https://github.com/eslint/eslint/issues/3458 +require('local-eslint-config/patch/modern-module-resolution'); +// This is a workaround for https://github.com/microsoft/rushstack/issues/3021 +require('local-eslint-config/patch/custom-config-package-names'); + +module.exports = { + extends: ['local-eslint-config/profile/web-app'], + parserOptions: { tsconfigRootDir: __dirname } +}; diff --git a/build-tests/heft-swc-test/.gitignore b/build-tests/heft-swc-test/.gitignore new file mode 100644 index 00000000000..69667d9ce25 --- /dev/null +++ b/build-tests/heft-swc-test/.gitignore @@ -0,0 +1 @@ +lib-* \ No newline at end of file diff --git a/build-tests/heft-swc-test/config/heft.json b/build-tests/heft-swc-test/config/heft.json new file mode 100644 index 00000000000..13f0c58de15 --- /dev/null +++ b/build-tests/heft-swc-test/config/heft.json @@ -0,0 +1,60 @@ +{ + "$schema": "https://developer.microsoft.com/json-schemas/heft/v0/heft.schema.json", + + // TODO: Add comments + "phasesByName": { + "build": { + "cleanFiles": [{ "includeGlobs": ["dist", "lib", "lib-esnext", "lib-es5", "lib-umd", "temp"] }], + + "tasksByName": { + "typescript": { + "taskPlugin": { + "pluginPackage": "@rushstack/heft-typescript-plugin" + } + }, + "lint": { + "taskDependencies": ["typescript"], + "taskPlugin": { + "pluginPackage": "@rushstack/heft-lint-plugin" + } + }, + "transpile": { + "taskDependencies": [], + "taskPlugin": { + "pluginPackage": "@rushstack/heft-isolated-typescript-transpile-plugin", + "options": { + "emitKinds": [ + { + "outDir": "lib-commonjs", + "formatOverride": "CommonJS", + "targetOverride": "ESNext" + }, + { + "outDir": "lib-esm", + "formatOverride": "ESNext", + "targetOverride": "ESNext" + }, + { + "outDir": "lib-es5", + "formatOverride": "ESNext", + "targetOverride": "ES5" + } + ] + } + } + } + } + }, + + "test": { + "phaseDependencies": ["build"], + "tasksByName": { + "jest": { + "taskPlugin": { + "pluginPackage": "@rushstack/heft-jest-plugin" + } + } + } + } + } +} diff --git a/build-tests/heft-swc-test/config/jest.config.json b/build-tests/heft-swc-test/config/jest.config.json new file mode 100644 index 00000000000..fdfebd67c85 --- /dev/null +++ b/build-tests/heft-swc-test/config/jest.config.json @@ -0,0 +1,8 @@ +{ + "extends": "@rushstack/heft-jest-plugin/includes/jest-web.config.json", + + // Enable code coverage for Jest + "collectCoverage": true, + "coverageDirectory": "/coverage", + "coverageReporters": ["cobertura", "html"] +} diff --git a/build-tests/heft-swc-test/config/rush-project.json b/build-tests/heft-swc-test/config/rush-project.json new file mode 100644 index 00000000000..eb3025cae7a --- /dev/null +++ b/build-tests/heft-swc-test/config/rush-project.json @@ -0,0 +1,14 @@ +{ + "$schema": "https://developer.microsoft.com/json-schemas/rush/v5/rush-project.schema.json", + + "operationSettings": [ + { + "operationName": "_phase:build", + "outputFolderNames": ["lib-commonjs", "lib-dts", "lib-esm", "temp/build"] + }, + { + "operationName": "_phase:test", + "outputFolderNames": ["coverage"] + } + ] +} diff --git a/build-tests/heft-swc-test/config/typescript.json b/build-tests/heft-swc-test/config/typescript.json new file mode 100644 index 00000000000..07809edc481 --- /dev/null +++ b/build-tests/heft-swc-test/config/typescript.json @@ -0,0 +1,6 @@ +/** + * Configures the TypeScript plugin for Heft. This plugin also manages linting. + */ +{ + "$schema": "https://developer.microsoft.com/json-schemas/heft/v0/typescript.schema.json" +} diff --git a/build-tests/heft-swc-test/package.json b/build-tests/heft-swc-test/package.json new file mode 100644 index 00000000000..221e0d7cedb --- /dev/null +++ b/build-tests/heft-swc-test/package.json @@ -0,0 +1,25 @@ +{ + "name": "heft-swc-test", + "description": "Building this project tests building with SWC", + "version": "1.0.0", + "private": true, + "main": "lib/index.js", + "license": "MIT", + "scripts": { + "build": "heft build --clean", + "_phase:build": "heft run --only build -- --clean", + "_phase:test": "heft run --only test -- --clean" + }, + "devDependencies": { + "local-eslint-config": "workspace:*", + "@rushstack/heft": "workspace:*", + "@rushstack/heft-isolated-typescript-transpile-plugin": "workspace:*", + "@rushstack/heft-jest-plugin": "workspace:*", + "@rushstack/heft-lint-plugin": "workspace:*", + "@rushstack/heft-typescript-plugin": "workspace:*", + "@types/heft-jest": "1.0.1", + "@types/webpack-env": "1.18.8", + "eslint": "~8.57.0", + "typescript": "~5.8.2" + } +} diff --git a/build-tests/heft-swc-test/src/index.ts b/build-tests/heft-swc-test/src/index.ts new file mode 100644 index 00000000000..659610ef84f --- /dev/null +++ b/build-tests/heft-swc-test/src/index.ts @@ -0,0 +1,7 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license. +// See LICENSE in the project root for license information. + +/** + * @public + */ +export class TestClass {} diff --git a/build-tests/heft-swc-test/src/test/ExampleTest.test.ts b/build-tests/heft-swc-test/src/test/ExampleTest.test.ts new file mode 100644 index 00000000000..ccae242d321 --- /dev/null +++ b/build-tests/heft-swc-test/src/test/ExampleTest.test.ts @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license. +// See LICENSE in the project root for license information. + +interface IInterface { + element: string; +} + +describe('Example Test', () => { + it('Correctly tests stuff', () => { + expect(true).toBeTruthy(); + }); + + it('Correctly handles snapshots', () => { + expect({ a: 1, b: 2, c: 3 }).toMatchSnapshot(); + }); + + it('Correctly handles TypeScript constructs', () => { + const interfaceInstance: IInterface = { + element: 'a' + }; + expect(interfaceInstance).toBeTruthy(); + }); +}); diff --git a/build-tests/heft-swc-test/src/test/__snapshots__/ExampleTest.test.ts.snap b/build-tests/heft-swc-test/src/test/__snapshots__/ExampleTest.test.ts.snap new file mode 100644 index 00000000000..1ca0d3b526a --- /dev/null +++ b/build-tests/heft-swc-test/src/test/__snapshots__/ExampleTest.test.ts.snap @@ -0,0 +1,9 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Example Test Correctly handles snapshots 1`] = ` +Object { + "a": 1, + "b": 2, + "c": 3, +} +`; diff --git a/build-tests/heft-swc-test/tsconfig.json b/build-tests/heft-swc-test/tsconfig.json new file mode 100644 index 00000000000..e6baff5e52b --- /dev/null +++ b/build-tests/heft-swc-test/tsconfig.json @@ -0,0 +1,28 @@ +{ + "$schema": "http://json.schemastore.org/tsconfig", + + "compilerOptions": { + "outDir": "lib-esm", + "rootDir": "src", + + "forceConsistentCasingInFileNames": true, + "jsx": "react", + "declaration": true, + "sourceMap": true, + "declarationMap": true, + "declarationDir": "lib-dts", + "emitDeclarationOnly": true, + "inlineSources": true, + "experimentalDecorators": true, + "moduleResolution": "node", + "strictNullChecks": true, + "noUnusedLocals": true, + "types": ["heft-jest", "webpack-env"], + + "module": "esnext", + "target": "esnext", + "lib": ["esnext"] + }, + "include": ["src/**/*.ts", "src/**/*.tsx"], + "exclude": ["node_modules"] +} diff --git a/common/changes/@rushstack/heft-isolated-typescript-transpile-plugin/fix-swc-source-maps_2025-05-05-21-34.json b/common/changes/@rushstack/heft-isolated-typescript-transpile-plugin/fix-swc-source-maps_2025-05-05-21-34.json new file mode 100644 index 00000000000..5ce9c08733b --- /dev/null +++ b/common/changes/@rushstack/heft-isolated-typescript-transpile-plugin/fix-swc-source-maps_2025-05-05-21-34.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@rushstack/heft-isolated-typescript-transpile-plugin", + "comment": "Fix source map comment in emitted files. Fix processing of \"outDir\" field to allow normal relative path formats (\"./lib\", or \"lib\" as opposed to \"/lib\").", + "type": "patch" + } + ], + "packageName": "@rushstack/heft-isolated-typescript-transpile-plugin" +} \ No newline at end of file diff --git a/common/config/rush/nonbrowser-approved-packages.json b/common/config/rush/nonbrowser-approved-packages.json index bdcbd6cf572..0ca2dcee958 100644 --- a/common/config/rush/nonbrowser-approved-packages.json +++ b/common/config/rush/nonbrowser-approved-packages.json @@ -162,6 +162,10 @@ "name": "@rushstack/heft-dev-cert-plugin", "allowedCategories": [ "libraries", "tests" ] }, + { + "name": "@rushstack/heft-isolated-typescript-transpile-plugin", + "allowedCategories": [ "tests" ] + }, { "name": "@rushstack/heft-jest-plugin", "allowedCategories": [ "libraries", "tests" ] diff --git a/common/config/subspaces/default/pnpm-lock.yaml b/common/config/subspaces/default/pnpm-lock.yaml index 104c481a2f4..ecc2d923870 100644 --- a/common/config/subspaces/default/pnpm-lock.yaml +++ b/common/config/subspaces/default/pnpm-lock.yaml @@ -1718,6 +1718,39 @@ importers: specifier: ~4.47.0 version: 4.47.0 + ../../../build-tests/heft-swc-test: + devDependencies: + '@rushstack/heft': + specifier: workspace:* + version: link:../../apps/heft + '@rushstack/heft-isolated-typescript-transpile-plugin': + specifier: workspace:* + version: link:../../heft-plugins/heft-isolated-typescript-transpile-plugin + '@rushstack/heft-jest-plugin': + specifier: workspace:* + version: link:../../heft-plugins/heft-jest-plugin + '@rushstack/heft-lint-plugin': + specifier: workspace:* + version: link:../../heft-plugins/heft-lint-plugin + '@rushstack/heft-typescript-plugin': + specifier: workspace:* + version: link:../../heft-plugins/heft-typescript-plugin + '@types/heft-jest': + specifier: 1.0.1 + version: 1.0.1 + '@types/webpack-env': + specifier: 1.18.8 + version: 1.18.8 + eslint: + specifier: ~8.57.0 + version: 8.57.0 + local-eslint-config: + specifier: workspace:* + version: link:../../eslint/local-eslint-config + typescript: + specifier: ~5.8.2 + version: 5.8.2 + ../../../build-tests/heft-typescript-composite-test: devDependencies: '@rushstack/heft': @@ -5453,7 +5486,7 @@ packages: '@babel/traverse': 7.24.0 '@babel/types': 7.24.0 convert-source-map: 1.9.0 - debug: 4.3.4(supports-color@8.1.1) + debug: 4.4.0 gensync: 1.0.0-beta.2 json5: 2.2.3 lodash: 4.17.21 @@ -5501,7 +5534,7 @@ packages: '@babel/traverse': 7.24.0 '@babel/types': 7.24.0 convert-source-map: 2.0.0 - debug: 4.3.4(supports-color@8.1.1) + debug: 4.4.0 gensync: 1.0.0-beta.2 json5: 2.2.3 semver: 6.3.1 @@ -5582,7 +5615,7 @@ packages: '@babel/helper-module-imports': 7.22.15 '@babel/helper-plugin-utils': 7.24.0 '@babel/traverse': 7.24.0 - debug: 4.3.4(supports-color@8.1.1) + debug: 4.4.0 lodash.debounce: 4.0.8 resolve: 1.22.8 semver: 6.3.1 @@ -5598,7 +5631,7 @@ packages: '@babel/core': 7.20.12 '@babel/helper-compilation-targets': 7.23.6 '@babel/helper-plugin-utils': 7.24.0 - debug: 4.3.4(supports-color@8.1.1) + debug: 4.4.0 lodash.debounce: 4.0.8 resolve: 1.22.8 transitivePeerDependencies: @@ -5613,7 +5646,7 @@ packages: '@babel/core': 7.20.12 '@babel/helper-compilation-targets': 7.23.6 '@babel/helper-plugin-utils': 7.24.0 - debug: 4.3.4(supports-color@8.1.1) + debug: 4.4.0 lodash.debounce: 4.0.8 resolve: 1.22.8 transitivePeerDependencies: @@ -6964,7 +6997,7 @@ packages: '@babel/helper-split-export-declaration': 7.22.6 '@babel/parser': 7.24.0 '@babel/types': 7.24.0 - debug: 4.3.4(supports-color@8.1.1) + debug: 4.4.0 globals: 11.12.0 transitivePeerDependencies: - supports-color @@ -7424,7 +7457,7 @@ packages: engines: {node: ^10.12.0 || >=12.0.0} dependencies: ajv: 6.12.6 - debug: 4.3.4(supports-color@8.1.1) + debug: 4.4.0 espree: 7.3.1 globals: 12.4.0 ignore: 4.0.6 @@ -7442,7 +7475,7 @@ packages: engines: {node: ^10.12.0 || >=12.0.0} dependencies: ajv: 6.12.6 - debug: 4.3.4(supports-color@8.1.1) + debug: 4.4.0 espree: 7.3.1 globals: 13.24.0 ignore: 4.0.6 @@ -7459,7 +7492,7 @@ packages: engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dependencies: ajv: 6.12.6 - debug: 4.3.4(supports-color@8.1.1) + debug: 4.4.0 espree: 9.6.1 globals: 13.24.0 ignore: 5.3.1 @@ -7476,7 +7509,7 @@ packages: engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dependencies: ajv: 6.12.6 - debug: 4.3.4(supports-color@8.1.1) + debug: 4.4.0 espree: 9.6.1 globals: 13.24.0 ignore: 5.3.1 @@ -8968,7 +9001,7 @@ packages: deprecated: Use @eslint/config-array instead dependencies: '@humanwhocodes/object-schema': 1.2.1 - debug: 4.3.4(supports-color@8.1.1) + debug: 4.4.0 minimatch: 3.0.8 transitivePeerDependencies: - supports-color @@ -8980,7 +9013,7 @@ packages: deprecated: Use @eslint/config-array instead dependencies: '@humanwhocodes/object-schema': 2.0.2 - debug: 4.3.4(supports-color@8.1.1) + debug: 4.4.0 minimatch: 3.0.8 transitivePeerDependencies: - supports-color @@ -8990,7 +9023,7 @@ packages: engines: {node: '>=10.10.0'} dependencies: '@humanwhocodes/object-schema': 1.2.1 - debug: 4.3.4(supports-color@8.1.1) + debug: 4.4.0 minimatch: 3.0.8 transitivePeerDependencies: - supports-color @@ -9002,7 +9035,7 @@ packages: deprecated: Use @eslint/config-array instead dependencies: '@humanwhocodes/object-schema': 1.2.1 - debug: 4.3.4(supports-color@8.1.1) + debug: 4.4.0 minimatch: 3.0.8 transitivePeerDependencies: - supports-color @@ -10976,7 +11009,7 @@ packages: dependencies: '@serverless-stack/aws-lambda-ric': 2.0.13 '@trpc/server': 9.27.4 - acorn: 8.11.3 + acorn: 8.14.0 acorn-walk: 8.3.2 async-retry: 1.3.3 aws-cdk: 2.50.0 @@ -12520,7 +12553,7 @@ packages: typescript: '>= 3.x' webpack: '>= 4 || ^4 || ^5' dependencies: - debug: 4.3.4(supports-color@8.1.1) + debug: 4.4.0 endent: 2.1.0 find-cache-dir: 3.3.2 flat-cache: 3.2.0 @@ -13533,7 +13566,7 @@ packages: '@typescript-eslint/type-utils': 6.19.1(eslint@7.11.0)(typescript@5.8.2) '@typescript-eslint/utils': 6.19.1(eslint@7.11.0)(typescript@5.8.2) '@typescript-eslint/visitor-keys': 6.19.1(typescript@5.8.2) - debug: 4.3.4(supports-color@8.1.1) + debug: 4.4.0 eslint: 7.11.0 graphemer: 1.4.0 ignore: 5.3.1 @@ -13562,7 +13595,7 @@ packages: '@typescript-eslint/type-utils': 6.19.1(eslint@7.30.0)(typescript@5.8.2) '@typescript-eslint/utils': 6.19.1(eslint@7.30.0)(typescript@5.8.2) '@typescript-eslint/visitor-keys': 6.19.1(typescript@5.8.2) - debug: 4.3.4(supports-color@8.1.1) + debug: 4.4.0 eslint: 7.30.0 graphemer: 1.4.0 ignore: 5.3.1 @@ -13591,7 +13624,7 @@ packages: '@typescript-eslint/type-utils': 6.19.1(eslint@7.7.0)(typescript@5.8.2) '@typescript-eslint/utils': 6.19.1(eslint@7.7.0)(typescript@5.8.2) '@typescript-eslint/visitor-keys': 6.19.1(typescript@5.8.2) - debug: 4.3.4(supports-color@8.1.1) + debug: 4.4.0 eslint: 7.7.0 graphemer: 1.4.0 ignore: 5.3.1 @@ -13620,7 +13653,7 @@ packages: '@typescript-eslint/type-utils': 6.19.1(eslint@8.57.0)(typescript@5.8.2) '@typescript-eslint/utils': 6.19.1(eslint@8.57.0)(typescript@5.8.2) '@typescript-eslint/visitor-keys': 6.19.1(typescript@5.8.2) - debug: 4.3.4(supports-color@8.1.1) + debug: 4.4.0 eslint: 8.57.0 graphemer: 1.4.0 ignore: 5.3.1 @@ -13859,7 +13892,7 @@ packages: dependencies: '@typescript-eslint/typescript-estree': 6.19.1(typescript@5.8.2) '@typescript-eslint/utils': 6.19.1(eslint@7.11.0)(typescript@5.8.2) - debug: 4.3.4(supports-color@8.1.1) + debug: 4.4.0 eslint: 7.11.0 ts-api-utils: 1.3.0(typescript@5.8.2) typescript: 5.8.2 @@ -13879,7 +13912,7 @@ packages: dependencies: '@typescript-eslint/typescript-estree': 6.19.1(typescript@5.8.2) '@typescript-eslint/utils': 6.19.1(eslint@7.30.0)(typescript@5.8.2) - debug: 4.3.4(supports-color@8.1.1) + debug: 4.4.0 eslint: 7.30.0 ts-api-utils: 1.3.0(typescript@5.8.2) typescript: 5.8.2 @@ -13899,7 +13932,7 @@ packages: dependencies: '@typescript-eslint/typescript-estree': 6.19.1(typescript@5.8.2) '@typescript-eslint/utils': 6.19.1(eslint@7.7.0)(typescript@5.8.2) - debug: 4.3.4(supports-color@8.1.1) + debug: 4.4.0 eslint: 7.7.0 ts-api-utils: 1.3.0(typescript@5.8.2) typescript: 5.8.2 @@ -13919,7 +13952,7 @@ packages: dependencies: '@typescript-eslint/typescript-estree': 6.19.1(typescript@5.8.2) '@typescript-eslint/utils': 6.19.1(eslint@8.57.0)(typescript@5.8.2) - debug: 4.3.4(supports-color@8.1.1) + debug: 4.4.0 eslint: 8.57.0 ts-api-utils: 1.3.0(typescript@5.8.2) typescript: 5.8.2 @@ -13936,7 +13969,7 @@ packages: dependencies: '@typescript-eslint/typescript-estree': 8.26.1(typescript@4.9.5) '@typescript-eslint/utils': 8.26.1(eslint@8.57.0)(typescript@4.9.5) - debug: 4.3.4(supports-color@8.1.1) + debug: 4.4.0 eslint: 8.57.0 ts-api-utils: 2.0.1(typescript@4.9.5) typescript: 4.9.5 @@ -13953,7 +13986,7 @@ packages: dependencies: '@typescript-eslint/typescript-estree': 8.26.1(typescript@5.8.2) '@typescript-eslint/utils': 8.26.1(eslint@8.57.0)(typescript@5.8.2) - debug: 4.3.4(supports-color@8.1.1) + debug: 4.4.0 eslint: 8.57.0 ts-api-utils: 2.0.1(typescript@5.8.2) typescript: 5.8.2 @@ -13997,7 +14030,7 @@ packages: dependencies: '@typescript-eslint/types': 6.19.1(typescript@5.8.2) '@typescript-eslint/visitor-keys': 6.19.1(typescript@5.8.2) - debug: 4.3.4(supports-color@8.1.1) + debug: 4.4.0 globby: 11.1.0 is-glob: 4.0.3 minimatch: 9.0.3 @@ -14180,12 +14213,8 @@ packages: transitivePeerDependencies: - typescript - /@ungap/structured-clone@1.2.0: - resolution: {integrity: sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ==} - /@ungap/structured-clone@1.3.0: resolution: {integrity: sha512-WmoN8qaIAo7WTYWbAZuG8PYEhn5fkz7dZrqTBZ7dtt//lL2Gwms1IcnQ5yHqjDfX8Ft5j4YzDM23f87zBfDe9g==} - dev: false /@vscode/test-electron@1.6.2: resolution: {integrity: sha512-W01ajJEMx6223Y7J5yaajGjVs1QfW3YGkkOJHVKfAMEqNB1ZHN9wCcViehv5ZwVSSJnjhu6lYEYgwBdHtCxqhQ==} @@ -14490,7 +14519,7 @@ packages: /acorn-globals@7.0.1: resolution: {integrity: sha512-umOSDSDrfHbTNPuNpC2NSnnA3LUrqpevPb4T9jRx4MagXNS0rs+gwiTcAvqCRmsD6utzsrzNt+ebm00SNWiC3Q==} dependencies: - acorn: 8.11.3 + acorn: 8.14.0 acorn-walk: 8.3.2 /acorn-jsx@5.3.2(acorn@7.4.1): @@ -14501,12 +14530,12 @@ packages: acorn: 7.4.1 dev: true - /acorn-jsx@5.3.2(acorn@8.11.3): + /acorn-jsx@5.3.2(acorn@8.14.0): resolution: {integrity: sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==} peerDependencies: acorn: ^6.0.0 || ^7.0.0 || ^8.0.0 dependencies: - acorn: 8.11.3 + acorn: 8.14.0 /acorn-walk@7.2.0: resolution: {integrity: sha512-OPdCF6GsMIP+Az+aWfAAOEt2/+iVDKE7oy6lJ098aoe59oAmK76qV6Gw60SbZ8jHuG2wH058GF4pLFbYamYrVA==} @@ -14552,7 +14581,7 @@ packages: resolution: {integrity: sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==} engines: {node: '>= 6.0.0'} dependencies: - debug: 4.3.4(supports-color@8.1.1) + debug: 4.4.0 transitivePeerDependencies: - supports-color @@ -14560,7 +14589,7 @@ packages: resolution: {integrity: sha512-o/zjMZRhJxny7OyEF+Op8X+efiELC7k7yOjMzgfzVqOzXqkBkWI79YoTdOtsuWd5BWhAGAuOY/Xa6xpiaWXiNg==} engines: {node: '>= 14'} dependencies: - debug: 4.3.4(supports-color@8.1.1) + debug: 4.4.0 transitivePeerDependencies: - supports-color dev: false @@ -15105,7 +15134,7 @@ packages: resolution: {integrity: sha512-AOhBxyLVdpOad3TujtC9kL/9r3HnTkxwQ5ggOsYrvvZP1cCFvzHWJd5XxZDFuTn+IN8vkKSG5SEJrd27vCSbeA==} dependencies: archy: 1.0.0 - debug: 4.3.4(supports-color@8.1.1) + debug: 4.4.0 fastq: 1.17.1 queue-microtask: 1.2.3 transitivePeerDependencies: @@ -17053,7 +17082,6 @@ packages: optional: true dependencies: ms: 2.1.3 - dev: false /debuglog@1.0.1: resolution: {integrity: sha512-syBZ+rnAK3EgMsH2aYEOLUW7mZSY9Gb+0wUMCFsZvcmiz+HigA0LOcq/HoQqVuGG+EKykunc7QG2bzrponfaSw==} @@ -17220,7 +17248,7 @@ packages: callsite: 1.0.0 camelcase: 6.3.0 cosmiconfig: 7.1.0 - debug: 4.3.4(supports-color@8.1.1) + debug: 4.4.0 deps-regex: 0.2.0 findup-sync: 5.0.0 ignore: 5.3.1 @@ -17321,7 +17349,7 @@ packages: hasBin: true dependencies: address: 1.2.2 - debug: 4.3.4(supports-color@8.1.1) + debug: 4.4.0 transitivePeerDependencies: - supports-color dev: true @@ -18647,11 +18675,11 @@ packages: '@humanwhocodes/config-array': 0.11.14 '@humanwhocodes/module-importer': 1.0.1 '@nodelib/fs.walk': 1.2.8 - '@ungap/structured-clone': 1.2.0 + '@ungap/structured-clone': 1.3.0 ajv: 6.12.6 chalk: 4.1.2 cross-spawn: 7.0.3 - debug: 4.3.4(supports-color@8.1.1) + debug: 4.4.0 doctrine: 3.0.0 escape-string-regexp: 4.0.0 eslint-scope: 7.2.2 @@ -18732,8 +18760,8 @@ packages: resolution: {integrity: sha512-MWkrWZbJsL2UwnjxTX3gG8FneachS/Mwg7tdGXce011sJd5b0JG54vat5KHnfSBODZ3Wvzd2WnjxyzsRoVv+ww==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} dependencies: - acorn: 8.11.3 - acorn-jsx: 5.3.2(acorn@8.11.3) + acorn: 8.14.0 + acorn-jsx: 5.3.2(acorn@8.14.0) eslint-visitor-keys: 4.2.0 dev: true @@ -18750,8 +18778,8 @@ packages: resolution: {integrity: sha512-oruZaFkjorTpF32kDSI5/75ViwGeZginGGy2NoOSg3Q9bnwlnmDm4HLnkl0RE3n+njDXR037aY1+x58Z/zFdwQ==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dependencies: - acorn: 8.11.3 - acorn-jsx: 5.3.2(acorn@8.11.3) + acorn: 8.14.0 + acorn-jsx: 5.3.2(acorn@8.14.0) eslint-visitor-keys: 3.4.3 /esprima@4.0.1: @@ -20389,7 +20417,7 @@ packages: dependencies: '@tootallnate/once': 1.1.2 agent-base: 6.0.2 - debug: 4.3.4(supports-color@8.1.1) + debug: 4.4.0 transitivePeerDependencies: - supports-color dev: true @@ -20400,7 +20428,7 @@ packages: dependencies: '@tootallnate/once': 2.0.0 agent-base: 6.0.2 - debug: 4.3.4(supports-color@8.1.1) + debug: 4.4.0 transitivePeerDependencies: - supports-color @@ -20409,7 +20437,7 @@ packages: engines: {node: '>= 14'} dependencies: agent-base: 7.1.0 - debug: 4.3.4(supports-color@8.1.1) + debug: 4.4.0 transitivePeerDependencies: - supports-color dev: false @@ -20465,7 +20493,7 @@ packages: engines: {node: '>= 6.0.0'} dependencies: agent-base: 5.1.1 - debug: 4.3.4(supports-color@8.1.1) + debug: 4.4.0 transitivePeerDependencies: - supports-color dev: true @@ -20484,7 +20512,7 @@ packages: engines: {node: '>= 14'} dependencies: agent-base: 7.1.0 - debug: 4.3.4(supports-color@8.1.1) + debug: 4.4.0 transitivePeerDependencies: - supports-color dev: false @@ -21203,7 +21231,7 @@ packages: resolution: {integrity: sha512-n3s8EwkdFIJCG3BPKBYvskgXGoy88ARzvegkitk60NxRdwltLOTaH7CUiMRXvwYorl0Q712iEjcWB+fK/MrWVw==} engines: {node: '>=10'} dependencies: - debug: 4.3.4(supports-color@8.1.1) + debug: 4.4.0 istanbul-lib-coverage: 3.2.2 source-map: 0.6.1 transitivePeerDependencies: @@ -22030,7 +22058,7 @@ packages: optional: true dependencies: abab: 2.0.6 - acorn: 8.11.3 + acorn: 8.14.0 acorn-globals: 7.0.1 cssom: 0.5.0 cssstyle: 2.3.0 @@ -22529,7 +22557,7 @@ packages: engines: {node: '>=8.0'} dependencies: date-format: 4.0.14 - debug: 4.3.4(supports-color@8.1.1) + debug: 4.4.0 flatted: 3.3.1 rfdc: 1.3.1 streamroller: 3.1.5 @@ -24797,7 +24825,7 @@ packages: engines: {node: '>=8.16.0'} dependencies: '@types/mime-types': 2.1.4 - debug: 4.3.4(supports-color@8.1.1) + debug: 4.4.0 extract-zip: 1.7.0 https-proxy-agent: 4.0.0 mime: 2.6.0 @@ -24929,7 +24957,7 @@ packages: /rc-config-loader@4.1.3: resolution: {integrity: sha512-kD7FqML7l800i6pS6pvLyIE2ncbk9Du8Q0gp/4hMPhJU6ZxApkoLcGD8ZeqgiAlfwZ6BlETq6qqe+12DUL207w==} dependencies: - debug: 4.3.4(supports-color@8.1.1) + debug: 4.4.0 js-yaml: 4.1.0 json5: 2.2.3 require-from-string: 2.0.2 @@ -26608,7 +26636,7 @@ packages: engines: {node: '>= 6'} dependencies: agent-base: 6.0.2 - debug: 4.3.4(supports-color@8.1.1) + debug: 4.4.0 socks: 2.8.1 transitivePeerDependencies: - supports-color @@ -26732,7 +26760,7 @@ packages: /spdy-transport@3.0.0: resolution: {integrity: sha512-hsLVFE5SjA6TCisWeJXFKniGGOpBgMLmerfO2aCyCU5s7nJ/rpAepqmFifv/GCbSbueEeAJJnmSQ2rKC/g8Fcw==} dependencies: - debug: 4.3.4(supports-color@8.1.1) + debug: 4.4.0 detect-node: 2.1.0 hpack.js: 2.1.6 obuf: 1.1.2 @@ -26746,7 +26774,7 @@ packages: resolution: {integrity: sha512-r46gZQZQV+Kl9oItvl1JZZqJKGr+oEkB08A6BzkiR7593/7IbtuncXHd2YoYeTsG4157ZssMu9KYvUHLcjcDoA==} engines: {node: '>=6.0.0'} dependencies: - debug: 4.3.4(supports-color@8.1.1) + debug: 4.4.0 handle-thing: 2.0.1 http-deceiver: 1.2.7 select-hose: 2.0.0 @@ -26863,7 +26891,7 @@ packages: engines: {node: '>=8.0'} dependencies: date-format: 4.0.14 - debug: 4.3.4(supports-color@8.1.1) + debug: 4.4.0 fs-extra: 8.1.0 transitivePeerDependencies: - supports-color diff --git a/common/config/subspaces/default/repo-state.json b/common/config/subspaces/default/repo-state.json index e5e157b00f0..bf53d6e721b 100644 --- a/common/config/subspaces/default/repo-state.json +++ b/common/config/subspaces/default/repo-state.json @@ -1,5 +1,5 @@ // DO NOT MODIFY THIS FILE MANUALLY BUT DO COMMIT IT. It is generated and used by Rush. { - "pnpmShrinkwrapHash": "543a92cc45070b162c2c911f153d08e9577c2c5e", + "pnpmShrinkwrapHash": "cffd2b8ab4cceebd7d5a02823e015b7eaabe89da", "preferredVersionsHash": "54149ea3f01558a859c96dee2052b797d4defe68" } diff --git a/heft-plugins/heft-isolated-typescript-transpile-plugin/src/SwcIsolatedTranspilePlugin.ts b/heft-plugins/heft-isolated-typescript-transpile-plugin/src/SwcIsolatedTranspilePlugin.ts index 3487f01e8b0..00133063bac 100644 --- a/heft-plugins/heft-isolated-typescript-transpile-plugin/src/SwcIsolatedTranspilePlugin.ts +++ b/heft-plugins/heft-isolated-typescript-transpile-plugin/src/SwcIsolatedTranspilePlugin.ts @@ -278,7 +278,8 @@ async function transpileProjectAsync( const outputOptions: Map = new Map(); for (const emitKind of emitKinds) { - outputOptions.set(emitKind.outDir, getOptionsByExtension(emitKind)); + const { outDir } = emitKind; + outputOptions.set(normalizeRelativeDir(outDir), getOptionsByExtension(emitKind)); } const tasks: ITransformTask[] = []; @@ -303,7 +304,7 @@ async function transpileProjectAsync( for (const [outputPrefix, optionsByExtension] of outputOptions) { const jsFilePath: string = `${outputPrefix}${relativeJsFilePath}`; const mapFilePath: string | undefined = externalSourceMaps ? `${jsFilePath}.map` : undefined; - const absoluteMapFilePath: string = `${buildFolderPath}${mapFilePath}`; + const absoluteMapFilePath: string = `${buildFolderPath}/${mapFilePath}`; const relativeMapSrcFilePath: string = Path.convertToSlashes( path.relative(path.dirname(absoluteMapFilePath), srcFilePath) ); @@ -397,6 +398,14 @@ function printTiming(logger: IScopedLogger, times: [string, number][], descripto } } +function normalizeRelativeDir(relativeDir: string): string { + return relativeDir.startsWith('./') + ? relativeDir.slice(2) + : relativeDir.startsWith('/') + ? relativeDir.slice(1) + : relativeDir; +} + function endsWithCharacterX(filePath: string): boolean { return filePath.charCodeAt(filePath.length - 1) === 120; } diff --git a/heft-plugins/heft-isolated-typescript-transpile-plugin/src/TranspileWorker.ts b/heft-plugins/heft-isolated-typescript-transpile-plugin/src/TranspileWorker.ts index b9e5a7f52bd..e7982822e1a 100644 --- a/heft-plugins/heft-isolated-typescript-transpile-plugin/src/TranspileWorker.ts +++ b/heft-plugins/heft-isolated-typescript-transpile-plugin/src/TranspileWorker.ts @@ -79,14 +79,14 @@ const handleMessageAsync = async (message: ITransformModulesRequestMessage | fal let { code, map } = result; if (mapFilePath && map) { - code += `\n//#sourceMappingUrl=./${basename(mapFilePath)}`; + code += `\n//# sourceMappingURL=./${basename(mapFilePath)}`; const parsedMap: ISourceMap = JSON.parse(map); parsedMap.sources[0] = relativeSrcFilePath; map = JSON.stringify(parsedMap); - writeFileSync(`${buildFolderPath}${mapFilePath}`, map, 'utf8'); + writeFileSync(`${buildFolderPath}/${mapFilePath}`, map, 'utf8'); } - writeFileSync(`${buildFolderPath}${jsFilePath}`, code, 'utf8'); + writeFileSync(`${buildFolderPath}/${jsFilePath}`, code, 'utf8'); } }, { diff --git a/rush.json b/rush.json index e977144bc85..3d8f5018a1e 100644 --- a/rush.json +++ b/rush.json @@ -863,6 +863,12 @@ "reviewCategory": "tests", "shouldPublish": false }, + { + "packageName": "heft-swc-test", + "projectFolder": "build-tests/heft-swc-test", + "reviewCategory": "tests", + "shouldPublish": false + }, { "packageName": "heft-typescript-composite-test", "projectFolder": "build-tests/heft-typescript-composite-test",