Skip to content

Commit a661e41

Browse files
Add unstable to API exports in package.json (#3844)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: andrewbranch <3277153+andrewbranch@users.noreply.github.com>
1 parent 895d80c commit a661e41

9 files changed

Lines changed: 80 additions & 80 deletions

File tree

_packages/native-preview/package.json

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -40,47 +40,47 @@
4040
},
4141
"exports": {
4242
"./package.json": "./package.json",
43-
"./sync": {
43+
"./unstable/sync": {
4444
"@typescript/source": "./src/api/sync/api.ts",
4545
"default": "./dist/api/sync/api.js"
4646
},
47-
"./async": {
47+
"./unstable/async": {
4848
"@typescript/source": "./src/api/async/api.ts",
4949
"default": "./dist/api/async/api.js"
5050
},
51-
"./fs": {
51+
"./unstable/fs": {
5252
"@typescript/source": "./src/api/fs.ts",
5353
"default": "./dist/api/fs.js"
5454
},
55-
"./proto": {
55+
"./unstable/proto": {
5656
"@typescript/source": "./src/api/proto.ts",
5757
"default": "./dist/api/proto.js"
5858
},
59-
"./ast": {
59+
"./unstable/ast": {
6060
"@typescript/source": "./src/ast/index.ts",
6161
"default": "./dist/ast/index.js"
6262
},
63-
"./ast/is": {
63+
"./unstable/ast/is": {
6464
"@typescript/source": "./src/ast/is.ts",
6565
"default": "./dist/ast/is.js"
6666
},
67-
"./ast/factory": {
67+
"./unstable/ast/factory": {
6868
"@typescript/source": "./src/ast/factory.generated.ts",
6969
"default": "./dist/ast/factory.generated.js"
7070
},
71-
"./ast/utils": {
71+
"./unstable/ast/utils": {
7272
"@typescript/source": "./src/ast/utils.ts",
7373
"default": "./dist/ast/utils.js"
7474
},
75-
"./ast/scanner": {
75+
"./unstable/ast/scanner": {
7676
"@typescript/source": "./src/ast/scanner.ts",
7777
"default": "./dist/ast/scanner.js"
7878
},
79-
"./ast/visitor": {
79+
"./unstable/ast/visitor": {
8080
"@typescript/source": "./src/ast/visitor.ts",
8181
"default": "./dist/ast/visitor.js"
8282
},
83-
"./ast/clone": {
83+
"./unstable/ast/clone": {
8484
"@typescript/source": "./src/ast/clone.ts",
8585
"default": "./dist/ast/clone.js"
8686
}

_packages/native-preview/test/async/api.bench.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ import {
22
type Node,
33
type SourceFile,
44
SyntaxKind,
5-
} from "@typescript/native-preview/ast";
5+
} from "@typescript/native-preview/unstable/ast";
66
import {
77
API,
88
type Project,
99
type Snapshot,
10-
} from "@typescript/native-preview/async"; // @sync: } from "@typescript/native-preview/sync";
10+
} from "@typescript/native-preview/unstable/async"; // @sync: } from "@typescript/native-preview/unstable/sync";
1111
import {
1212
existsSync,
1313
writeFileSync,

_packages/native-preview/test/async/api.test.ts

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import {
1717
type Node,
1818
NodeFlags,
1919
SyntaxKind,
20-
} from "@typescript/native-preview/ast";
20+
} from "@typescript/native-preview/unstable/ast";
2121
import {
2222
createArrayTypeNode,
2323
createFunctionTypeNode,
@@ -28,8 +28,8 @@ import {
2828
createTypeAliasDeclaration,
2929
createTypeReferenceNode,
3030
createUnionTypeNode,
31-
} from "@typescript/native-preview/ast/factory";
32-
import { visitEachChild } from "@typescript/native-preview/ast/visitor";
31+
} from "@typescript/native-preview/unstable/ast/factory";
32+
import { visitEachChild } from "@typescript/native-preview/unstable/ast/visitor";
3333
import {
3434
API,
3535
type ConditionalType,
@@ -46,9 +46,9 @@ import {
4646
TypePredicateKind,
4747
type TypeReference,
4848
type UnionOrIntersectionType,
49-
} from "@typescript/native-preview/async"; // @sync: } from "@typescript/native-preview/sync";
50-
import { createVirtualFileSystem } from "@typescript/native-preview/fs";
51-
import type { FileSystem } from "@typescript/native-preview/fs";
49+
} from "@typescript/native-preview/unstable/async"; // @sync: } from "@typescript/native-preview/unstable/sync";
50+
import { createVirtualFileSystem } from "@typescript/native-preview/unstable/fs";
51+
import type { FileSystem } from "@typescript/native-preview/unstable/fs";
5252
import assert from "node:assert";
5353
import { globSync } from "node:fs";
5454
import { resolve } from "node:path";
@@ -1295,7 +1295,7 @@ foo(42);
12951295
// statement[1] = foo(42); which is an ExpressionStatement -> CallExpression
12961296
const callStmt = sourceFile.statements[1];
12971297
assert.ok(callStmt);
1298-
let numLiteral: import("@typescript/native-preview/ast").Expression | undefined;
1298+
let numLiteral: import("@typescript/native-preview/unstable/ast").Expression | undefined;
12991299
callStmt.forEachChild(function visit(node) {
13001300
if (isCallExpression(node)) {
13011301
// First argument
@@ -1351,7 +1351,7 @@ export function check(x: string | number) {
13511351
const funcDecl = sourceFile.statements[0];
13521352
assert.ok(funcDecl);
13531353
// Walk to find the first "return x" — inside the if, x should be narrowed to string
1354-
let firstReturnX: import("@typescript/native-preview/ast").Node | undefined;
1354+
let firstReturnX: import("@typescript/native-preview/unstable/ast").Node | undefined;
13551355
funcDecl.forEachChild(function visit(node) {
13561356
if (isReturnStatement(node) && !firstReturnX) {
13571357
// The expression of the return statement is the identifier "x"
@@ -1391,7 +1391,7 @@ export const obj = { name };
13911391

13921392
// Find the shorthand property assignment { name }
13931393
// statement[1] = export const obj = { name };
1394-
let shorthandNode: import("@typescript/native-preview/ast").Node | undefined;
1394+
let shorthandNode: import("@typescript/native-preview/unstable/ast").Node | undefined;
13951395
sourceFile.forEachChild(function visit(node) {
13961396
if (isShorthandPropertyAssignment(node)) {
13971397
shorthandNode = node;
@@ -1864,7 +1864,7 @@ describe("Checker - isContextSensitive", () => {
18641864
const sourceFile = await project.program.getSourceFile("/src/main.ts");
18651865
assert.ok(sourceFile);
18661866
// Find the arrow function node
1867-
let arrowFn: import("@typescript/native-preview/ast").Node | undefined;
1867+
let arrowFn: import("@typescript/native-preview/unstable/ast").Node | undefined;
18681868
sourceFile.forEachChild(function visit(node) {
18691869
if (node.kind === SyntaxKind.ArrowFunction) {
18701870
arrowFn = node;
@@ -2086,7 +2086,7 @@ export const obj = { m: 1, s: "hi", b: true };
20862086
assert.ok(sourceFile);
20872087

20882088
// Find the regex literal node
2089-
let regexNode: import("@typescript/native-preview/ast").Node | undefined;
2089+
let regexNode: import("@typescript/native-preview/unstable/ast").Node | undefined;
20902090
sourceFile.forEachChild(function visit(node) {
20912091
if (node.kind === SyntaxKind.RegularExpressionLiteral) {
20922092
regexNode = node;
@@ -2122,7 +2122,7 @@ describe("modifierFlags", () => {
21222122
const sourceFile = await project.program.getSourceFile("/src/index.ts");
21232123
assert.ok(sourceFile);
21242124

2125-
let fnNode: import("@typescript/native-preview/ast").FunctionDeclaration | undefined;
2125+
let fnNode: import("@typescript/native-preview/unstable/ast").FunctionDeclaration | undefined;
21262126
sourceFile.forEachChild(function visit(node) {
21272127
if (isFunctionDeclaration(node)) {
21282128
fnNode = node;
@@ -2150,7 +2150,7 @@ describe("modifierFlags", () => {
21502150
const sourceFile = await project.program.getSourceFile("/src/index.ts");
21512151
assert.ok(sourceFile);
21522152

2153-
let fnNode: import("@typescript/native-preview/ast").FunctionDeclaration | undefined;
2153+
let fnNode: import("@typescript/native-preview/unstable/ast").FunctionDeclaration | undefined;
21542154
sourceFile.forEachChild(function visit(node) {
21552155
if (isFunctionDeclaration(node)) {
21562156
fnNode = node;
@@ -2179,7 +2179,7 @@ describe("Checker - getResolvedSymbol", () => {
21792179
assert.ok(sourceFile);
21802180

21812181
// Find the 'x' identifier in `const y = x`
2182-
let refNode: import("@typescript/native-preview/ast").Identifier | undefined;
2182+
let refNode: import("@typescript/native-preview/unstable/ast").Identifier | undefined;
21832183
sourceFile.forEachChild(function visit(node) {
21842184
if (isIdentifier(node) && node.text === "x") {
21852185
// We want the reference, not the declaration - take the last one
@@ -2211,7 +2211,7 @@ describe("VariableDeclarationList - BlockScoped flags", () => {
22112211
const sourceFile = await project.program.getSourceFile("/src/index.ts");
22122212
assert.ok(sourceFile);
22132213

2214-
let declList: import("@typescript/native-preview/ast").Node | undefined;
2214+
let declList: import("@typescript/native-preview/unstable/ast").Node | undefined;
22152215
sourceFile.forEachChild(function visit(node) {
22162216
if (isVariableDeclarationList(node)) {
22172217
declList = node;
@@ -2237,7 +2237,7 @@ describe("VariableDeclarationList - BlockScoped flags", () => {
22372237
const sourceFile = await project.program.getSourceFile("/src/index.ts");
22382238
assert.ok(sourceFile);
22392239

2240-
let declList: import("@typescript/native-preview/ast").Node | undefined;
2240+
let declList: import("@typescript/native-preview/unstable/ast").Node | undefined;
22412241
sourceFile.forEachChild(function visit(node) {
22422242
if (isVariableDeclarationList(node)) {
22432243
declList = node;
@@ -2263,9 +2263,9 @@ test("TypeOperator operator kind", async () => {
22632263
const project = snapshot.getProject("/tsconfig.json")!;
22642264
const sourceFile = await project.program.getSourceFile("/src/index.ts");
22652265
assert(sourceFile);
2266-
const param = (sourceFile.statements[0] as import("@typescript/native-preview/ast").FunctionDeclaration).parameters[0];
2266+
const param = (sourceFile.statements[0] as import("@typescript/native-preview/unstable/ast").FunctionDeclaration).parameters[0];
22672267
assert(param);
2268-
const type = param.type as import("@typescript/native-preview/ast").TypeOperatorNode;
2268+
const type = param.type as import("@typescript/native-preview/unstable/ast").TypeOperatorNode;
22692269
assert(type);
22702270
assert.equal(type.kind, SyntaxKind.TypeOperator);
22712271
assert.equal(type.operator, SyntaxKind.ReadonlyKeyword);
@@ -2287,9 +2287,9 @@ test("SpreadAssignment roundtrip", async () => {
22872287
const project = snapshot.getProject("/tsconfig.json")!;
22882288
const sourceFile = await project.program.getSourceFile("/src/index.ts");
22892289
assert(sourceFile);
2290-
const stmt = sourceFile.statements[0] as import("@typescript/native-preview/ast").VariableStatement;
2291-
const object = stmt.declarationList.declarations[0].initializer as import("@typescript/native-preview/ast").ObjectLiteralExpression;
2292-
const assignment = object.properties[0] as import("@typescript/native-preview/ast").SpreadAssignment;
2290+
const stmt = sourceFile.statements[0] as import("@typescript/native-preview/unstable/ast").VariableStatement;
2291+
const object = stmt.declarationList.declarations[0].initializer as import("@typescript/native-preview/unstable/ast").ObjectLiteralExpression;
2292+
const assignment = object.properties[0] as import("@typescript/native-preview/unstable/ast").SpreadAssignment;
22932293
assert(assignment);
22942294
assert.equal(assignment.kind, SyntaxKind.SpreadAssignment);
22952295
const expr = assignment.expression;
@@ -2314,13 +2314,13 @@ test("VariableDeclarationList const flag clone", async () => {
23142314
const sourceFile = await project.program.getSourceFile("/src/index.ts");
23152315
assert(sourceFile);
23162316
{
2317-
const stmt = sourceFile.statements[0] as import("@typescript/native-preview/ast").VariableStatement;
2317+
const stmt = sourceFile.statements[0] as import("@typescript/native-preview/unstable/ast").VariableStatement;
23182318
const list = stmt.declarationList;
23192319
assert(list.flags & NodeFlags.Const);
23202320
}
23212321
const cloned = getSynthesizedDeepClone(sourceFile);
23222322
{
2323-
const stmt = cloned.statements[0] as import("@typescript/native-preview/ast").VariableStatement;
2323+
const stmt = cloned.statements[0] as import("@typescript/native-preview/unstable/ast").VariableStatement;
23242324
const list = stmt.declarationList;
23252325
assert(list.flags & NodeFlags.Const);
23262326
}

_packages/native-preview/test/async/astnav.test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
1-
import { API } from "@typescript/native-preview/async"; // @sync-skip
1+
import { API } from "@typescript/native-preview/unstable/async"; // @sync-skip
22
// @sync-only-start
3-
// import { API } from "@typescript/native-preview/sync";
3+
// import { API } from "@typescript/native-preview/unstable/sync";
44
// @sync-only-end
55
import {
66
findNextToken,
77
findPrecedingToken,
88
formatSyntaxKind,
99
getTokenAtPosition,
1010
getTouchingPropertyName,
11-
} from "@typescript/native-preview/ast";
11+
} from "@typescript/native-preview/unstable/ast";
1212
import type {
1313
Node,
1414
SourceFile,
15-
} from "@typescript/native-preview/ast";
16-
import { createVirtualFileSystem } from "@typescript/native-preview/fs";
15+
} from "@typescript/native-preview/unstable/ast";
16+
import { createVirtualFileSystem } from "@typescript/native-preview/unstable/fs";
1717
import assert from "node:assert";
1818
import { readFileSync } from "node:fs";
1919
import { resolve } from "node:path";

_packages/native-preview/test/encoder.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import type {
22
Path,
33
SourceFile,
44
Statement,
5-
} from "@typescript/native-preview/ast";
6-
import { SyntaxKind } from "@typescript/native-preview/ast";
5+
} from "@typescript/native-preview/unstable/ast";
6+
import { SyntaxKind } from "@typescript/native-preview/unstable/ast";
77
import {
88
createBlock,
99
createExpressionStatement,
@@ -21,7 +21,7 @@ import {
2121
createVariableDeclaration,
2222
createVariableDeclarationList,
2323
createVariableStatement,
24-
} from "@typescript/native-preview/ast/factory";
24+
} from "@typescript/native-preview/unstable/ast/factory";
2525
import assert from "node:assert";
2626
import {
2727
describe,

_packages/native-preview/test/sync/api.bench.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ import {
1010
type Node,
1111
type SourceFile,
1212
SyntaxKind,
13-
} from "@typescript/native-preview/ast";
13+
} from "@typescript/native-preview/unstable/ast";
1414
import {
1515
API,
1616
type Project,
1717
type Snapshot,
18-
} from "@typescript/native-preview/sync";
18+
} from "@typescript/native-preview/unstable/sync";
1919
import {
2020
existsSync,
2121
writeFileSync,

0 commit comments

Comments
 (0)