@sse-ui/builder 1.2.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/README.md +76 -0
- package/dist/{babel-RJOLF3H5.js → babel-2PBTAJV6.js} +2 -3
- package/dist/babel-config.js +3 -3
- package/dist/{chunk-MBPIJFGX.js → chunk-6NNEV5YX.js} +15 -10
- package/dist/{chunk-B6FMAT44.js → chunk-N46AJ2OI.js} +3 -1
- package/dist/cli.js +164 -78
- package/dist/config.d.ts +2 -2
- package/dist/config.js +0 -2
- package/dist/typescript-2XUZHHI2.js +286 -0
- package/package.json +2 -3
- package/dist/acorn-RZKYEOCN.js +0 -3130
- package/dist/angular-65ZVA2AO.js +0 -3070
- package/dist/babel-6NAC7UZ3.js +0 -7296
- package/dist/chunk-MLKGABMK.js +0 -9
- package/dist/estree-SLPC3MKU.js +0 -4612
- package/dist/flow-JKSA2WQA.js +0 -27546
- package/dist/glimmer-KH4FHVWK.js +0 -2894
- package/dist/graphql-X7RDVKKC.js +0 -1266
- package/dist/html-A2DZMMEZ.js +0 -2933
- package/dist/markdown-35RS3VXW.js +0 -3553
- package/dist/meriyah-UIMGFPH2.js +0 -2684
- package/dist/postcss-CITECRUH.js +0 -5080
- package/dist/typescript-6QWCIZ3Q.js +0 -20526
- package/dist/typescript-CFZSZQGQ.js +0 -13203
- package/dist/yaml-RAY3ED75.js +0 -4224
package/README.md
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# @sse-ui/builder (sse-tools)
|
|
2
|
+
|
|
3
|
+
`sse-tools` is a high-performance CLI utility designed for managing, building, and publishing software packages within the SSE ecosystem. It provides a unified interface for library development, supporting both Babel for individual file transpilation and esbuild for high-speed bundling.
|
|
4
|
+
|
|
5
|
+
## ✨ Features
|
|
6
|
+
|
|
7
|
+
- **Hybrid Builder Engine**: Seamlessly switch between Babel for detailed transpilation or esbuild for rapid bundling via simple configuration.
|
|
8
|
+
- **Vite-style Watch Mode**: Features an incremental watcher that rebuilds only the specific files you change, significantly speeding up development loops.
|
|
9
|
+
- **Intelligent Export Management**: Automatically generates and optimizes your package.json exports field based on your build output, supporting both flat and nested structures.
|
|
10
|
+
- **TypeScript-First**: Built-in support for generating and bundling .d.ts declaration files using either standard tsc or the high-performance tsgo compiler.
|
|
11
|
+
- **React Compiler Support**: Integrated support for the React compiler, including automatic environment configuration and peer-dependency validation.
|
|
12
|
+
- **Interactive Versioning**: A CLI-guided versioning system that helps you bump package versions safely using SemVer standards.
|
|
13
|
+
|
|
14
|
+
## 🚀 Installation
|
|
15
|
+
|
|
16
|
+
Install the package as a development dependency:
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
npm install --save-dev @sse-ui/builder
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## 🛠 Usage
|
|
23
|
+
|
|
24
|
+
Once installed, you can access the utility via the `sse-tools` command.
|
|
25
|
+
|
|
26
|
+
### Core Commands
|
|
27
|
+
|
|
28
|
+
| Command | Description |
|
|
29
|
+
| --------------- | ------------------------------------------------------------------------------------ |
|
|
30
|
+
| `build` | Compiles the package for production using Babel or esbuild. |
|
|
31
|
+
| `watch` | Starts an incremental rebuild watcher for rapid development. |
|
|
32
|
+
| `typecheck` | Validates TypeScript types across the project without emitting files. |
|
|
33
|
+
| `check-exports` | Verifies that all files declared in package.json actually exist in the build folder. |
|
|
34
|
+
| `version` | Interactively bumps the package version (patch, minor, major). |
|
|
35
|
+
| `publish` | Publishes the built package directly from your specified build directory. |
|
|
36
|
+
| `info` | Displays size and file statistics for your built package. |
|
|
37
|
+
| `clean` | Safely removes the build directory to ensure a fresh start. |
|
|
38
|
+
|
|
39
|
+
## ⚙️ Configuration
|
|
40
|
+
|
|
41
|
+
`sse-tools` uses `c12` for robust configuration loading. You can define your configuration in `sse.config.ts`, `sse.config.js`, or within your `package.json`.
|
|
42
|
+
|
|
43
|
+
```typescript
|
|
44
|
+
import { defineConfig } from "@sse-ui/builder/config";
|
|
45
|
+
|
|
46
|
+
export default defineConfig({
|
|
47
|
+
bundle: ["esm", "cjs"],
|
|
48
|
+
buildTypes: true,
|
|
49
|
+
flat: false,
|
|
50
|
+
|
|
51
|
+
// Use esbuild for bundling single files
|
|
52
|
+
esbuild: {
|
|
53
|
+
entry: "src/index.ts",
|
|
54
|
+
target: "es2022",
|
|
55
|
+
},
|
|
56
|
+
});
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### Build Options
|
|
60
|
+
|
|
61
|
+
- `bundle`: Specify output formats, such as `["esm", "cjs"]`.
|
|
62
|
+
- `flat`: When enabled, builds a flat structure instead of using format-specific subdirectories.
|
|
63
|
+
- `copy`: Define an array of glob patterns to copy static assets or documentation into the build folder.
|
|
64
|
+
- `tsgo`: Toggle between `tsc` and `tsgo` for faster type generation.
|
|
65
|
+
|
|
66
|
+
## Docs
|
|
67
|
+
|
|
68
|
+
Go to the Docs [click here](./docs)
|
|
69
|
+
|
|
70
|
+
## Example
|
|
71
|
+
|
|
72
|
+
Go to the Example [Click Here](./example)
|
|
73
|
+
|
|
74
|
+
## 📄 License
|
|
75
|
+
|
|
76
|
+
This project is licensed under the `MIT` License.
|
package/dist/babel-config.js
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import "./chunk-MLKGABMK.js";
|
|
2
|
-
|
|
3
1
|
// src/babel-config.ts
|
|
4
2
|
import pluginTransformRuntime from "@ssets/babel/plugin/transform-runtime";
|
|
5
3
|
import presetEnv from "@ssets/babel/preset/env";
|
|
@@ -127,7 +125,9 @@ function getBaseConfig({
|
|
|
127
125
|
],
|
|
128
126
|
[presetTypescript]
|
|
129
127
|
],
|
|
130
|
-
plugins
|
|
128
|
+
plugins,
|
|
129
|
+
minified: process.env.SSE_MINIFY === "true",
|
|
130
|
+
shouldPrintComment: (val) => process.env.SSE_MINIFY !== "true" || /[@#]__PURE__|license|copyright/i.test(val)
|
|
131
131
|
};
|
|
132
132
|
}
|
|
133
133
|
function getBabelConfig(api) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
BASE_IGNORES
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-N46AJ2OI.js";
|
|
4
4
|
|
|
5
5
|
// src/utils/babel.ts
|
|
6
6
|
import { findWorkspacesRoot } from "find-workspaces";
|
|
@@ -8,6 +8,7 @@ import { $ } from "execa";
|
|
|
8
8
|
import { globby } from "globby";
|
|
9
9
|
import * as fs from "fs/promises";
|
|
10
10
|
import * as path from "path";
|
|
11
|
+
import chalk from "chalk";
|
|
11
12
|
var TO_TRANSFORM_EXTENSIONS = [".js", ".ts", ".tsx"];
|
|
12
13
|
function getVersionEnvVariables(pkgVersion) {
|
|
13
14
|
if (!pkgVersion) {
|
|
@@ -29,7 +30,7 @@ function getVersionEnvVariables(pkgVersion) {
|
|
|
29
30
|
async function cjsCopy({ from, to }) {
|
|
30
31
|
const exists = await fs.stat(to).then(() => true).catch(() => false);
|
|
31
32
|
if (!exists) {
|
|
32
|
-
console.warn(
|
|
33
|
+
console.warn(chalk.yellow(`\u26A0\uFE0F path ${to} does not exist`));
|
|
33
34
|
return;
|
|
34
35
|
}
|
|
35
36
|
const files = await globby("**/*.cjs", { cwd: from });
|
|
@@ -51,11 +52,14 @@ async function build({
|
|
|
51
52
|
removePropTypes = false,
|
|
52
53
|
verbose = false,
|
|
53
54
|
ignores = [],
|
|
54
|
-
reactCompiler
|
|
55
|
+
reactCompiler,
|
|
56
|
+
minify = false
|
|
55
57
|
}) {
|
|
56
58
|
if (verbose) {
|
|
57
59
|
console.log(
|
|
58
|
-
|
|
60
|
+
chalk.blue(
|
|
61
|
+
`Transpiling files to "${path.relative(path.dirname(sourceDir), outDir)}" for "${bundle}" bundle.`
|
|
62
|
+
)
|
|
59
63
|
);
|
|
60
64
|
}
|
|
61
65
|
const workspaceDir = await findWorkspacesRoot(cwd);
|
|
@@ -76,9 +80,11 @@ async function build({
|
|
|
76
80
|
SSE_OUT_FILE_EXTENSION: outExtension ?? ".js",
|
|
77
81
|
...getVersionEnvVariables(pkgVersion),
|
|
78
82
|
SSE_REACT_COMPILER: reactVersion ? "1" : "0",
|
|
79
|
-
SSE_REACT_COMPILER_REACT_VERSION: reactVersion
|
|
83
|
+
SSE_REACT_COMPILER_REACT_VERSION: reactVersion,
|
|
84
|
+
SSE_MINIFY: minify ? "true" : void 0
|
|
80
85
|
};
|
|
81
86
|
const resolvedOutExtension = outExtension ?? ".js";
|
|
87
|
+
const minifiedArgs = minify ? ["--minified"] : [];
|
|
82
88
|
const res = await $({
|
|
83
89
|
stdio: "inherit",
|
|
84
90
|
preferLocal: true,
|
|
@@ -87,7 +93,7 @@ async function build({
|
|
|
87
93
|
...process.env,
|
|
88
94
|
...env
|
|
89
95
|
}
|
|
90
|
-
})`babel --config-file ${configFile} --extensions ${TO_TRANSFORM_EXTENSIONS.join(
|
|
96
|
+
})`babel --config-file ${configFile} ${minifiedArgs} --extensions ${TO_TRANSFORM_EXTENSIONS.join(
|
|
91
97
|
","
|
|
92
98
|
)} ${sourceDir} --out-dir ${outDir} --ignore ${BASE_IGNORES.concat(
|
|
93
99
|
ignores
|
|
@@ -99,10 +105,9 @@ ${res.stderr}`
|
|
|
99
105
|
);
|
|
100
106
|
}
|
|
101
107
|
if (verbose) {
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
);
|
|
108
|
+
const output = res.stdout ? `
|
|
109
|
+
${res.stdout}` : "";
|
|
110
|
+
console.log(chalk.green(`\u2705 Babel compilation succeeded!${output}`));
|
|
106
111
|
}
|
|
107
112
|
}
|
|
108
113
|
|
|
@@ -4,6 +4,7 @@ import * as path from "path";
|
|
|
4
4
|
import { globby } from "globby";
|
|
5
5
|
import { minimatch } from "minimatch";
|
|
6
6
|
import * as semver from "semver";
|
|
7
|
+
import chalk from "chalk";
|
|
7
8
|
function getOutExtension(bundle, options = {}) {
|
|
8
9
|
const { isType = false, isFlat = false, packageType = "commonjs" } = options;
|
|
9
10
|
const normalizedPackageType = packageType === "module" ? "module" : "commonjs";
|
|
@@ -548,7 +549,8 @@ async function addLicense({
|
|
|
548
549
|
${content}`,
|
|
549
550
|
{ encoding: "utf8" }
|
|
550
551
|
);
|
|
551
|
-
if (process.env.SSE_BUILD_VERBOSE)
|
|
552
|
+
if (process.env.SSE_BUILD_VERBOSE)
|
|
553
|
+
console.log(chalk.gray(`License added to ${file}`));
|
|
552
554
|
}
|
|
553
555
|
async function writePackageJson({
|
|
554
556
|
packageJson,
|