@smithy/core 2.0.0 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +35 -2
- package/package.json +19 -6
package/README.md
CHANGED
|
@@ -5,8 +5,41 @@
|
|
|
5
5
|
|
|
6
6
|
> An internal package. You probably shouldn't use this package, at least directly.
|
|
7
7
|
|
|
8
|
-
## Usage
|
|
9
|
-
|
|
10
8
|
This package provides common or core functionality for generic Smithy clients.
|
|
11
9
|
|
|
12
10
|
You do not need to explicitly install this package, since it will be installed during code generation if used.
|
|
11
|
+
|
|
12
|
+
## Development of `@smithy/core` submodules
|
|
13
|
+
|
|
14
|
+
Core submodules are organized for distribution via the `package.json` `exports` field.
|
|
15
|
+
|
|
16
|
+
`exports` is supported by default by the latest Node.js, webpack, and esbuild. For react-native, it can be
|
|
17
|
+
enabled via instructions found at [reactnative.dev/blog](https://reactnative.dev/blog/2023/06/21/package-exports-support), but we also provide a compatibility redirect.
|
|
18
|
+
|
|
19
|
+
Think of `@smithy/core` as a mono-package within the monorepo.
|
|
20
|
+
It preserves the benefits of modularization, for example to optimize Node.js initialization speed,
|
|
21
|
+
while making it easier to have a consistent version of core dependencies, reducing package sprawl when
|
|
22
|
+
installing a Smithy runtime client.
|
|
23
|
+
|
|
24
|
+
### Guide for submodules
|
|
25
|
+
|
|
26
|
+
- Each `index.ts` file corresponding to the pattern `./src/submodules/<MODULE_NAME>/index.ts` will be
|
|
27
|
+
published as a separate `dist-cjs` bundled submodule index using the `Inliner.js` build script.
|
|
28
|
+
- create a folder as `./src/submodules/<SUBMODULE>` including an `index.ts` file and a `README.md` file.
|
|
29
|
+
- The linter will throw an error on missing submodule metadata in `package.json` and the various `tsconfig.json` files, but it will automatically fix them if possible.
|
|
30
|
+
- a submodule is equivalent to a standalone `@smithy/<pkg>` package in that importing it in Node.js will resolve a separate bundle.
|
|
31
|
+
- submodules may not relatively import files from other submodules. Instead, directly use the `@scope/pkg/submodule` name as the import.
|
|
32
|
+
- The linter will check for this and throw an error.
|
|
33
|
+
- To the extent possible, correctly declaring submodule metadata is validated by the linter in `@smithy/core`.
|
|
34
|
+
The linter runs during `yarn build` and also as `yarn lint`.
|
|
35
|
+
|
|
36
|
+
### When should I create an `@smithy/core/submodule` vs. `@smithy/new-package`?
|
|
37
|
+
|
|
38
|
+
Keep in mind that the core package is installed by all downstream clients.
|
|
39
|
+
|
|
40
|
+
If the component functionality is upstream of multiple clients, it is
|
|
41
|
+
a good candidate for a core submodule. For example, if `middleware-retry` had been written
|
|
42
|
+
after the support for submodules was added, it would have been a submodule.
|
|
43
|
+
|
|
44
|
+
If the component's functionality is downstream of a client (rare), or only expected to be used by a very small
|
|
45
|
+
subset of clients, it could be written as a standalone package.
|
package/package.json
CHANGED
|
@@ -1,21 +1,34 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@smithy/core",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"scripts": {
|
|
5
|
-
"build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types && yarn build:types:downlevel'",
|
|
5
|
+
"build": "yarn lint && concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types && yarn build:types:downlevel'",
|
|
6
6
|
"build:cjs": "node ../../scripts/inline core",
|
|
7
7
|
"build:es": "yarn g:tsc -p tsconfig.es.json",
|
|
8
8
|
"build:types": "yarn g:tsc -p tsconfig.types.json",
|
|
9
9
|
"build:types:downlevel": "downlevel-dts dist-types dist-types/ts3.4",
|
|
10
10
|
"stage-release": "rimraf ./.release && yarn pack && mkdir ./.release && tar zxvf ./package.tgz --directory ./.release && rm ./package.tgz",
|
|
11
11
|
"clean": "rimraf ./dist-* && rimraf *.tsbuildinfo || exit 0",
|
|
12
|
-
"lint": "eslint -c ../../.eslintrc.js \"src/**/*.ts\"",
|
|
12
|
+
"lint": "npx eslint -c ../../.eslintrc.js \"src/**/*.ts\" && node ./scripts/lint",
|
|
13
13
|
"format": "prettier --config ../../prettier.config.js --ignore-path ../.prettierignore --write \"**/*.{ts,md,json}\"",
|
|
14
14
|
"test": "yarn g:jest"
|
|
15
15
|
},
|
|
16
16
|
"main": "./dist-cjs/index.js",
|
|
17
17
|
"module": "./dist-es/index.js",
|
|
18
18
|
"types": "./dist-types/index.d.ts",
|
|
19
|
+
"exports": {
|
|
20
|
+
".": {
|
|
21
|
+
"node": "./dist-cjs/index.js",
|
|
22
|
+
"import": "./dist-es/index.js",
|
|
23
|
+
"require": "./dist-cjs/index.js",
|
|
24
|
+
"types": "./dist-types/index.d.ts"
|
|
25
|
+
},
|
|
26
|
+
"./package.json": {
|
|
27
|
+
"node": "./package.json",
|
|
28
|
+
"import": "./package.json",
|
|
29
|
+
"require": "./package.json"
|
|
30
|
+
}
|
|
31
|
+
},
|
|
19
32
|
"author": {
|
|
20
33
|
"name": "AWS Smithy Team",
|
|
21
34
|
"email": "",
|
|
@@ -23,11 +36,11 @@
|
|
|
23
36
|
},
|
|
24
37
|
"license": "Apache-2.0",
|
|
25
38
|
"dependencies": {
|
|
26
|
-
"@smithy/middleware-endpoint": "^3.0.
|
|
27
|
-
"@smithy/middleware-retry": "^3.0.
|
|
39
|
+
"@smithy/middleware-endpoint": "^3.0.1",
|
|
40
|
+
"@smithy/middleware-retry": "^3.0.2",
|
|
28
41
|
"@smithy/middleware-serde": "^3.0.0",
|
|
29
42
|
"@smithy/protocol-http": "^4.0.0",
|
|
30
|
-
"@smithy/smithy-client": "^3.
|
|
43
|
+
"@smithy/smithy-client": "^3.1.0",
|
|
31
44
|
"@smithy/types": "^3.0.0",
|
|
32
45
|
"@smithy/util-middleware": "^3.0.0",
|
|
33
46
|
"tslib": "^2.6.2"
|