@sanity/pkg-utils 1.3.0 → 1.3.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sanity/pkg-utils",
3
- "version": "1.3.0",
3
+ "version": "1.3.1",
4
4
  "author": "Sanity.io <hello@sanity.io>",
5
5
  "license": "MIT",
6
6
  "description": "Simple utilities for modern npm packages.",
@@ -49,6 +49,17 @@ export async function build(options: {
49
49
  const srcPath = path.resolve(cwd, config?.src || 'src')
50
50
  const distPath = path.resolve(cwd, config?.dist || 'dist')
51
51
 
52
+ const nodeTarget = _parseNodeTarget(targetVersions)
53
+ const webTarget = _parseWebTarget(targetVersions)
54
+
55
+ if (!nodeTarget) {
56
+ throw new Error('no matching `node` target')
57
+ }
58
+
59
+ if (!webTarget) {
60
+ throw new Error('no matching `web` target')
61
+ }
62
+
52
63
  const context: _BuildContext = {
53
64
  config,
54
65
  cwd,
@@ -59,10 +70,7 @@ export async function build(options: {
59
70
  dist: path.relative(cwd, distPath),
60
71
  pkg,
61
72
  src: path.relative(cwd, srcPath),
62
- target: {
63
- node: _parseNodeTarget(targetVersions) || _DEFAULTS.target.node,
64
- web: _parseWebTarget(targetVersions) || _DEFAULTS.target.web,
65
- },
73
+ target: {node: nodeTarget, web: webTarget},
66
74
  tsconfig,
67
75
  }
68
76