Skip to content

Commit 3209573

Browse files
sherlockfengD4N14L
andauthored
[@rushstack/heft-config-file] Replace node structuredClone (microsoft#5206)
* chore: replace node structuredclone * Update common/changes/@rushstack/heft-config-file/chore-replace-node-structuredclone_2025-04-24-03-50.json Co-authored-by: Daniel <3473356+D4N14L@users.noreply.github.com> * feat: alphabetically sort dependencies and add TODO --------- Co-authored-by: sherlockfeng <sherlockfeng@users.noreply.github.com> Co-authored-by: Daniel <3473356+D4N14L@users.noreply.github.com>
1 parent 36b9c0f commit 3209573

8 files changed

Lines changed: 56 additions & 19 deletions

File tree

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"changes": [
3+
{
4+
"packageName": "@rushstack/heft-config-file",
5+
"comment": "Fix Node 16 compatibility by using non-built-in structuredClone",
6+
"type": "patch"
7+
}
8+
],
9+
"packageName": "@rushstack/heft-config-file"
10+
}

common/config/rush/browser-approved-packages.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@
4646
"name": "@rushstack/rush-vscode-command-webview",
4747
"allowedCategories": [ "vscode-extensions" ]
4848
},
49+
{
50+
"name": "@ungap/structured-clone",
51+
"allowedCategories": [ "libraries" ]
52+
},
4953
{
5054
"name": "axios",
5155
"allowedCategories": [ "libraries" ]

common/config/subspaces/build-tests-subspace/pnpm-lock.yaml

Lines changed: 16 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// DO NOT MODIFY THIS FILE MANUALLY BUT DO COMMIT IT. It is generated and used by Rush.
22
{
3-
"pnpmShrinkwrapHash": "d9e805ea30f80e290b5d5ea83856c8b5d7302941",
3+
"pnpmShrinkwrapHash": "e47112c7d099f189f37770e10351e406cf1ec451",
44
"preferredVersionsHash": "54149ea3f01558a859c96dee2052b797d4defe68",
5-
"packageJsonInjectedDependenciesHash": "949bb6038c34cb0580b82a6f728b26a66fff3177"
5+
"packageJsonInjectedDependenciesHash": "a1277b20787fa46cb118a7352d5ca6a922a1098b"
66
}

common/config/subspaces/default/pnpm-lock.yaml

Lines changed: 14 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// DO NOT MODIFY THIS FILE MANUALLY BUT DO COMMIT IT. It is generated and used by Rush.
22
{
3-
"pnpmShrinkwrapHash": "1cd4f5444a9d6a085d5418372291de283264d9fb",
3+
"pnpmShrinkwrapHash": "cff3c4ef9a27a2377b9fb1f907c5441b3996d5fb",
44
"preferredVersionsHash": "54149ea3f01558a859c96dee2052b797d4defe68"
55
}

libraries/heft-config-file/package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,13 @@
2424
"@rushstack/node-core-library": "workspace:*",
2525
"@rushstack/rig-package": "workspace:*",
2626
"@rushstack/terminal": "workspace:*",
27+
"@ungap/structured-clone": "~1.3.0",
2728
"jsonpath-plus": "~10.3.0"
2829
},
2930
"devDependencies": {
30-
"local-eslint-config": "workspace:*",
3131
"@rushstack/heft": "0.71.2",
32-
"decoupled-local-node-rig": "workspace:*"
32+
"@types/ungap__structured-clone": "~1.2.0",
33+
"decoupled-local-node-rig": "workspace:*",
34+
"local-eslint-config": "workspace:*"
3335
}
3436
}

libraries/heft-config-file/src/ConfigurationFileBase.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import * as nodeJsPath from 'path';
55
import { JSONPath } from 'jsonpath-plus';
66
import { JsonSchema, JsonFile, Import, FileSystem } from '@rushstack/node-core-library';
7+
import structuredClone from '@ungap/structured-clone';
78
import type { ITerminal } from '@rushstack/terminal';
89

910
interface IConfigurationJson {
@@ -624,7 +625,10 @@ export abstract class ConfigurationFileBase<TConfigurationFile, TExtraOptions ex
624625
projectFolderPath: string | undefined
625626
): IConfigurationJson & TConfigurationFile {
626627
// Deep copy the configuration file because different callers might contextualize properties differently.
627-
const result: IConfigurationJson & TConfigurationFile = structuredClone(entry.configurationFile);
628+
// TODO: Replace this version of structuredClone with the built-in version once Node 16 support is dropped on the TikTok side
629+
const result: IConfigurationJson & TConfigurationFile = structuredClone<
630+
IConfigurationJson & TConfigurationFile
631+
>(entry.configurationFile);
628632

629633
const { resolvedConfigurationFilePath } = entry;
630634

0 commit comments

Comments
 (0)