Skip to content

Commit 7fd6ac0

Browse files
authored
chore(scripts): enforce 1-1 symbol presence for node/browser/native exports (#2010)
1 parent 7ec62a0 commit 7fd6ac0

11 files changed

Lines changed: 263 additions & 50 deletions

File tree

.changeset/wild-papayas-rest.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@smithy/core": patch
3+
---
4+
5+
export surface equality for core, Node.js/browser/react-native

api-snapshot/api.json

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,9 @@
8787
"@smithy/core/checksum": {
8888
"blobHasher": "function",
8989
"blobReader": "function",
90-
"fileStreamHasher": "function",
90+
"fileStreamHasher": "function(node-only)",
9191
"Md5": "function",
92-
"readableStreamHasher": "function"
92+
"readableStreamHasher": "function(node-only)"
9393
},
9494
"@smithy/core/client": {
9595
"_json": "function",
@@ -165,9 +165,9 @@
165165
"@smithy/core/config": {
166166
"booleanSelector": "function",
167167
"chain": "function",
168-
"CONFIG_PREFIX_SEPARATOR": "string",
169-
"CONFIG_USE_DUALSTACK_ENDPOINT": "string",
170-
"CONFIG_USE_FIPS_ENDPOINT": "string",
168+
"CONFIG_PREFIX_SEPARATOR": "string(node-only)",
169+
"CONFIG_USE_DUALSTACK_ENDPOINT": "string(node-only)",
170+
"CONFIG_USE_FIPS_ENDPOINT": "string(node-only)",
171171
"CredentialsProviderError": "function",
172172
"CustomEndpointsInputConfig": "type(interface)",
173173
"CustomEndpointsResolvedConfig": "type(interface)",
@@ -178,45 +178,45 @@
178178
"EndpointsResolvedConfig": "type(interface)",
179179
"EndpointVariant": "type(object)",
180180
"EndpointVariantTag": "type(union)",
181-
"ENV_PROFILE": "string",
182-
"ENV_USE_DUALSTACK_ENDPOINT": "string",
183-
"ENV_USE_FIPS_ENDPOINT": "string",
181+
"ENV_PROFILE": "string(node-only)",
182+
"ENV_USE_DUALSTACK_ENDPOINT": "string(node-only)",
183+
"ENV_USE_FIPS_ENDPOINT": "string(node-only)",
184184
"EnvOptions": "type(interface)",
185-
"externalDataInterceptor": "object",
186-
"fromStatic": "function",
185+
"externalDataInterceptor": "object(node-only)",
186+
"fromStatic": "function(node-only)",
187187
"fromValue": "function",
188-
"getHomeDir": "function",
189-
"getProfileName": "function",
188+
"getHomeDir": "function(node-only)",
189+
"getProfileName": "function(node-only)",
190190
"getRegionInfo": "function",
191191
"GetRegionInfoOptions": "type(interface)",
192-
"getSSOTokenFilepath": "function",
193-
"getSSOTokenFromFile": "function",
192+
"getSSOTokenFilepath": "function(node-only)",
193+
"getSSOTokenFromFile": "function(node-only)",
194194
"GetterFromConfig": "type(object)",
195195
"GetterFromEnv": "type(object)",
196-
"loadConfig": "function",
196+
"loadConfig": "function(node-only)",
197197
"LoadedConfigSelectors": "type(interface)",
198-
"loadSharedConfigFiles": "function",
199-
"loadSsoSessionData": "function",
198+
"loadSharedConfigFiles": "function(node-only)",
199+
"loadSsoSessionData": "function(node-only)",
200200
"LocalConfigOptions": "type(intersection)",
201201
"memoize": "function",
202-
"NODE_REGION_CONFIG_FILE_OPTIONS": "object",
203-
"NODE_REGION_CONFIG_OPTIONS": "object",
204-
"NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS": "object",
205-
"NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS": "object",
206-
"nodeDualstackConfigSelectors": "object",
207-
"nodeFipsConfigSelectors": "object",
202+
"NODE_REGION_CONFIG_FILE_OPTIONS": "object(node-only)",
203+
"NODE_REGION_CONFIG_OPTIONS": "object(node-only)",
204+
"NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS": "object(node-only)",
205+
"NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS": "object(node-only)",
206+
"nodeDualstackConfigSelectors": "object(node-only)",
207+
"nodeFipsConfigSelectors": "object(node-only)",
208208
"NodeSharedConfigInit": "type(interface)",
209209
"numberSelector": "function",
210210
"ParsedIniData": "type(object)",
211-
"parseKnownFiles": "function",
211+
"parseKnownFiles": "function(node-only)",
212212
"PartitionHash": "type(object)",
213213
"Profile": "type(object)",
214214
"ProviderError": "function",
215215
"ProviderErrorOptionsType": "type(object)",
216-
"readFile": "function",
216+
"readFile": "function(node-only)",
217217
"ReadFileOptions": "type(interface)",
218-
"REGION_ENV_NAME": "string",
219-
"REGION_INI_NAME": "string",
218+
"REGION_ENV_NAME": "string(node-only)",
219+
"REGION_INI_NAME": "string(node-only)",
220220
"RegionHash": "type(object)",
221221
"RegionInputConfig": "type(interface)",
222222
"RegionResolvedConfig": "type(interface)",
@@ -370,8 +370,8 @@
370370
"@smithy/core/retry": {
371371
"AdaptiveRetryStrategy": "function",
372372
"AdaptiveRetryStrategyOptions": "type(interface)",
373-
"CONFIG_MAX_ATTEMPTS": "string",
374-
"CONFIG_RETRY_MODE": "string",
373+
"CONFIG_MAX_ATTEMPTS": "string(node-only)",
374+
"CONFIG_RETRY_MODE": "string(node-only)",
375375
"ConfiguredRetryStrategy": "function",
376376
"DEFAULT_MAX_ATTEMPTS": "number",
377377
"DEFAULT_RETRY_DELAY_BASE": "number",
@@ -384,8 +384,8 @@
384384
"DeprecatedAdaptiveRetryStrategyOptions": "type(interface)",
385385
"DeprecatedStandardRetryStrategy": "function",
386386
"DeprecatedStandardRetryStrategyOptions": "type(interface)",
387-
"ENV_MAX_ATTEMPTS": "string",
388-
"ENV_RETRY_MODE": "string",
387+
"ENV_MAX_ATTEMPTS": "string(node-only)",
388+
"ENV_RETRY_MODE": "string(node-only)",
389389
"getOmitRetryHeadersPlugin": "function",
390390
"getRetryAfterHint": "function",
391391
"getRetryPlugin": "function",
@@ -401,8 +401,8 @@
401401
"isTransientError": "function",
402402
"MAXIMUM_RETRY_DELAY": "number",
403403
"NO_RETRY_INCREMENT": "number",
404-
"NODE_MAX_ATTEMPT_CONFIG_OPTIONS": "object",
405-
"NODE_RETRY_MODE_CONFIG_OPTIONS": "object",
404+
"NODE_MAX_ATTEMPT_CONFIG_OPTIONS": "object(node-only)",
405+
"NODE_RETRY_MODE_CONFIG_OPTIONS": "object(node-only)",
406406
"omitRetryHeadersMiddleware": "function",
407407
"omitRetryHeadersMiddlewareOptions": "object",
408408
"PreviouslyResolved": "type(interface)",
@@ -485,7 +485,7 @@
485485
"getAwsChunkedEncodingStream": "function",
486486
"getSerdePlugin": "function",
487487
"handleFloat": "function",
488-
"Hash": "function",
488+
"Hash": "function(node-only)",
489489
"headStream": "function",
490490
"isArrayBuffer": "function",
491491
"isBlob": "function",

packages/core/src/submodules/checksum/index.browser.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
1+
const no = Symbol.for("node-only");
2+
13
// @smithy/hash-blob-browser
24
export { blobHasher } from "./hash-blob-browser/blobHasher";
35

6+
// @smithy/hash-stream-node
7+
export const fileStreamHasher = no;
8+
export const readableStreamHasher = no;
9+
410
// @smithy/md5-js
511
export { Md5 } from "./md5-js/md5";
612

packages/core/src/submodules/checksum/index.native.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
1+
const no = Symbol.for("node-only");
2+
13
// @smithy/hash-blob-browser
24
export { blobHasher } from "./hash-blob-browser/blobHasher";
35

6+
// @smithy/hash-stream-node
7+
export const fileStreamHasher = no;
8+
export const readableStreamHasher = no;
9+
410
// @smithy/md5-js
511
export { Md5 } from "./md5-js/md5";
612

packages/core/src/submodules/config/index.browser.ts

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
const no = Symbol.for("node-only");
2+
13
// @smithy/property-provider
24
export { ProviderError, type ProviderErrorOptionsType } from "./property-provider/ProviderError";
35
export { CredentialsProviderError } from "./property-provider/CredentialsProviderError";
@@ -11,7 +13,44 @@ export { booleanSelector } from "./util-config-provider/booleanSelector";
1113
export { numberSelector } from "./util-config-provider/numberSelector";
1214
export { SelectorType } from "./util-config-provider/types";
1315

16+
// @smithy/shared-ini-file-loader
17+
export const getHomeDir = no;
18+
export const ENV_PROFILE = no;
19+
export const DEFAULT_PROFILE = "default";
20+
export const getProfileName = no;
21+
export const getSSOTokenFilepath = no;
22+
export const getSSOTokenFromFile = no;
23+
export const CONFIG_PREFIX_SEPARATOR = no;
24+
export const loadSharedConfigFiles = no;
25+
export const loadSsoSessionData = no;
26+
export const parseKnownFiles = no;
27+
export const externalDataInterceptor = no;
28+
export const readFile = no;
29+
export type { SSOToken } from "./shared-ini-file-loader/getSSOTokenFromFile";
30+
export type { SharedConfigInit } from "./shared-ini-file-loader/loadSharedConfigFiles";
31+
export type { SsoSessionInit } from "./shared-ini-file-loader/loadSsoSessionData";
32+
export type { SourceProfileInit } from "./shared-ini-file-loader/parseKnownFiles";
33+
export type { Profile, ParsedIniData, SharedConfigFiles } from "./shared-ini-file-loader/types";
34+
export type { ReadFileOptions } from "./shared-ini-file-loader/readFile";
35+
36+
// @smithy/node-config-provider
37+
export const loadConfig = no;
38+
export const fromStatic = no;
39+
export type { LocalConfigOptions, LoadedConfigSelectors } from "./node-config-provider/configLoader";
40+
export type { EnvOptions, GetterFromEnv } from "./node-config-provider/fromEnv";
41+
export type { NodeSharedConfigInit, GetterFromConfig } from "./node-config-provider/fromSharedConfigFiles";
42+
1443
// @smithy/config-resolver
44+
export const ENV_USE_DUALSTACK_ENDPOINT = no;
45+
export const CONFIG_USE_DUALSTACK_ENDPOINT = no;
46+
export const DEFAULT_USE_DUALSTACK_ENDPOINT = false;
47+
export const NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS = no;
48+
export const nodeDualstackConfigSelectors = no;
49+
export const ENV_USE_FIPS_ENDPOINT = no;
50+
export const CONFIG_USE_FIPS_ENDPOINT = no;
51+
export const DEFAULT_USE_FIPS_ENDPOINT = false;
52+
export const NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS = no;
53+
export const nodeFipsConfigSelectors = no;
1554
export {
1655
resolveCustomEndpointsConfig,
1756
type CustomEndpointsInputConfig,
@@ -24,6 +63,10 @@ export {
2463
} from "./config-resolver/endpointsConfig/resolveEndpointsConfig";
2564

2665
// @smithy/config-resolver
66+
export const REGION_ENV_NAME = no;
67+
export const REGION_INI_NAME = no;
68+
export const NODE_REGION_CONFIG_OPTIONS = no;
69+
export const NODE_REGION_CONFIG_FILE_OPTIONS = no;
2770
export {
2871
resolveRegionConfig,
2972
type RegionInputConfig,

packages/core/src/submodules/config/index.native.ts

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
const no = Symbol.for("node-only");
2+
13
// @smithy/property-provider
24
export { ProviderError, type ProviderErrorOptionsType } from "./property-provider/ProviderError";
35
export { CredentialsProviderError } from "./property-provider/CredentialsProviderError";
@@ -11,7 +13,44 @@ export { booleanSelector } from "./util-config-provider/booleanSelector";
1113
export { numberSelector } from "./util-config-provider/numberSelector";
1214
export { SelectorType } from "./util-config-provider/types";
1315

16+
// @smithy/shared-ini-file-loader
17+
export const getHomeDir = no;
18+
export const ENV_PROFILE = no;
19+
export const DEFAULT_PROFILE = "default";
20+
export const getProfileName = no;
21+
export const getSSOTokenFilepath = no;
22+
export const getSSOTokenFromFile = no;
23+
export const CONFIG_PREFIX_SEPARATOR = no;
24+
export const loadSharedConfigFiles = no;
25+
export const loadSsoSessionData = no;
26+
export const parseKnownFiles = no;
27+
export const externalDataInterceptor = no;
28+
export const readFile = no;
29+
export type { SSOToken } from "./shared-ini-file-loader/getSSOTokenFromFile";
30+
export type { SharedConfigInit } from "./shared-ini-file-loader/loadSharedConfigFiles";
31+
export type { SsoSessionInit } from "./shared-ini-file-loader/loadSsoSessionData";
32+
export type { SourceProfileInit } from "./shared-ini-file-loader/parseKnownFiles";
33+
export type { Profile, ParsedIniData, SharedConfigFiles } from "./shared-ini-file-loader/types";
34+
export type { ReadFileOptions } from "./shared-ini-file-loader/readFile";
35+
36+
// @smithy/node-config-provider
37+
export const loadConfig = no;
38+
export const fromStatic = no;
39+
export type { LocalConfigOptions, LoadedConfigSelectors } from "./node-config-provider/configLoader";
40+
export type { EnvOptions, GetterFromEnv } from "./node-config-provider/fromEnv";
41+
export type { NodeSharedConfigInit, GetterFromConfig } from "./node-config-provider/fromSharedConfigFiles";
42+
1443
// @smithy/config-resolver
44+
export const ENV_USE_DUALSTACK_ENDPOINT = no;
45+
export const CONFIG_USE_DUALSTACK_ENDPOINT = no;
46+
export const DEFAULT_USE_DUALSTACK_ENDPOINT = false;
47+
export const NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS = no;
48+
export const nodeDualstackConfigSelectors = no;
49+
export const ENV_USE_FIPS_ENDPOINT = no;
50+
export const CONFIG_USE_FIPS_ENDPOINT = no;
51+
export const DEFAULT_USE_FIPS_ENDPOINT = false;
52+
export const NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS = no;
53+
export const nodeFipsConfigSelectors = no;
1554
export {
1655
resolveCustomEndpointsConfig,
1756
type CustomEndpointsInputConfig,
@@ -24,6 +63,10 @@ export {
2463
} from "./config-resolver/endpointsConfig/resolveEndpointsConfig";
2564

2665
// @smithy/config-resolver
66+
export const REGION_ENV_NAME = no;
67+
export const REGION_INI_NAME = no;
68+
export const NODE_REGION_CONFIG_OPTIONS = no;
69+
export const NODE_REGION_CONFIG_FILE_OPTIONS = no;
2770
export {
2871
resolveRegionConfig,
2972
type RegionInputConfig,

packages/core/src/submodules/retry/index.browser.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
const no = Symbol.for("node-only");
2+
13
// @smithy/service-error-classification
24
export {
35
isRetryableByTrait,
@@ -41,15 +43,13 @@ export {
4143
} from "./middleware-retry/retry-pre-sra-deprecated/StandardRetryStrategy";
4244
export { defaultDelayDecider } from "./middleware-retry/retry-pre-sra-deprecated/delayDecider";
4345
export { defaultRetryDecider } from "./middleware-retry/retry-pre-sra-deprecated/retryDecider";
44-
export {
45-
ENV_MAX_ATTEMPTS,
46-
CONFIG_MAX_ATTEMPTS,
47-
NODE_MAX_ATTEMPT_CONFIG_OPTIONS,
48-
ENV_RETRY_MODE,
49-
CONFIG_RETRY_MODE,
50-
NODE_RETRY_MODE_CONFIG_OPTIONS,
51-
resolveRetryConfig,
52-
} from "./middleware-retry/configurations";
46+
export const ENV_MAX_ATTEMPTS = no;
47+
export const CONFIG_MAX_ATTEMPTS = no;
48+
export const NODE_MAX_ATTEMPT_CONFIG_OPTIONS = no;
49+
export const ENV_RETRY_MODE = no;
50+
export const CONFIG_RETRY_MODE = no;
51+
export const NODE_RETRY_MODE_CONFIG_OPTIONS = no;
52+
export { resolveRetryConfig } from "./middleware-retry/configurations";
5353
export type { RetryInputConfig, RetryResolvedConfig, PreviouslyResolved } from "./middleware-retry/configurations";
5454
export {
5555
omitRetryHeadersMiddleware,

packages/core/src/submodules/serde/index.browser.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
const no = Symbol.for("node-only");
2+
13
export { copyDocumentWithTransform } from "./copyDocumentWithTransform";
24
export {
35
dateToUtcString,
@@ -77,6 +79,9 @@ export {
7779
} from "./middleware-serde/serdePlugin";
7880
export { serializerMiddleware } from "./middleware-serde/serializerMiddleware";
7981

82+
// @smithy/hash-node
83+
export const Hash = no;
84+
8085
// @smithy/util-stream
8186
export { Uint8ArrayBlobAdapter } from "./util-stream/blob/Uint8ArrayBlobAdapter";
8287
export { ChecksumStream, type ChecksumStreamInit } from "./util-stream/checksum/ChecksumStream.browser";

packages/core/src/submodules/serde/index.native.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
const no = Symbol.for("node-only");
2+
13
export { copyDocumentWithTransform } from "./copyDocumentWithTransform";
24
export {
35
dateToUtcString,
@@ -77,6 +79,9 @@ export {
7779
} from "./middleware-serde/serdePlugin";
7880
export { serializerMiddleware } from "./middleware-serde/serializerMiddleware";
7981

82+
// @smithy/hash-node
83+
export const Hash = no;
84+
8085
// @smithy/util-stream
8186
export { Uint8ArrayBlobAdapter } from "./util-stream/blob/Uint8ArrayBlobAdapter";
8287
export { ChecksumStream, type ChecksumStreamInit } from "./util-stream/checksum/ChecksumStream.browser";

0 commit comments

Comments
 (0)