smartbundle 0.13.1 → 0.14.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/README.md CHANGED
@@ -1,92 +1,129 @@
1
1
  # SmartBundle
2
- SmartBundle is a zero-config bundler tailored for library authors and package maintainers looking for simplicity and broad compatibility without the need for complex setup.
3
2
 
4
- ## Features
5
- `SmartBundle` aims to make the build process seamless and distraction-free. Key features include:
6
- - Configuration-free setup via `package.json`
7
- - Compatibility with popular bundlers and runtimes
8
- - Support for ESM and CJS compatibility
9
- - TypeScript typings generation
10
- - Harmless bin scripts
11
- - Source maps generation for easier debugging
12
-
13
- We've also optimized several aspects to ensure the resulting package is as smooth to use as possible.
14
-
15
- ## How to use
16
- 1) Create a `package.json` file like the following:
3
+ <div align="center">
4
+ <h3>The Library Bundler That Respects Your Time</h3>
5
+
6
+ <p>
7
+ <a href="#getting-started">Getting Started</a>
8
+ <a href="#features">Features</a>
9
+ <a href="#compatibility">Compatibility</a>
10
+ <a href="#tool-integration">Tool Integration</a>
11
+ <a href="#advanced-usage">Advanced Usage</a> •
12
+ <a href="#faq">FAQ</a>
13
+ </p>
14
+ </div>
15
+
16
+ Build your library for any JavaScript environment without the complexity
17
+
18
+ ## Getting Started
19
+
20
+ SmartBundle makes it easy to bundle your library for any JavaScript environment. Just create a minimal package.json (see below), install SmartBundle, and run the build command.
21
+
17
22
  ```json5
18
23
  {
19
- "name": "my-package",
20
- "version": "1.0.0",
21
- "private": true, // prevents accidental publishing
22
- "type": "module",
23
- "exports": "./src/index.ts" // entrypoint for building the package
24
+ // Your package name
25
+ "name": "my-package",
26
+ // Package version
27
+ "version": "1.0.0",
28
+ // Must be true to avoid accidental publishing
29
+ "private": true,
30
+ // SmartBundle supports only ES modules
31
+ "type": "module",
32
+ // Entry point used by SmartBundle
33
+ "exports": "./src/index.js",
34
+ "scripts": {
35
+ // Run this to build your package
36
+ "build": "smartbundle"
37
+ }
24
38
  }
25
39
  ```
26
- 2) Run
40
+
41
+ Need more details? See our [package.json guide](./docs/package-json.md) for a full explanation of each field. If you plan to use TypeScript, check out our [TS guide](./docs/ts-guide.md) for tailored advice.
42
+
43
+ To build your package:
44
+
45
+ 1) Create the package.json as shown above
46
+ 2) Install SmartBundle:
47
+ ```bash
48
+ npm install --save-dev smartbundle@latest
49
+ ```
50
+ 3) Build your package:
27
51
  ```bash
28
- npx smartbundle@latest
52
+ npm run build
29
53
  ```
30
- The built files will appear in the `./dist` folder, including an auto-generated `package.json` file.
31
-
32
- 3) Navigate to the `./dist` folder and publish your package to the npm registry.
33
-
34
- ## Supported targets
35
- | Target | Supported | Covered by e2e tests |
36
- |--------------------------------|-----------|----------------------|
37
- | Bun ^1.0.0 | ✔ | ✔ |
38
- | Node ^18.0.0 | ✔ | ✔ |
39
- | Node ^20.0.0 | ✔ | ✔ |
40
- | Node ^22.0.0 | ✔ | ✔ |
41
- | Node ^23.0.0 | ✔ | ✔ |
42
- | Webpack ^4.47.0 | ✔ | ✔ |
43
- | Webpack ^5.95.0 | ✔ | ✔ |
44
- | Rspack ^1.0.0 | ✔ | ✔ |
45
- | Vite ^5.0.0 | ✔ | not yet |
46
- | Rollup ^4.0.0 | ✔ | not yet |
47
- | Deno ^2.0.0 | | not yet |
48
- | Parcel ^2.0.0 | ✔ | not yet |
49
- | Browserify ^17.0.0 | ✔ | not yet |
50
- | Esbuild ^0.24.0 | ✔ | not yet |
51
- | Metro ^0.81.0 | ✔ | ✔ |
52
- | Next.js/Turbopack ^13.0.0 | ✔ | not yet |
53
- | TS/ModuleResolution: bundler | ✔ | ✔ |
54
- | TS/ModuleResolution: node10 | ✔ | |
55
- | TS/ModuleResolution: node16es | ✔ | ✔ |
56
- | TS/ModuleResolution: node16cjs | ✔ | ✔ |
54
+ 4) Your built files (including an auto-generated package.json) will be in the ./dist folder
55
+
56
+ ## Features
57
+
58
+ - **Zero Configuration** - Point to your entry file and build
59
+ - **Universal Output** - ESM and CommonJS bundles generated automatically
60
+ - **TypeScript Ready** - Full TypeScript support with type definitions
61
+ - **React Support** - Automatic JSX transformations for modern and legacy modes
62
+ - **Developer Friendly** - Source maps included for better debugging
63
+ - **Broad Compatibility** - Works with Node.js, Webpack, Vite, Rollup, Bun, and more
64
+
65
+
66
+ ## Compatibility
67
+
68
+ Every bundled package is tested in real environments - from Node.js and Bun to Webpack and Metro - to ensure it just works.
69
+
70
+ ### Runtimes
71
+ | Runtime | Version | Supported | E2E Tests |
72
+ |------------|-----------|:---------:|:---------:|
73
+ | Node.js | ^18.0.0 | ✔ | |
74
+ | | ^20.0.0 | ✔ | |
75
+ | | ^22.0.0 | ✔ | ✔ |
76
+ | | ^23.0.0 | ✔ | |
77
+ | Bun | ^1.0.0 | ✔ | ✔ |
78
+ | Deno | ^2.0.0 | ✔ | - |
79
+
80
+ ### Bundlers
81
+ | Bundler | Version | Supported | E2E Tests |
82
+ |-------------------|-----------|:---------:|:---------:|
83
+ | Webpack | ^4.47.0 | ✔ | ✔ |
84
+ | | ^5.95.0 | ✔ | ✔ |
85
+ | Rspack | ^1.0.0 | ✔ | ✔ |
86
+ | Vite | ^5.0.0 | ✔ | - |
87
+ | Rollup | ^4.0.0 | ✔ | - |
88
+ | Parcel | ^2.0.0 | ✔ | - |
89
+ | Browserify | ^17.0.0 | ✔ | - |
90
+ | Esbuild | ^0.24.0 | ✔ | - |
91
+ | Metro | ^0.81.0 | ✔ | ✔ |
92
+ | Next.js/Turbopack| ^13.0.0 | ✔ | - |
93
+
94
+ ### TypeScript Module Resolution
95
+ | Strategy | Supported | E2E Tests |
96
+ |-------------|:---------:|:---------:|
97
+ | bundler | ✔ | ✔ |
98
+ | node10 | ✔ | ✔ |
99
+ | node16es | ✔ | ✔ |
100
+ | node16cjs | ✔ | ✔ |
57
101
 
58
102
  We aim to support as many bundlers and runtimes as possible. If the bundled package doesn't work with your bundler, please let us know.
59
103
 
60
- ## Third party tools support
61
- ### Typescript
62
- Just install `typescript@^5.0.0` as a dev dependency and start creating ts files.
104
+ ## Tool Integration
105
+
106
+ SmartBundle automatically detects and integrates with your tools - just add what you need to your project.
107
+
108
+ ### TypeScript
109
+ Add `typescript@^5.0.0` as a dev dependency and start creating `.ts` files. SmartBundle will handle the rest.
63
110
 
64
111
  ### Babel
65
- Just install `@babel/core@^7.0.0` as a dev dependency and create a Babel configuration file in the project root.
112
+ Add `@babel/core@^7.0.0` as a dev dependency and create a Babel configuration file in your project root. SmartBundle will automatically apply your transformations.
66
113
 
67
114
  ### React
68
- Just install `react`. More information on React integration can be found [here](./docs/react.md).
115
+ Add `react` to your dependencies. SmartBundle automatically detects React and configures JSX transformations. Both modern and legacy modes are supported.
69
116
 
70
- ## `package.json` limitations
71
- To reduce potential errors and ensure smooth package generation, we follow a stricter configuration for `package.json`.
117
+ For detailed React configuration options, see our [React guide](./docs/react.md).
72
118
 
73
- ### Banned fields
74
- #### `files`
75
- SmartBundle calculates the import graph and includes all necessary files, making `files` unnecessary and potentially confusing.
76
- #### `main`, `module`, `browser`, `types`
77
- We rely on the `exports` field for entry points. These fields are redundant and automatically generated in `./dist/package.json`.
119
+ ## Advanced Usage
78
120
 
79
- ### Required fields
80
- #### `private`
81
- Setting `"private": true` avoids accidental publishing of the source package by ensuring it is not mistakenly published to npm.
121
+ SmartBundle enforces certain package.json conventions to ensure reliable builds. For detailed information about:
122
+ - Required and banned fields
123
+ - Configuration limitations
124
+ - Package.json best practices
82
125
 
83
- ### Stricter fields
84
- #### `type`
85
- We currently support only the `module` type for packages, with plans to support `commonjs` in future releases.
86
- #### `exports`
87
- Only ESM/TS entry points are currently supported in exports. While [conditional exports](https://nodejs.org/api/packages.html#conditional-exports) are not yet available, they’re planned for an upcoming release.
88
- #### `bin`
89
- Currently, we support all `bin` [specifications](https://docs.npmjs.com/cli/v10/configuring-npm/package-json#bin) except for `sh` files. Also, we guarantee that the bin files will execute as expected.
126
+ See our [package.json guide](./docs/package-json.md).
90
127
 
91
128
  ## FAQ
92
129
  ### SmartBundle have an issue
@@ -97,3 +134,6 @@ Minification is typically needed only for production. During development, readab
97
134
 
98
135
  ### Why do you require third-party tools for building?
99
136
  We prioritize keeping the `node_modules` size manageable and avoid unnecessary dependencies. If your package does not require TypeScript, for instance, you don’t need to install those specific tools.
137
+
138
+ ### Community and Support
139
+ If you need assistance or wish to contribute, please check out our [discussion forum](https://github.com/your-org/smartbundle/discussions) and [issue tracker](https://github.com/your-org/smartbundle/issues).
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const errors = {
4
- exportsRequired: "The `exports` field is string or Record<string, string>. Please, verify the value. More info: https://nodejs.org/api/packages.html#package-entry-points",
4
+ exportsRequired: "The `exports` or `bin` field is required. Please, verify the value. More info: https://nodejs.org/api/packages.html#package-entry-points",
5
5
  exportsInvalid: "The `exports` field must be a path to entrypoint. Please, verify the value. More info: https://nodejs.org/api/packages.html#package-entry-points",
6
6
  nameRequired: "The `name` field is required string. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#name",
7
7
  nameMinLength: 'Min length of "name" is 1 character. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#name',
@@ -1 +1 @@
1
- {"version":3,"file":"errors.js","sources":["../../../../src/errors.ts"],"sourcesContent":["export const errors = {\n exportsRequired:\n \"The `exports` field is string or Record<string, string>. Please, verify the value. More info: https://nodejs.org/api/packages.html#package-entry-points\",\n exportsInvalid:\n \"The `exports` field must be a path to entrypoint. Please, verify the value. More info: https://nodejs.org/api/packages.html#package-entry-points\",\n nameRequired:\n \"The `name` field is required string. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#name\",\n nameMinLength:\n 'Min length of \"name\" is 1 character. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#name',\n nameMaxLength:\n 'Max length of \"name\" is 214 characters. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#name',\n nameStartsIllegalChars:\n \"Name cannot start with `_` or `.` if it is not a scoped package. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#name\",\n versionRequired:\n \"The `version` field is required string. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#version\",\n privateIsTrue:\n \"The `private` field must be `true` for avoiding accidental publish. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#private\",\n descriptionString:\n \"The `description` field must be a string. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#description\",\n dependenciesInvalid:\n \"The `dependencies` field must be an Object<string, string>. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#dependencies\",\n binFiled:\n \"The `bin` field must be a path or Record<string, FilePath>. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#bin\",\n rollupError:\n \"An error occurred while building the package. Please, report it to the issues on GitHub\",\n typescriptNotFound:\n \"The package.json contains typescript entrypoints, but the typescript package is not found. Please, install typescript@^5.0.0\",\n optionalDependenciesInvalid:\n \"The `optionalDependencies` field must be an Object<string, string>. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#optionaldependencies\",\n repositoryInvalid:\n \"The `repository` field must be an object with 'type' and 'url' properties or a string. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#repository\",\n keywordsInvalid:\n \"The `keywords` field must be an array of strings. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#keywords\",\n authorInvalid:\n \"The `author` field must be an object or a string. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#people-fields-author-contributors\",\n contributorsInvalid:\n \"The `contributors` field must be an array of objects or strings. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#people-fields-author-contributors\",\n licenseInvalid:\n \"The `license` field must be a string specifying the license. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#license\",\n devDependenciesInvalid:\n \"The `devDependencies` field must be an Object<string, string>. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#devdependencies\",\n peerDependenciesInvalid:\n \"The `peerDependencies` field must be an Object<string, string>. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#peerdependencies\",\n enginesInvalid:\n \"The `engines` field must be an object specifying version requirements. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#engines\",\n browserInvalid:\n \"The `browser` field must be a string or an object. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#browser\",\n fundingInvalid:\n \"The `funding` field must be an object or a string. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#funding\",\n osInvalid:\n \"The `os` field must be an array of strings. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#os\",\n cpuInvalid:\n \"The `cpu` field must be an array of strings. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#cpu\",\n};\n"],"names":[],"mappings":";;AAAO,MAAM,SAAS;AAAA,EACpB,iBACE;AAAA,EACF,gBACE;AAAA,EACF,cACE;AAAA,EACF,eACE;AAAA,EACF,eACE;AAAA,EACF,wBACE;AAAA,EACF,iBACE;AAAA,EACF,eACE;AAAA,EACF,mBACE;AAAA,EACF,qBACE;AAAA,EACF,UACE;AAAA,EACF,aACE;AAAA,EACF,oBACE;AAAA,EACF,6BACE;AAAA,EACF,mBACE;AAAA,EACF,iBACE;AAAA,EACF,eACE;AAAA,EACF,qBACE;AAAA,EACF,gBACE;AAAA,EACF,wBACE;AAAA,EACF,yBACE;AAAA,EACF,gBACE;AAAA,EACF,gBACE;AAAA,EACF,gBACE;AAAA,EACF,WACE;AAAA,EACF,YACE;AACJ;;"}
1
+ {"version":3,"file":"errors.js","sources":["../../../../src/errors.ts"],"sourcesContent":["export const errors = {\n exportsRequired:\n \"The `exports` or `bin` field is required. Please, verify the value. More info: https://nodejs.org/api/packages.html#package-entry-points\",\n exportsInvalid:\n \"The `exports` field must be a path to entrypoint. Please, verify the value. More info: https://nodejs.org/api/packages.html#package-entry-points\",\n nameRequired:\n \"The `name` field is required string. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#name\",\n nameMinLength:\n 'Min length of \"name\" is 1 character. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#name',\n nameMaxLength:\n 'Max length of \"name\" is 214 characters. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#name',\n nameStartsIllegalChars:\n \"Name cannot start with `_` or `.` if it is not a scoped package. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#name\",\n versionRequired:\n \"The `version` field is required string. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#version\",\n privateIsTrue:\n \"The `private` field must be `true` for avoiding accidental publish. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#private\",\n descriptionString:\n \"The `description` field must be a string. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#description\",\n dependenciesInvalid:\n \"The `dependencies` field must be an Object<string, string>. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#dependencies\",\n binFiled:\n \"The `bin` field must be a path or Record<string, FilePath>. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#bin\",\n rollupError:\n \"An error occurred while building the package. Please, report it to the issues on GitHub\",\n typescriptNotFound:\n \"The package.json contains typescript entrypoints, but the typescript package is not found. Please, install typescript@^5.0.0\",\n optionalDependenciesInvalid:\n \"The `optionalDependencies` field must be an Object<string, string>. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#optionaldependencies\",\n repositoryInvalid:\n \"The `repository` field must be an object with 'type' and 'url' properties or a string. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#repository\",\n keywordsInvalid:\n \"The `keywords` field must be an array of strings. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#keywords\",\n authorInvalid:\n \"The `author` field must be an object or a string. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#people-fields-author-contributors\",\n contributorsInvalid:\n \"The `contributors` field must be an array of objects or strings. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#people-fields-author-contributors\",\n licenseInvalid:\n \"The `license` field must be a string specifying the license. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#license\",\n devDependenciesInvalid:\n \"The `devDependencies` field must be an Object<string, string>. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#devdependencies\",\n peerDependenciesInvalid:\n \"The `peerDependencies` field must be an Object<string, string>. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#peerdependencies\",\n enginesInvalid:\n \"The `engines` field must be an object specifying version requirements. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#engines\",\n browserInvalid:\n \"The `browser` field must be a string or an object. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#browser\",\n fundingInvalid:\n \"The `funding` field must be an object or a string. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#funding\",\n osInvalid:\n \"The `os` field must be an array of strings. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#os\",\n cpuInvalid:\n \"The `cpu` field must be an array of strings. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#cpu\",\n};\n"],"names":[],"mappings":";;AAAO,MAAM,SAAS;AAAA,EACpB,iBACE;AAAA,EACF,gBACE;AAAA,EACF,cACE;AAAA,EACF,eACE;AAAA,EACF,eACE;AAAA,EACF,wBACE;AAAA,EACF,iBACE;AAAA,EACF,eACE;AAAA,EACF,mBACE;AAAA,EACF,qBACE;AAAA,EACF,UACE;AAAA,EACF,aACE;AAAA,EACF,oBACE;AAAA,EACF,6BACE;AAAA,EACF,mBACE;AAAA,EACF,iBACE;AAAA,EACF,eACE;AAAA,EACF,qBACE;AAAA,EACF,gBACE;AAAA,EACF,wBACE;AAAA,EACF,yBACE;AAAA,EACF,gBACE;AAAA,EACF,gBACE;AAAA,EACF,gBACE;AAAA,EACF,WACE;AAAA,EACF,YACE;AACJ;;"}
@@ -1,5 +1,5 @@
1
1
  import z from "zod";
2
- declare function createPackageJsonSchema(sourceDir: string): z.ZodObject<{
2
+ declare function createPackageJsonSchema(sourceDir: string): z.ZodEffects<z.ZodObject<{
3
3
  exports: z.ZodOptional<z.ZodEffects<z.ZodUnion<[
4
4
  z.ZodEffects<z.ZodString, Map<string, string>, string>,
5
5
  z.ZodEffects<z.ZodRecord<z.ZodString, z.ZodString>, Map<string, string>, Record<string, string>>
@@ -98,6 +98,62 @@ declare function createPackageJsonSchema(sourceDir: string): z.ZodObject<{
98
98
  homepage?: any;
99
99
  babel?: any;
100
100
  peerDependenciesMeta?: any;
101
+ }>, {
102
+ exports?: Map<string, string>;
103
+ name?: string;
104
+ version?: string;
105
+ private?: boolean;
106
+ description?: string;
107
+ dependencies?: Record<string, string>;
108
+ optionalDependencies?: Record<string, string>;
109
+ bin?: Map<string, string>;
110
+ repository?: any;
111
+ keywords?: string[];
112
+ author?: any;
113
+ contributors?: (string | {})[];
114
+ license?: any;
115
+ devDependencies?: Record<string, string>;
116
+ peerDependencies?: Record<string, string>;
117
+ engines?: Record<string, string>;
118
+ browser?: string | Record<string, string>;
119
+ funding?: string | {};
120
+ os?: string[];
121
+ cpu?: string[];
122
+ maintainers?: any;
123
+ bugs?: any;
124
+ sideEffects?: any;
125
+ unpkg?: any;
126
+ homepage?: any;
127
+ babel?: any;
128
+ peerDependenciesMeta?: any;
129
+ }, {
130
+ exports?: string | Record<string, string>;
131
+ name?: string;
132
+ version?: string;
133
+ private?: boolean;
134
+ description?: string;
135
+ dependencies?: Record<string, string>;
136
+ optionalDependencies?: Record<string, string>;
137
+ bin?: string | Record<string, string>;
138
+ repository?: any;
139
+ keywords?: string[];
140
+ author?: any;
141
+ contributors?: (string | {})[];
142
+ license?: any;
143
+ devDependencies?: Record<string, string>;
144
+ peerDependencies?: Record<string, string>;
145
+ engines?: Record<string, string>;
146
+ browser?: string | Record<string, string>;
147
+ funding?: string | {};
148
+ os?: string[];
149
+ cpu?: string[];
150
+ maintainers?: any;
151
+ bugs?: any;
152
+ sideEffects?: any;
153
+ unpkg?: any;
154
+ homepage?: any;
155
+ babel?: any;
156
+ peerDependenciesMeta?: any;
101
157
  }>;
102
158
  type PackageJsonSchema = ReturnType<typeof createPackageJsonSchema>;
103
159
  export type PackageJson = z.infer<PackageJsonSchema>;
@@ -50,7 +50,7 @@ function fillPackageJson(packageJson) {
50
50
  }
51
51
  function createPackageJsonSchema(sourceDir) {
52
52
  const pathValidator = createPathValidator(sourceDir);
53
- return z.object({
53
+ const schema = z.object({
54
54
  exports: z.union(
55
55
  [
56
56
  z.string().transform((path2) => /* @__PURE__ */ new Map([[".", path2]])),
@@ -130,6 +130,15 @@ function createPackageJsonSchema(sourceDir) {
130
130
  babel: z.any().optional(),
131
131
  peerDependenciesMeta: z.any().optional()
132
132
  });
133
+ return schema.superRefine((data, ctx) => {
134
+ if (!data.exports && !data.bin) {
135
+ ctx.addIssue({
136
+ code: "custom",
137
+ message: errors.errors.exportsRequired,
138
+ path: ["exports"]
139
+ });
140
+ }
141
+ });
133
142
  }
134
143
  async function parsePackageJson({
135
144
  sourceDir,
@@ -1 +1 @@
1
- {"version":3,"file":"packageJson.js","sources":["../../../../src/packageJson.ts"],"sourcesContent":["import * as fs from \"node:fs/promises\";\nimport z from \"zod\";\nimport { errors } from \"./errors.js\";\nimport { join } from \"node:path\";\n\n// <region>\n// For AI completion. Don't remove.\nconst allPackageJsonFields = [\n \"exports\",\n \"name\",\n \"version\",\n \"private\",\n \"description\",\n \"dependencies\",\n \"optionalDependencies\",\n \"bin\",\n \"repository\",\n \"keywords\",\n \"author\",\n \"contributors\",\n \"license\",\n \"devDependencies\",\n \"peerDependencies\",\n \"engines\",\n \"browser\",\n \"funding\",\n \"os\",\n \"cpu\",\n];\n\nconst requiredFields = [\"exports\", \"name\", \"version\", \"private\"];\n\nconst optionalFields = [\n \"description\",\n \"dependencies\",\n \"optionalDependencies\",\n \"bin\",\n \"repository\",\n \"keywords\",\n \"author\",\n \"contributors\",\n \"license\",\n \"devDependencies\",\n \"peerDependencies\",\n \"engines\",\n \"browser\",\n \"funding\",\n \"os\",\n \"cpu\",\n];\n// </region>\n\nasync function fileExists(filePath: string) {\n try {\n const stats = await fs.stat(filePath);\n return stats.isFile();\n } catch (error) {\n return false;\n }\n}\n\nfunction dependencies(errorText: string) {\n return z\n .record(z.string({ message: errorText }), { message: errorText })\n .optional();\n}\n\nfunction createPathValidator(sourceDir: string) {\n return (path: string) => {\n const finalPath = join(sourceDir, path);\n return fileExists(finalPath);\n };\n}\n\nconst PackageJsonNameField: string = \"___NAME___\";\nfunction fillPackageJson(packageJson: PackageJson) {\n if (packageJson.bin) {\n const binName = packageJson.bin.get(PackageJsonNameField);\n if (binName) {\n packageJson.bin.set(packageJson.name, binName);\n packageJson.bin.delete(PackageJsonNameField);\n }\n }\n}\n\nfunction createPackageJsonSchema(sourceDir: string) {\n const pathValidator = createPathValidator(sourceDir);\n\n return z.object({\n exports: z\n .union(\n [\n z.string().transform((path) => new Map([[\".\", path]])),\n z.record(z.string()).transform((obj) => new Map(Object.entries(obj))),\n ],\n {\n errorMap() {\n return { message: errors.exportsRequired };\n },\n },\n )\n .refine(async (obj) => {\n for (const [key, value] of obj.entries()) {\n if (!(await pathValidator(value))) {\n return false;\n }\n }\n return true;\n }, errors.exportsInvalid)\n .optional(),\n name: z\n .string({ message: errors.nameRequired })\n .min(1, errors.nameMinLength)\n .max(214, errors.nameMaxLength)\n .refine(\n (name) => [\"_\", \".\"].every((start) => !name.startsWith(start)),\n errors.nameStartsIllegalChars,\n ),\n version: z.string({ message: errors.versionRequired }),\n private: z\n .boolean({ message: errors.privateIsTrue })\n .refine((value) => value, errors.privateIsTrue),\n description: z.string({ message: errors.descriptionString }).optional(),\n dependencies: dependencies(errors.dependenciesInvalid),\n optionalDependencies: dependencies(errors.optionalDependenciesInvalid),\n bin: z\n .union(\n [\n z\n .string()\n .transform((value) => new Map([[PackageJsonNameField, value]])),\n z\n .record(z.string())\n .transform((record) => new Map(Object.entries(record))),\n ],\n {\n errorMap() {\n return { message: errors.binFiled };\n },\n },\n )\n .refine(\n async (map) => {\n for (const [key, value] of map.entries()) {\n if (!(await pathValidator(value))) {\n return false;\n }\n }\n return true;\n },\n { message: errors.binFiled },\n )\n .optional(),\n repository: z.any().optional(),\n keywords: z\n .array(z.string(), { message: errors.keywordsInvalid })\n .optional(),\n author: z.any().optional(),\n maintainers: z.any().optional(),\n contributors: z\n .array(\n z.union([\n z.string({ message: errors.contributorsInvalid }),\n z.object({}, { message: errors.contributorsInvalid }),\n ]),\n )\n .optional(),\n license: z.any().optional(),\n devDependencies: dependencies(errors.devDependenciesInvalid),\n peerDependencies: dependencies(errors.peerDependenciesInvalid),\n engines: z\n .record(z.string(), { message: errors.enginesInvalid })\n .optional(),\n browser: z\n .union([\n z.string({ message: errors.browserInvalid }),\n z.record(z.string(), { message: errors.browserInvalid }),\n ])\n .optional(),\n bugs: z.any().optional(),\n funding: z\n .union([\n z.string({ message: errors.fundingInvalid }),\n z.object({}, { message: errors.fundingInvalid }),\n ])\n .optional(),\n os: z.array(z.string(), { message: errors.osInvalid }).optional(),\n cpu: z.array(z.string(), { message: errors.cpuInvalid }).optional(),\n sideEffects: z.any().optional(),\n unpkg: z.any().optional(),\n homepage: z.any().optional(),\n babel: z.any().optional(),\n peerDependenciesMeta: z.any().optional(),\n });\n}\ntype PackageJsonSchema = ReturnType<typeof createPackageJsonSchema>;\n\nexport type PackageJson = z.infer<PackageJsonSchema>;\ntype Errors = Array<string>;\n\ntype ParsePackageJsonArg = {\n packagePath: string;\n sourceDir: string;\n};\n\nexport async function parsePackageJson({\n sourceDir,\n packagePath,\n}: ParsePackageJsonArg): Promise<PackageJson | Errors> {\n const packageString = await fs.readFile(packagePath, \"utf-8\");\n const rawJson = JSON.parse(packageString);\n\n const packageJsonSchema = createPackageJsonSchema(sourceDir);\n const packageJson = await packageJsonSchema.safeParseAsync(rawJson);\n if (!packageJson.success) {\n return packageJson.error.errors.map((error) => error.message);\n }\n\n fillPackageJson(packageJson.data);\n return packageJson.data;\n}\n"],"names":["fs","path","join","errors"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAoDA,eAAe,WAAW,UAAkB;AACtC,MAAA;AACF,UAAM,QAAQ,MAAMA,cAAG,KAAK,QAAQ;AACpC,WAAO,MAAM,OAAO;AAAA,WACb,OAAO;AACP,WAAA;AAAA,EAAA;AAEX;AAEA,SAAS,aAAa,WAAmB;AACvC,SAAO,EACJ,OAAO,EAAE,OAAO,EAAE,SAAS,UAAW,CAAA,GAAG,EAAE,SAAS,UAAW,CAAA,EAC/D,SAAS;AACd;AAEA,SAAS,oBAAoB,WAAmB;AAC9C,SAAO,CAACC,WAAiB;AACjB,UAAA,YAAYC,KAAAA,KAAK,WAAWD,MAAI;AACtC,WAAO,WAAW,SAAS;AAAA,EAC7B;AACF;AAEA,MAAM,uBAA+B;AACrC,SAAS,gBAAgB,aAA0B;AACjD,MAAI,YAAY,KAAK;AACnB,UAAM,UAAU,YAAY,IAAI,IAAI,oBAAoB;AACxD,QAAI,SAAS;AACX,kBAAY,IAAI,IAAI,YAAY,MAAM,OAAO;AACjC,kBAAA,IAAI,OAAO,oBAAoB;AAAA,IAAA;AAAA,EAC7C;AAEJ;AAEA,SAAS,wBAAwB,WAAmB;AAC5C,QAAA,gBAAgB,oBAAoB,SAAS;AAEnD,SAAO,EAAE,OAAO;AAAA,IACd,SAAS,EACN;AAAA,MACC;AAAA,QACE,EAAE,OAAA,EAAS,UAAU,CAACA,UAAS,oBAAI,IAAI,CAAC,CAAC,KAAKA,KAAI,CAAC,CAAC,CAAC;AAAA,QACrD,EAAE,OAAO,EAAE,OAAA,CAAQ,EAAE,UAAU,CAAC,QAAQ,IAAI,IA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IACZ,MAAM,EAAE,IAAI,EAAE,SAAS;AAAA,IACvB,SAAS,EACN,MAAM;AAAA,MACL,EAAE,OAAO,EAAE,SAASA,OAAA,OAAO,gBAAgB;AAAA,MAC3C,EAAE,OAAO,CAAC,GAAG,EAAE,SAASA,OAAAA,OAAO,eAAgB,CAAA;AAAA,IAChD,CAAA,EACA,SAAS;AAAA,IACZ,IAAI,EAAE,MAAM,EAAE,OAAO,GAAG,EAAE,SAASA,OAAO,OAAA,UAAW,CAAA,EAAE,SAAS;AAAA,IAChE,KAAK,EAAE,MAAM,EAAE,OAAO,GAAG,EAAE,SAASA,OAAO,OAAA,WAAY,CAAA,EAAE,SAAS;AAAA,IAClE,aAAa,EAAE,IAAI,EAAE,SAAS;AAAA,IAC9B,OAAO,EAAE,IAAI,EAAE,SAAS;AAAA,IACxB,UAAU,EAAE,IAAI,EAAE,SAAS;AAAA,IAC3B,OAAO,EAAE,IAAI,EAAE,SAAS;AAAA,IACxB,sBAAsB,EAAE,IAAI,EAAE,SAAS;AAAA,EAAA,CACxC;AACH;AAWA,eAAsB,iBAAiB;AAAA,EACrC;AAAA,EACA;AACF,GAAuD;AACrD,QAAM,gBAAgB,MAAMH,cAAG,SAAS,aAAa,OAAO;AACtD,QAAA,UAAU,KAAK,MAAM,aAAa;AAElC,QAAA,oBAAoB,wBAAwB,SAAS;AAC3D,QAAM,cAAc,MAAM,kBAAkB,eAAe,OAAO;AAC9D,MAAA,CAAC,YAAY,SAAS;AACxB,WAAO,YAAY,MAAM,OAAO,IAAI,CAAC,UAAU,MAAM,OAAO;AAAA,EAAA;AAG9D,kBAAgB,YAAY,IAAI;AAChC,SAAO,YAAY;AACrB;;"}
1
+ {"version":3,"file":"packageJson.js","sources":["../../../../src/packageJson.ts"],"sourcesContent":["import * as fs from \"node:fs/promises\";\nimport z from \"zod\";\nimport { errors } from \"./errors.js\";\nimport { join } from \"node:path\";\n\n// <region>\n// For AI completion. Don't remove.\nconst allPackageJsonFields = [\n \"exports\",\n \"name\",\n \"version\",\n \"private\",\n \"description\",\n \"dependencies\",\n \"optionalDependencies\",\n \"bin\",\n \"repository\",\n \"keywords\",\n \"author\",\n \"contributors\",\n \"license\",\n \"devDependencies\",\n \"peerDependencies\",\n \"engines\",\n \"browser\",\n \"funding\",\n \"os\",\n \"cpu\",\n];\n\nconst requiredFields = [\"exports\", \"name\", \"version\", \"private\"];\n\nconst optionalFields = [\n \"description\",\n \"dependencies\",\n \"optionalDependencies\",\n \"bin\",\n \"repository\",\n \"keywords\",\n \"author\",\n \"contributors\",\n \"license\",\n \"devDependencies\",\n \"peerDependencies\",\n \"engines\",\n \"browser\",\n \"funding\",\n \"os\",\n \"cpu\",\n];\n// </region>\n\nasync function fileExists(filePath: string) {\n try {\n const stats = await fs.stat(filePath);\n return stats.isFile();\n } catch (error) {\n return false;\n }\n}\n\nfunction dependencies(errorText: string) {\n return z\n .record(z.string({ message: errorText }), { message: errorText })\n .optional();\n}\n\nfunction createPathValidator(sourceDir: string) {\n return (path: string) => {\n const finalPath = join(sourceDir, path);\n return fileExists(finalPath);\n };\n}\n\nconst PackageJsonNameField: string = \"___NAME___\";\nfunction fillPackageJson(packageJson: PackageJson) {\n if (packageJson.bin) {\n const binName = packageJson.bin.get(PackageJsonNameField);\n if (binName) {\n packageJson.bin.set(packageJson.name, binName);\n packageJson.bin.delete(PackageJsonNameField);\n }\n }\n}\n\nfunction createPackageJsonSchema(sourceDir: string) {\n const pathValidator = createPathValidator(sourceDir);\n\n const schema = z.object({\n exports: z\n .union(\n [\n z.string().transform((path) => new Map([[\".\", path]])),\n z.record(z.string()).transform((obj) => new Map(Object.entries(obj))),\n ],\n {\n errorMap() {\n return { message: errors.exportsRequired };\n },\n },\n )\n .refine(async (obj) => {\n for (const [key, value] of obj.entries()) {\n if (!(await pathValidator(value))) {\n return false;\n }\n }\n return true;\n }, errors.exportsInvalid)\n .optional(),\n name: z\n .string({ message: errors.nameRequired })\n .min(1, errors.nameMinLength)\n .max(214, errors.nameMaxLength)\n .refine(\n (name) => [\"_\", \".\"].every((start) => !name.startsWith(start)),\n errors.nameStartsIllegalChars,\n ),\n version: z.string({ message: errors.versionRequired }),\n private: z\n .boolean({ message: errors.privateIsTrue })\n .refine((value) => value, errors.privateIsTrue),\n description: z.string({ message: errors.descriptionString }).optional(),\n dependencies: dependencies(errors.dependenciesInvalid),\n optionalDependencies: dependencies(errors.optionalDependenciesInvalid),\n bin: z\n .union(\n [\n z\n .string()\n .transform((value) => new Map([[PackageJsonNameField, value]])),\n z\n .record(z.string())\n .transform((record) => new Map(Object.entries(record))),\n ],\n {\n errorMap() {\n return { message: errors.binFiled };\n },\n },\n )\n .refine(\n async (map) => {\n for (const [key, value] of map.entries()) {\n if (!(await pathValidator(value))) {\n return false;\n }\n }\n return true;\n },\n { message: errors.binFiled },\n )\n .optional(),\n repository: z.any().optional(),\n keywords: z\n .array(z.string(), { message: errors.keywordsInvalid })\n .optional(),\n author: z.any().optional(),\n maintainers: z.any().optional(),\n contributors: z\n .array(\n z.union([\n z.string({ message: errors.contributorsInvalid }),\n z.object({}, { message: errors.contributorsInvalid }),\n ]),\n )\n .optional(),\n license: z.any().optional(),\n devDependencies: dependencies(errors.devDependenciesInvalid),\n peerDependencies: dependencies(errors.peerDependenciesInvalid),\n engines: z\n .record(z.string(), { message: errors.enginesInvalid })\n .optional(),\n browser: z\n .union([\n z.string({ message: errors.browserInvalid }),\n z.record(z.string(), { message: errors.browserInvalid }),\n ])\n .optional(),\n bugs: z.any().optional(),\n funding: z\n .union([\n z.string({ message: errors.fundingInvalid }),\n z.object({}, { message: errors.fundingInvalid }),\n ])\n .optional(),\n os: z.array(z.string(), { message: errors.osInvalid }).optional(),\n cpu: z.array(z.string(), { message: errors.cpuInvalid }).optional(),\n sideEffects: z.any().optional(),\n unpkg: z.any().optional(),\n homepage: z.any().optional(),\n babel: z.any().optional(),\n peerDependenciesMeta: z.any().optional(),\n });\n\n // Add custom logic so that at least one of exports or bin is provided\n return schema.superRefine((data, ctx) => {\n if (!data.exports && !data.bin) {\n ctx.addIssue({\n code: \"custom\",\n message: errors.exportsRequired,\n path: [\"exports\"],\n });\n }\n });\n}\ntype PackageJsonSchema = ReturnType<typeof createPackageJsonSchema>;\n\nexport type PackageJson = z.infer<PackageJsonSchema>;\ntype Errors = Array<string>;\n\ntype ParsePackageJsonArg = {\n packagePath: string;\n sourceDir: string;\n};\n\nexport async function parsePackageJson({\n sourceDir,\n packagePath,\n}: ParsePackageJsonArg): Promise<PackageJson | Errors> {\n const packageString = await fs.readFile(packagePath, \"utf-8\");\n const rawJson = JSON.parse(packageString);\n\n const packageJsonSchema = createPackageJsonSchema(sourceDir);\n const packageJson = await packageJsonSchema.safeParseAsync(rawJson);\n if (!packageJson.success) {\n return packageJson.error.errors.map((error) => error.message);\n }\n\n fillPackageJson(packageJson.data);\n return packageJson.data;\n}\n"],"names":["fs","path","join","errors"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAoDA,eAAe,WAAW,UAAkB;AACtC,MAAA;AACF,UAAM,QAAQ,MAAMA,cAAG,KAAK,QAAQ;AACpC,WAAO,MAAM,OAAO;AAAA,WACb,OAAO;AACP,WAAA;AAAA,EAAA;AAEX;AAEA,SAAS,aAAa,WAAmB;AACvC,SAAO,EACJ,OAAO,EAAE,OAAO,EAAE,SAAS,UAAW,CAAA,GAAG,EAAE,SAAS,UAAW,CAAA,EAC/D,SAAS;AACd;AAEA,SAAS,oBAAoB,WAAmB;AAC9C,SAAO,CAACC,WAAiB;AACjB,UAAA,YAAYC,KAAAA,KAAK,WAAWD,MAAI;AACtC,WAAO,WAAW,SAAS;AAAA,EAC7B;AACF;AAEA,MAAM,uBAA+B;AACrC,SAAS,gBAAgB,aAA0B;AACjD,MAAI,YAAY,KAAK;AACnB,UAAM,UAAU,YAAY,IAAI,IAAI,oBAAoB;AACxD,QAAI,SAAS;AACX,kBAAY,IAAI,IAAI,YAAY,MAAM,OAAO;AACjC,kBAAA,IAAI,OAAO,oBAAoB;AAAA,IAAA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iBAAiB;AAAA,EACrC;AAAA,EACA;AACF,GAAuD;AACrD,QAAM,gBAAgB,MAAMH,cAAG,SAAS,aAAa,OAAO;AACtD,QAAA,UAAU,KAAK,MAAM,aAAa;AAElC,QAAA,oBAAoB,wBAAwB,SAAS;AAC3D,QAAM,cAAc,MAAM,kBAAkB,eAAe,OAAO;AAC9D,MAAA,CAAC,YAAY,SAAS;AACxB,WAAO,YAAY,MAAM,OAAO,IAAI,CAAC,UAAU,MAAM,OAAO;AAAA,EAAA;AAG9D,kBAAgB,YAAY,IAAI;AAChC,SAAO,YAAY;AACrB;;"}
@@ -1,5 +1,5 @@
1
1
  const errors = {
2
- exportsRequired: "The `exports` field is string or Record<string, string>. Please, verify the value. More info: https://nodejs.org/api/packages.html#package-entry-points",
2
+ exportsRequired: "The `exports` or `bin` field is required. Please, verify the value. More info: https://nodejs.org/api/packages.html#package-entry-points",
3
3
  exportsInvalid: "The `exports` field must be a path to entrypoint. Please, verify the value. More info: https://nodejs.org/api/packages.html#package-entry-points",
4
4
  nameRequired: "The `name` field is required string. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#name",
5
5
  nameMinLength: 'Min length of "name" is 1 character. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#name',
@@ -1 +1 @@
1
- {"version":3,"file":"errors.mjs","sources":["../../../../src/errors.ts"],"sourcesContent":["export const errors = {\n exportsRequired:\n \"The `exports` field is string or Record<string, string>. Please, verify the value. More info: https://nodejs.org/api/packages.html#package-entry-points\",\n exportsInvalid:\n \"The `exports` field must be a path to entrypoint. Please, verify the value. More info: https://nodejs.org/api/packages.html#package-entry-points\",\n nameRequired:\n \"The `name` field is required string. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#name\",\n nameMinLength:\n 'Min length of \"name\" is 1 character. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#name',\n nameMaxLength:\n 'Max length of \"name\" is 214 characters. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#name',\n nameStartsIllegalChars:\n \"Name cannot start with `_` or `.` if it is not a scoped package. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#name\",\n versionRequired:\n \"The `version` field is required string. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#version\",\n privateIsTrue:\n \"The `private` field must be `true` for avoiding accidental publish. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#private\",\n descriptionString:\n \"The `description` field must be a string. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#description\",\n dependenciesInvalid:\n \"The `dependencies` field must be an Object<string, string>. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#dependencies\",\n binFiled:\n \"The `bin` field must be a path or Record<string, FilePath>. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#bin\",\n rollupError:\n \"An error occurred while building the package. Please, report it to the issues on GitHub\",\n typescriptNotFound:\n \"The package.json contains typescript entrypoints, but the typescript package is not found. Please, install typescript@^5.0.0\",\n optionalDependenciesInvalid:\n \"The `optionalDependencies` field must be an Object<string, string>. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#optionaldependencies\",\n repositoryInvalid:\n \"The `repository` field must be an object with 'type' and 'url' properties or a string. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#repository\",\n keywordsInvalid:\n \"The `keywords` field must be an array of strings. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#keywords\",\n authorInvalid:\n \"The `author` field must be an object or a string. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#people-fields-author-contributors\",\n contributorsInvalid:\n \"The `contributors` field must be an array of objects or strings. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#people-fields-author-contributors\",\n licenseInvalid:\n \"The `license` field must be a string specifying the license. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#license\",\n devDependenciesInvalid:\n \"The `devDependencies` field must be an Object<string, string>. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#devdependencies\",\n peerDependenciesInvalid:\n \"The `peerDependencies` field must be an Object<string, string>. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#peerdependencies\",\n enginesInvalid:\n \"The `engines` field must be an object specifying version requirements. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#engines\",\n browserInvalid:\n \"The `browser` field must be a string or an object. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#browser\",\n fundingInvalid:\n \"The `funding` field must be an object or a string. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#funding\",\n osInvalid:\n \"The `os` field must be an array of strings. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#os\",\n cpuInvalid:\n \"The `cpu` field must be an array of strings. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#cpu\",\n};\n"],"names":[],"mappings":"AAAO,MAAM,SAAS;AAAA,EACpB,iBACE;AAAA,EACF,gBACE;AAAA,EACF,cACE;AAAA,EACF,eACE;AAAA,EACF,eACE;AAAA,EACF,wBACE;AAAA,EACF,iBACE;AAAA,EACF,eACE;AAAA,EACF,mBACE;AAAA,EACF,qBACE;AAAA,EACF,UACE;AAAA,EACF,aACE;AAAA,EACF,oBACE;AAAA,EACF,6BACE;AAAA,EACF,mBACE;AAAA,EACF,iBACE;AAAA,EACF,eACE;AAAA,EACF,qBACE;AAAA,EACF,gBACE;AAAA,EACF,wBACE;AAAA,EACF,yBACE;AAAA,EACF,gBACE;AAAA,EACF,gBACE;AAAA,EACF,gBACE;AAAA,EACF,WACE;AAAA,EACF,YACE;AACJ;"}
1
+ {"version":3,"file":"errors.mjs","sources":["../../../../src/errors.ts"],"sourcesContent":["export const errors = {\n exportsRequired:\n \"The `exports` or `bin` field is required. Please, verify the value. More info: https://nodejs.org/api/packages.html#package-entry-points\",\n exportsInvalid:\n \"The `exports` field must be a path to entrypoint. Please, verify the value. More info: https://nodejs.org/api/packages.html#package-entry-points\",\n nameRequired:\n \"The `name` field is required string. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#name\",\n nameMinLength:\n 'Min length of \"name\" is 1 character. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#name',\n nameMaxLength:\n 'Max length of \"name\" is 214 characters. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#name',\n nameStartsIllegalChars:\n \"Name cannot start with `_` or `.` if it is not a scoped package. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#name\",\n versionRequired:\n \"The `version` field is required string. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#version\",\n privateIsTrue:\n \"The `private` field must be `true` for avoiding accidental publish. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#private\",\n descriptionString:\n \"The `description` field must be a string. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#description\",\n dependenciesInvalid:\n \"The `dependencies` field must be an Object<string, string>. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#dependencies\",\n binFiled:\n \"The `bin` field must be a path or Record<string, FilePath>. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#bin\",\n rollupError:\n \"An error occurred while building the package. Please, report it to the issues on GitHub\",\n typescriptNotFound:\n \"The package.json contains typescript entrypoints, but the typescript package is not found. Please, install typescript@^5.0.0\",\n optionalDependenciesInvalid:\n \"The `optionalDependencies` field must be an Object<string, string>. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#optionaldependencies\",\n repositoryInvalid:\n \"The `repository` field must be an object with 'type' and 'url' properties or a string. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#repository\",\n keywordsInvalid:\n \"The `keywords` field must be an array of strings. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#keywords\",\n authorInvalid:\n \"The `author` field must be an object or a string. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#people-fields-author-contributors\",\n contributorsInvalid:\n \"The `contributors` field must be an array of objects or strings. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#people-fields-author-contributors\",\n licenseInvalid:\n \"The `license` field must be a string specifying the license. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#license\",\n devDependenciesInvalid:\n \"The `devDependencies` field must be an Object<string, string>. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#devdependencies\",\n peerDependenciesInvalid:\n \"The `peerDependencies` field must be an Object<string, string>. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#peerdependencies\",\n enginesInvalid:\n \"The `engines` field must be an object specifying version requirements. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#engines\",\n browserInvalid:\n \"The `browser` field must be a string or an object. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#browser\",\n fundingInvalid:\n \"The `funding` field must be an object or a string. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#funding\",\n osInvalid:\n \"The `os` field must be an array of strings. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#os\",\n cpuInvalid:\n \"The `cpu` field must be an array of strings. Please, verify the value. More info: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#cpu\",\n};\n"],"names":[],"mappings":"AAAO,MAAM,SAAS;AAAA,EACpB,iBACE;AAAA,EACF,gBACE;AAAA,EACF,cACE;AAAA,EACF,eACE;AAAA,EACF,eACE;AAAA,EACF,wBACE;AAAA,EACF,iBACE;AAAA,EACF,eACE;AAAA,EACF,mBACE;AAAA,EACF,qBACE;AAAA,EACF,UACE;AAAA,EACF,aACE;AAAA,EACF,oBACE;AAAA,EACF,6BACE;AAAA,EACF,mBACE;AAAA,EACF,iBACE;AAAA,EACF,eACE;AAAA,EACF,qBACE;AAAA,EACF,gBACE;AAAA,EACF,wBACE;AAAA,EACF,yBACE;AAAA,EACF,gBACE;AAAA,EACF,gBACE;AAAA,EACF,gBACE;AAAA,EACF,WACE;AAAA,EACF,YACE;AACJ;"}
@@ -1,5 +1,5 @@
1
1
  import z from "zod";
2
- declare function createPackageJsonSchema(sourceDir: string): z.ZodObject<{
2
+ declare function createPackageJsonSchema(sourceDir: string): z.ZodEffects<z.ZodObject<{
3
3
  exports: z.ZodOptional<z.ZodEffects<z.ZodUnion<[
4
4
  z.ZodEffects<z.ZodString, Map<string, string>, string>,
5
5
  z.ZodEffects<z.ZodRecord<z.ZodString, z.ZodString>, Map<string, string>, Record<string, string>>
@@ -98,6 +98,62 @@ declare function createPackageJsonSchema(sourceDir: string): z.ZodObject<{
98
98
  homepage?: any;
99
99
  babel?: any;
100
100
  peerDependenciesMeta?: any;
101
+ }>, {
102
+ exports?: Map<string, string>;
103
+ name?: string;
104
+ version?: string;
105
+ private?: boolean;
106
+ description?: string;
107
+ dependencies?: Record<string, string>;
108
+ optionalDependencies?: Record<string, string>;
109
+ bin?: Map<string, string>;
110
+ repository?: any;
111
+ keywords?: string[];
112
+ author?: any;
113
+ contributors?: (string | {})[];
114
+ license?: any;
115
+ devDependencies?: Record<string, string>;
116
+ peerDependencies?: Record<string, string>;
117
+ engines?: Record<string, string>;
118
+ browser?: string | Record<string, string>;
119
+ funding?: string | {};
120
+ os?: string[];
121
+ cpu?: string[];
122
+ maintainers?: any;
123
+ bugs?: any;
124
+ sideEffects?: any;
125
+ unpkg?: any;
126
+ homepage?: any;
127
+ babel?: any;
128
+ peerDependenciesMeta?: any;
129
+ }, {
130
+ exports?: string | Record<string, string>;
131
+ name?: string;
132
+ version?: string;
133
+ private?: boolean;
134
+ description?: string;
135
+ dependencies?: Record<string, string>;
136
+ optionalDependencies?: Record<string, string>;
137
+ bin?: string | Record<string, string>;
138
+ repository?: any;
139
+ keywords?: string[];
140
+ author?: any;
141
+ contributors?: (string | {})[];
142
+ license?: any;
143
+ devDependencies?: Record<string, string>;
144
+ peerDependencies?: Record<string, string>;
145
+ engines?: Record<string, string>;
146
+ browser?: string | Record<string, string>;
147
+ funding?: string | {};
148
+ os?: string[];
149
+ cpu?: string[];
150
+ maintainers?: any;
151
+ bugs?: any;
152
+ sideEffects?: any;
153
+ unpkg?: any;
154
+ homepage?: any;
155
+ babel?: any;
156
+ peerDependenciesMeta?: any;
101
157
  }>;
102
158
  type PackageJsonSchema = ReturnType<typeof createPackageJsonSchema>;
103
159
  export type PackageJson = z.infer<PackageJsonSchema>;
@@ -31,7 +31,7 @@ function fillPackageJson(packageJson) {
31
31
  }
32
32
  function createPackageJsonSchema(sourceDir) {
33
33
  const pathValidator = createPathValidator(sourceDir);
34
- return z.object({
34
+ const schema = z.object({
35
35
  exports: z.union(
36
36
  [
37
37
  z.string().transform((path) => /* @__PURE__ */ new Map([[".", path]])),
@@ -111,6 +111,15 @@ function createPackageJsonSchema(sourceDir) {
111
111
  babel: z.any().optional(),
112
112
  peerDependenciesMeta: z.any().optional()
113
113
  });
114
+ return schema.superRefine((data, ctx) => {
115
+ if (!data.exports && !data.bin) {
116
+ ctx.addIssue({
117
+ code: "custom",
118
+ message: errors.exportsRequired,
119
+ path: ["exports"]
120
+ });
121
+ }
122
+ });
114
123
  }
115
124
  async function parsePackageJson({
116
125
  sourceDir,
@@ -1 +1 @@
1
- {"version":3,"file":"packageJson.mjs","sources":["../../../../src/packageJson.ts"],"sourcesContent":["import * as fs from \"node:fs/promises\";\nimport z from \"zod\";\nimport { errors } from \"./errors.js\";\nimport { join } from \"node:path\";\n\n// <region>\n// For AI completion. Don't remove.\nconst allPackageJsonFields = [\n \"exports\",\n \"name\",\n \"version\",\n \"private\",\n \"description\",\n \"dependencies\",\n \"optionalDependencies\",\n \"bin\",\n \"repository\",\n \"keywords\",\n \"author\",\n \"contributors\",\n \"license\",\n \"devDependencies\",\n \"peerDependencies\",\n \"engines\",\n \"browser\",\n \"funding\",\n \"os\",\n \"cpu\",\n];\n\nconst requiredFields = [\"exports\", \"name\", \"version\", \"private\"];\n\nconst optionalFields = [\n \"description\",\n \"dependencies\",\n \"optionalDependencies\",\n \"bin\",\n \"repository\",\n \"keywords\",\n \"author\",\n \"contributors\",\n \"license\",\n \"devDependencies\",\n \"peerDependencies\",\n \"engines\",\n \"browser\",\n \"funding\",\n \"os\",\n \"cpu\",\n];\n// </region>\n\nasync function fileExists(filePath: string) {\n try {\n const stats = await fs.stat(filePath);\n return stats.isFile();\n } catch (error) {\n return false;\n }\n}\n\nfunction dependencies(errorText: string) {\n return z\n .record(z.string({ message: errorText }), { message: errorText })\n .optional();\n}\n\nfunction createPathValidator(sourceDir: string) {\n return (path: string) => {\n const finalPath = join(sourceDir, path);\n return fileExists(finalPath);\n };\n}\n\nconst PackageJsonNameField: string = \"___NAME___\";\nfunction fillPackageJson(packageJson: PackageJson) {\n if (packageJson.bin) {\n const binName = packageJson.bin.get(PackageJsonNameField);\n if (binName) {\n packageJson.bin.set(packageJson.name, binName);\n packageJson.bin.delete(PackageJsonNameField);\n }\n }\n}\n\nfunction createPackageJsonSchema(sourceDir: string) {\n const pathValidator = createPathValidator(sourceDir);\n\n return z.object({\n exports: z\n .union(\n [\n z.string().transform((path) => new Map([[\".\", path]])),\n z.record(z.string()).transform((obj) => new Map(Object.entries(obj))),\n ],\n {\n errorMap() {\n return { message: errors.exportsRequired };\n },\n },\n )\n .refine(async (obj) => {\n for (const [key, value] of obj.entries()) {\n if (!(await pathValidator(value))) {\n return false;\n }\n }\n return true;\n }, errors.exportsInvalid)\n .optional(),\n name: z\n .string({ message: errors.nameRequired })\n .min(1, errors.nameMinLength)\n .max(214, errors.nameMaxLength)\n .refine(\n (name) => [\"_\", \".\"].every((start) => !name.startsWith(start)),\n errors.nameStartsIllegalChars,\n ),\n version: z.string({ message: errors.versionRequired }),\n private: z\n .boolean({ message: errors.privateIsTrue })\n .refine((value) => value, errors.privateIsTrue),\n description: z.string({ message: errors.descriptionString }).optional(),\n dependencies: dependencies(errors.dependenciesInvalid),\n optionalDependencies: dependencies(errors.optionalDependenciesInvalid),\n bin: z\n .union(\n [\n z\n .string()\n .transform((value) => new Map([[PackageJsonNameField, value]])),\n z\n .record(z.string())\n .transform((record) => new Map(Object.entries(record))),\n ],\n {\n errorMap() {\n return { message: errors.binFiled };\n },\n },\n )\n .refine(\n async (map) => {\n for (const [key, value] of map.entries()) {\n if (!(await pathValidator(value))) {\n return false;\n }\n }\n return true;\n },\n { message: errors.binFiled },\n )\n .optional(),\n repository: z.any().optional(),\n keywords: z\n .array(z.string(), { message: errors.keywordsInvalid })\n .optional(),\n author: z.any().optional(),\n maintainers: z.any().optional(),\n contributors: z\n .array(\n z.union([\n z.string({ message: errors.contributorsInvalid }),\n z.object({}, { message: errors.contributorsInvalid }),\n ]),\n )\n .optional(),\n license: z.any().optional(),\n devDependencies: dependencies(errors.devDependenciesInvalid),\n peerDependencies: dependencies(errors.peerDependenciesInvalid),\n engines: z\n .record(z.string(), { message: errors.enginesInvalid })\n .optional(),\n browser: z\n .union([\n z.string({ message: errors.browserInvalid }),\n z.record(z.string(), { message: errors.browserInvalid }),\n ])\n .optional(),\n bugs: z.any().optional(),\n funding: z\n .union([\n z.string({ message: errors.fundingInvalid }),\n z.object({}, { message: errors.fundingInvalid }),\n ])\n .optional(),\n os: z.array(z.string(), { message: errors.osInvalid }).optional(),\n cpu: z.array(z.string(), { message: errors.cpuInvalid }).optional(),\n sideEffects: z.any().optional(),\n unpkg: z.any().optional(),\n homepage: z.any().optional(),\n babel: z.any().optional(),\n peerDependenciesMeta: z.any().optional(),\n });\n}\ntype PackageJsonSchema = ReturnType<typeof createPackageJsonSchema>;\n\nexport type PackageJson = z.infer<PackageJsonSchema>;\ntype Errors = Array<string>;\n\ntype ParsePackageJsonArg = {\n packagePath: string;\n sourceDir: string;\n};\n\nexport async function parsePackageJson({\n sourceDir,\n packagePath,\n}: ParsePackageJsonArg): Promise<PackageJson | Errors> {\n const packageString = await fs.readFile(packagePath, \"utf-8\");\n const rawJson = JSON.parse(packageString);\n\n const packageJsonSchema = createPackageJsonSchema(sourceDir);\n const packageJson = await packageJsonSchema.safeParseAsync(rawJson);\n if (!packageJson.success) {\n return packageJson.error.errors.map((error) => error.message);\n }\n\n fillPackageJson(packageJson.data);\n return packageJson.data;\n}\n"],"names":[],"mappings":";;;;AAoDA,eAAe,WAAW,UAAkB;AACtC,MAAA;AACF,UAAM,QAAQ,MAAM,GAAG,KAAK,QAAQ;AACpC,WAAO,MAAM,OAAO;AAAA,WACb,OAAO;AACP,WAAA;AAAA,EAAA;AAEX;AAEA,SAAS,aAAa,WAAmB;AACvC,SAAO,EACJ,OAAO,EAAE,OAAO,EAAE,SAAS,UAAW,CAAA,GAAG,EAAE,SAAS,UAAW,CAAA,EAC/D,SAAS;AACd;AAEA,SAAS,oBAAoB,WAAmB;AAC9C,SAAO,CAAC,SAAiB;AACjB,UAAA,YAAY,KAAK,WAAW,IAAI;AACtC,WAAO,WAAW,SAAS;AAAA,EAC7B;AACF;AAEA,MAAM,uBAA+B;AACrC,SAAS,gBAAgB,aAA0B;AACjD,MAAI,YAAY,KAAK;AACnB,UAAM,UAAU,YAAY,IAAI,IAAI,oBAAoB;AACxD,QAAI,SAAS;AACX,kBAAY,IAAI,IAAI,YAAY,MAAM,OAAO;AACjC,kBAAA,IAAI,OAAO,oBAAoB;AAAA,IAAA;AAAA,EAC7C;AAEJ;AAEA,SAAS,wBAAwB,WAAmB;AAC5C,QAAA,gBAAgB,oBAAoB,SAAS;AAEnD,SAAO,EAAE,OAAO;AAAA,IACd,SAAS,EACN;AAAA,MACC;AAAA,QACE,EAAE,OAAA,EAAS,UAAU,CAAC,SAAS,oBAAI,IAAI,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC;AAAA,QACrD,EAAE,OAAO,EAAE,OAAA,CAAQ,EAAE,UAAU,CAAC,QAAQ,IA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CAAC,GAAG,EAAE,SAAS,OAAO,eAAgB,CAAA;AAAA,IAChD,CAAA,EACA,SAAS;AAAA,IACZ,IAAI,EAAE,MAAM,EAAE,OAAO,GAAG,EAAE,SAAS,OAAO,UAAW,CAAA,EAAE,SAAS;AAAA,IAChE,KAAK,EAAE,MAAM,EAAE,OAAO,GAAG,EAAE,SAAS,OAAO,WAAY,CAAA,EAAE,SAAS;AAAA,IAClE,aAAa,EAAE,IAAI,EAAE,SAAS;AAAA,IAC9B,OAAO,EAAE,IAAI,EAAE,SAAS;AAAA,IACxB,UAAU,EAAE,IAAI,EAAE,SAAS;AAAA,IAC3B,OAAO,EAAE,IAAI,EAAE,SAAS;AAAA,IACxB,sBAAsB,EAAE,IAAI,EAAE,SAAS;AAAA,EAAA,CACxC;AACH;AAWA,eAAsB,iBAAiB;AAAA,EACrC;AAAA,EACA;AACF,GAAuD;AACrD,QAAM,gBAAgB,MAAM,GAAG,SAAS,aAAa,OAAO;AACtD,QAAA,UAAU,KAAK,MAAM,aAAa;AAElC,QAAA,oBAAoB,wBAAwB,SAAS;AAC3D,QAAM,cAAc,MAAM,kBAAkB,eAAe,OAAO;AAC9D,MAAA,CAAC,YAAY,SAAS;AACxB,WAAO,YAAY,MAAM,OAAO,IAAI,CAAC,UAAU,MAAM,OAAO;AAAA,EAAA;AAG9D,kBAAgB,YAAY,IAAI;AAChC,SAAO,YAAY;AACrB;"}
1
+ {"version":3,"file":"packageJson.mjs","sources":["../../../../src/packageJson.ts"],"sourcesContent":["import * as fs from \"node:fs/promises\";\nimport z from \"zod\";\nimport { errors } from \"./errors.js\";\nimport { join } from \"node:path\";\n\n// <region>\n// For AI completion. Don't remove.\nconst allPackageJsonFields = [\n \"exports\",\n \"name\",\n \"version\",\n \"private\",\n \"description\",\n \"dependencies\",\n \"optionalDependencies\",\n \"bin\",\n \"repository\",\n \"keywords\",\n \"author\",\n \"contributors\",\n \"license\",\n \"devDependencies\",\n \"peerDependencies\",\n \"engines\",\n \"browser\",\n \"funding\",\n \"os\",\n \"cpu\",\n];\n\nconst requiredFields = [\"exports\", \"name\", \"version\", \"private\"];\n\nconst optionalFields = [\n \"description\",\n \"dependencies\",\n \"optionalDependencies\",\n \"bin\",\n \"repository\",\n \"keywords\",\n \"author\",\n \"contributors\",\n \"license\",\n \"devDependencies\",\n \"peerDependencies\",\n \"engines\",\n \"browser\",\n \"funding\",\n \"os\",\n \"cpu\",\n];\n// </region>\n\nasync function fileExists(filePath: string) {\n try {\n const stats = await fs.stat(filePath);\n return stats.isFile();\n } catch (error) {\n return false;\n }\n}\n\nfunction dependencies(errorText: string) {\n return z\n .record(z.string({ message: errorText }), { message: errorText })\n .optional();\n}\n\nfunction createPathValidator(sourceDir: string) {\n return (path: string) => {\n const finalPath = join(sourceDir, path);\n return fileExists(finalPath);\n };\n}\n\nconst PackageJsonNameField: string = \"___NAME___\";\nfunction fillPackageJson(packageJson: PackageJson) {\n if (packageJson.bin) {\n const binName = packageJson.bin.get(PackageJsonNameField);\n if (binName) {\n packageJson.bin.set(packageJson.name, binName);\n packageJson.bin.delete(PackageJsonNameField);\n }\n }\n}\n\nfunction createPackageJsonSchema(sourceDir: string) {\n const pathValidator = createPathValidator(sourceDir);\n\n const schema = z.object({\n exports: z\n .union(\n [\n z.string().transform((path) => new Map([[\".\", path]])),\n z.record(z.string()).transform((obj) => new Map(Object.entries(obj))),\n ],\n {\n errorMap() {\n return { message: errors.exportsRequired };\n },\n },\n )\n .refine(async (obj) => {\n for (const [key, value] of obj.entries()) {\n if (!(await pathValidator(value))) {\n return false;\n }\n }\n return true;\n }, errors.exportsInvalid)\n .optional(),\n name: z\n .string({ message: errors.nameRequired })\n .min(1, errors.nameMinLength)\n .max(214, errors.nameMaxLength)\n .refine(\n (name) => [\"_\", \".\"].every((start) => !name.startsWith(start)),\n errors.nameStartsIllegalChars,\n ),\n version: z.string({ message: errors.versionRequired }),\n private: z\n .boolean({ message: errors.privateIsTrue })\n .refine((value) => value, errors.privateIsTrue),\n description: z.string({ message: errors.descriptionString }).optional(),\n dependencies: dependencies(errors.dependenciesInvalid),\n optionalDependencies: dependencies(errors.optionalDependenciesInvalid),\n bin: z\n .union(\n [\n z\n .string()\n .transform((value) => new Map([[PackageJsonNameField, value]])),\n z\n .record(z.string())\n .transform((record) => new Map(Object.entries(record))),\n ],\n {\n errorMap() {\n return { message: errors.binFiled };\n },\n },\n )\n .refine(\n async (map) => {\n for (const [key, value] of map.entries()) {\n if (!(await pathValidator(value))) {\n return false;\n }\n }\n return true;\n },\n { message: errors.binFiled },\n )\n .optional(),\n repository: z.any().optional(),\n keywords: z\n .array(z.string(), { message: errors.keywordsInvalid })\n .optional(),\n author: z.any().optional(),\n maintainers: z.any().optional(),\n contributors: z\n .array(\n z.union([\n z.string({ message: errors.contributorsInvalid }),\n z.object({}, { message: errors.contributorsInvalid }),\n ]),\n )\n .optional(),\n license: z.any().optional(),\n devDependencies: dependencies(errors.devDependenciesInvalid),\n peerDependencies: dependencies(errors.peerDependenciesInvalid),\n engines: z\n .record(z.string(), { message: errors.enginesInvalid })\n .optional(),\n browser: z\n .union([\n z.string({ message: errors.browserInvalid }),\n z.record(z.string(), { message: errors.browserInvalid }),\n ])\n .optional(),\n bugs: z.any().optional(),\n funding: z\n .union([\n z.string({ message: errors.fundingInvalid }),\n z.object({}, { message: errors.fundingInvalid }),\n ])\n .optional(),\n os: z.array(z.string(), { message: errors.osInvalid }).optional(),\n cpu: z.array(z.string(), { message: errors.cpuInvalid }).optional(),\n sideEffects: z.any().optional(),\n unpkg: z.any().optional(),\n homepage: z.any().optional(),\n babel: z.any().optional(),\n peerDependenciesMeta: z.any().optional(),\n });\n\n // Add custom logic so that at least one of exports or bin is provided\n return schema.superRefine((data, ctx) => {\n if (!data.exports && !data.bin) {\n ctx.addIssue({\n code: \"custom\",\n message: errors.exportsRequired,\n path: [\"exports\"],\n });\n }\n });\n}\ntype PackageJsonSchema = ReturnType<typeof createPackageJsonSchema>;\n\nexport type PackageJson = z.infer<PackageJsonSchema>;\ntype Errors = Array<string>;\n\ntype ParsePackageJsonArg = {\n packagePath: string;\n sourceDir: string;\n};\n\nexport async function parsePackageJson({\n sourceDir,\n packagePath,\n}: ParsePackageJsonArg): Promise<PackageJson | Errors> {\n const packageString = await fs.readFile(packagePath, \"utf-8\");\n const rawJson = JSON.parse(packageString);\n\n const packageJsonSchema = createPackageJsonSchema(sourceDir);\n const packageJson = await packageJsonSchema.safeParseAsync(rawJson);\n if (!packageJson.success) {\n return packageJson.error.errors.map((error) => error.message);\n }\n\n fillPackageJson(packageJson.data);\n return packageJson.data;\n}\n"],"names":[],"mappings":";;;;AAoDA,eAAe,WAAW,UAAkB;AACtC,MAAA;AACF,UAAM,QAAQ,MAAM,GAAG,KAAK,QAAQ;AACpC,WAAO,MAAM,OAAO;AAAA,WACb,OAAO;AACP,WAAA;AAAA,EAAA;AAEX;AAEA,SAAS,aAAa,WAAmB;AACvC,SAAO,EACJ,OAAO,EAAE,OAAO,EAAE,SAAS,UAAW,CAAA,GAAG,EAAE,SAAS,UAAW,CAAA,EAC/D,SAAS;AACd;AAEA,SAAS,oBAAoB,WAAmB;AAC9C,SAAO,CAAC,SAAiB;AACjB,UAAA,YAAY,KAAK,WAAW,IAAI;AACtC,WAAO,WAAW,SAAS;AAAA,EAC7B;AACF;AAEA,MAAM,uBAA+B;AACrC,SAAS,gBAAgB,aAA0B;AACjD,MAAI,YAAY,KAAK;AACnB,UAAM,UAAU,YAAY,IAAI,IAAI,oBAAoB;AACxD,QAAI,SAAS;AACX,kBAAY,IAAI,IAAI,YAAY,MAAM,OAAO;AACjC,kBAAA,IAAI,OAAO,oBAAoB;AAAA,IAAA;AAAA,EAC7C;AAEJ;AAEA,SAAS,wBAAwB,WAAmB;AAC5C,QAAA,gBAAgB,oBAAoB,SAAS;AAE7C,QAAA,SAAS,EAAE,OAAO;AAAA,IACtB,SAAS,EACN;AAAA,MACC;AAAA,QACE,EAAE,OAAA,EAAS,UAAU,CAAC,SAAS,oBAAI,IAAI,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,7 +1,7 @@
1
1
  {
2
2
  "name": "smartbundle",
3
3
  "type": "commonjs",
4
- "version": "0.13.1",
4
+ "version": "0.14.1",
5
5
  "bin": {
6
6
  "smartbundle": "__bin__/smartbundle.js"
7
7
  },
@@ -26,10 +26,10 @@
26
26
  },
27
27
  "dependencies": {
28
28
  "semver": "^7.6.3",
29
- "vite": "^5.4.11",
29
+ "vite": "^6.0.7",
30
30
  "yargs": "^17.7.2",
31
- "youch": "4.1.0-beta.4",
32
- "zod": "^3.24.0"
31
+ "youch": "4.1.0-beta.5",
32
+ "zod": "^3.24.1"
33
33
  },
34
34
  "repository": {
35
35
  "type": "git",
@@ -52,7 +52,7 @@
52
52
  "peerDependencies": {
53
53
  "@babel/core": "^7.26.0",
54
54
  "typescript": "^5.0.0",
55
- "vitest": "^2.1.8"
55
+ "vitest": "^3.0.0"
56
56
  },
57
57
  "bugs": {
58
58
  "url": "https://github.com/xavescor/smartbundle/issues"
@@ -60,14 +60,14 @@
60
60
  "homepage": "https://github.com/xavescor/smartbundle",
61
61
  "devDependencies": {
62
62
  "@types/babel__core": "^7.20.5",
63
- "@types/node": "^22.10.1",
63
+ "@types/node": "^22.10.7",
64
64
  "@types/semver": "^7.5.8",
65
65
  "@types/yargs": "^17.0.33",
66
66
  "prettier": "^3.4.2",
67
- "typescript": "^5.7.2",
68
- "vitest": "^2.1.8",
69
- "vitest-directory-snapshot": "^0.3.0",
70
- "zx": "^8.2.4"
67
+ "typescript": "^5.7.3",
68
+ "vitest": "^3.0.2",
69
+ "vitest-directory-snapshot": "^0.4.0",
70
+ "zx": "^8.3.0"
71
71
  },
72
72
  "peerDependenciesMeta": {
73
73
  "@babel/core": {