Skip to content

Commit 5957a1d

Browse files
committed
remove #platform import codes
1 parent 7458858 commit 5957a1d

4 files changed

Lines changed: 1 addition & 31 deletions

File tree

packages/typespec-ts/src/framework/hooks/binder.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,6 @@ export interface DeclarationInfo {
2222
export interface BinderOptions {
2323
staticHelpers?: Map<string, StaticHelperMetadata>;
2424
dependencies?: Record<string, ReferenceableSymbol>;
25-
/** When true, use #platform/ subpath imports for static helpers with platform variants.
26-
* Should be true for warp packages; false for tshy packages. */
27-
useSubpathImports?: boolean;
2825
}
2926

3027
export interface Binder {

packages/typespec-ts/src/index.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -502,8 +502,7 @@ export async function $onEmit(context: EmitContext) {
502502
}),
503503
};
504504

505-
// Always update package.json (adds #platform/* imports) along with
506-
// exports, clientContextPaths and LRO deps.
505+
// Always update package.json exports, clientContextPaths and LRO deps.
507506
{
508507
// Read package.json content via host and pass parsed object
509508
const pkgSourceFile = await host.readFile(existingPackageFilePath);

packages/typespec-ts/src/metadata/build-package-file.ts

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -99,30 +99,6 @@ export function updatePackageFile(
9999
needsCoreClientUpdate = true;
100100
}
101101

102-
// Ensure warp packages have #platform/* imports for polyfill resolution.
103-
// The `react-native` condition is only added when explicitly opted in via
104-
// `generateReactNativeTarget`, matching the fresh-generation path in
105-
// `getEsmEntrypointInformation` (packageCommon.ts).
106-
const platformImports: Record<string, string> = {
107-
browser: "./src/*-browser.mts",
108-
default: "./src/*.ts",
109-
};
110-
if (model.options?.generateReactNativeTarget) {
111-
// Insert `react-native` before `default` so Node's conditional
112-
// resolution order matches the fresh-generation output.
113-
packageInfo.imports = {
114-
"#platform/*": {
115-
browser: platformImports["browser"],
116-
"react-native": "./src/*-react-native.mts",
117-
default: platformImports["default"],
118-
},
119-
};
120-
} else {
121-
packageInfo.imports = {
122-
"#platform/*": platformImports,
123-
};
124-
}
125-
126102
// Update exports (warp: resolved exports in package.json)
127103
if (needsExportsUpdate) {
128104
packageInfo.exports = resolveWarpExports(exports, model.options?.generateReactNativeTarget);

packages/typespec-ts/src/metadata/build-warp-config.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,6 @@ targets:
6161
* Builds a self-contained warp.config.yml file.
6262
*
6363
* Emits a full inline config with all exports and targets.
64-
* Polyfill resolution (browser/react-native file substitution) is handled
65-
* via package.json `imports` subpath imports (#platform/*).
6664
*
6765
* By default, react-native target is NOT included. Set `generateReactNativeTarget: true`
6866
* in options to include it.

0 commit comments

Comments
 (0)