@sse-ui/builder 1.1.0 → 1.3.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/dist/acorn-RZKYEOCN.js +3130 -0
- package/dist/angular-65ZVA2AO.js +3070 -0
- package/dist/babel-6NAC7UZ3.js +7296 -0
- package/dist/babel-6NHCDM3A.js +12 -0
- package/dist/babel-config.js +17 -13
- package/dist/{babel-QBNMMXUJ.js → chunk-6NNEV5YX.js} +33 -25
- package/dist/chunk-MLKGABMK.js +9 -0
- package/dist/{chunk-44E7L73Q.js → chunk-N46AJ2OI.js} +19 -9
- package/dist/cli.js +727 -365
- package/dist/config.d.ts +48 -36
- package/dist/config.js +2 -0
- package/dist/estree-SLPC3MKU.js +4612 -0
- package/dist/flow-JKSA2WQA.js +27546 -0
- package/dist/glimmer-KH4FHVWK.js +2894 -0
- package/dist/graphql-X7RDVKKC.js +1266 -0
- package/dist/html-A2DZMMEZ.js +2933 -0
- package/dist/markdown-35RS3VXW.js +3553 -0
- package/dist/meriyah-UIMGFPH2.js +2684 -0
- package/dist/postcss-CITECRUH.js +5080 -0
- package/dist/typescript-42L4XZEH.js +20538 -0
- package/dist/typescript-CFZSZQGQ.js +13203 -0
- package/dist/yaml-RAY3ED75.js +4224 -0
- package/package.json +16 -5
- package/dist/typescript-3J237V7Q.js +0 -217
package/dist/babel-config.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import "./chunk-MLKGABMK.js";
|
|
2
|
+
|
|
1
3
|
// src/babel-config.ts
|
|
2
4
|
import pluginTransformRuntime from "@ssets/babel/plugin/transform-runtime";
|
|
3
5
|
import presetEnv from "@ssets/babel/preset/env";
|
|
@@ -43,11 +45,11 @@ function getBaseConfig({
|
|
|
43
45
|
pluginTransformInlineEnvVars,
|
|
44
46
|
{
|
|
45
47
|
include: [
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
"
|
|
48
|
+
"SSE_VERSION",
|
|
49
|
+
"SSE_MAJOR_VERSION",
|
|
50
|
+
"SSE_MINOR_VERSION",
|
|
51
|
+
"SSE_PATCH_VERSION",
|
|
52
|
+
"SSE_PRERELEASE"
|
|
51
53
|
]
|
|
52
54
|
},
|
|
53
55
|
"babel-plugin-transform-inline-environment-variables"
|
|
@@ -125,7 +127,9 @@ function getBaseConfig({
|
|
|
125
127
|
],
|
|
126
128
|
[presetTypescript]
|
|
127
129
|
],
|
|
128
|
-
plugins
|
|
130
|
+
plugins,
|
|
131
|
+
minified: process.env.SSE_MINIFY === "true",
|
|
132
|
+
shouldPrintComment: (val) => process.env.SSE_MINIFY !== "true" || /[@#]__PURE__|license|copyright/i.test(val)
|
|
129
133
|
};
|
|
130
134
|
}
|
|
131
135
|
function getBabelConfig(api) {
|
|
@@ -139,16 +143,16 @@ function getBabelConfig(api) {
|
|
|
139
143
|
noResolveImports = api.noResolveImports || false;
|
|
140
144
|
}
|
|
141
145
|
return getBaseConfig({
|
|
142
|
-
debug: process.env.
|
|
146
|
+
debug: process.env.SSE_BUILD_VERBOSE === "true",
|
|
143
147
|
bundle,
|
|
144
|
-
outExtension: process.env.
|
|
148
|
+
outExtension: process.env.SSE_OUT_FILE_EXTENSION || null,
|
|
145
149
|
// any package needs to declare 7.25.0 as a runtime dependency. default is ^7.0.0
|
|
146
|
-
runtimeVersion: process.env.
|
|
147
|
-
optimizeClsx: process.env.
|
|
148
|
-
removePropTypes: process.env.
|
|
150
|
+
runtimeVersion: process.env.SSE_BABEL_RUNTIME_VERSION || "^7.25.0",
|
|
151
|
+
optimizeClsx: process.env.SSE_OPTIMIZE_CLSX === "true",
|
|
152
|
+
removePropTypes: process.env.SSE_REMOVE_PROP_TYPES === "true",
|
|
149
153
|
noResolveImports,
|
|
150
|
-
reactCompilerReactVersion: process.env.
|
|
151
|
-
reactCompilerMode: process.env.
|
|
154
|
+
reactCompilerReactVersion: process.env.SSE_REACT_COMPILER_REACT_VERSION,
|
|
155
|
+
reactCompilerMode: process.env.SSE_REACT_COMPILER_MODE
|
|
152
156
|
});
|
|
153
157
|
}
|
|
154
158
|
export {
|
|
@@ -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) {
|
|
@@ -19,17 +20,17 @@ function getVersionEnvVariables(pkgVersion) {
|
|
|
19
20
|
throw new Error(`Couldn't parse version from package.json`);
|
|
20
21
|
}
|
|
21
22
|
return {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
SSE_VERSION: pkgVersion,
|
|
24
|
+
SSE_MAJOR_VERSION: major,
|
|
25
|
+
SSE_MINOR_VERSION: minor,
|
|
26
|
+
SSE_PATCH_VERSION: patch,
|
|
27
|
+
SSE_PRERELEASE: prerelease
|
|
27
28
|
};
|
|
28
29
|
}
|
|
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,16 @@ async function build({
|
|
|
51
52
|
removePropTypes = false,
|
|
52
53
|
verbose = false,
|
|
53
54
|
ignores = [],
|
|
54
|
-
reactCompiler
|
|
55
|
+
reactCompiler,
|
|
56
|
+
minify = false
|
|
55
57
|
}) {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
58
|
+
if (verbose) {
|
|
59
|
+
console.log(
|
|
60
|
+
chalk.blue(
|
|
61
|
+
`Transpiling files to "${path.relative(path.dirname(sourceDir), outDir)}" for "${bundle}" bundle.`
|
|
62
|
+
)
|
|
63
|
+
);
|
|
64
|
+
}
|
|
59
65
|
const workspaceDir = await findWorkspacesRoot(cwd);
|
|
60
66
|
const rootDir = workspaceDir ? workspaceDir.location : cwd;
|
|
61
67
|
let configFile = path.join(rootDir, "babel.config.js");
|
|
@@ -67,16 +73,18 @@ async function build({
|
|
|
67
73
|
const env = {
|
|
68
74
|
NODE_ENV: "production",
|
|
69
75
|
BABEL_ENV: bundle === "esm" ? "stable" : "node",
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
76
|
+
SSE_BUILD_VERBOSE: verbose ? "true" : void 0,
|
|
77
|
+
SSE_OPTIMIZE_CLSX: optimizeClsx ? "true" : void 0,
|
|
78
|
+
SSE_REMOVE_PROP_TYPES: removePropTypes ? "true" : void 0,
|
|
79
|
+
SSE_BABEL_RUNTIME_VERSION: babelRuntimeVersion,
|
|
80
|
+
SSE_OUT_FILE_EXTENSION: outExtension ?? ".js",
|
|
75
81
|
...getVersionEnvVariables(pkgVersion),
|
|
76
|
-
|
|
77
|
-
|
|
82
|
+
SSE_REACT_COMPILER: reactVersion ? "1" : "0",
|
|
83
|
+
SSE_REACT_COMPILER_REACT_VERSION: reactVersion,
|
|
84
|
+
SSE_MINIFY: minify ? "true" : void 0
|
|
78
85
|
};
|
|
79
86
|
const resolvedOutExtension = outExtension ?? ".js";
|
|
87
|
+
const minifiedArgs = minify ? ["--minified"] : [];
|
|
80
88
|
const res = await $({
|
|
81
89
|
stdio: "inherit",
|
|
82
90
|
preferLocal: true,
|
|
@@ -85,7 +93,7 @@ async function build({
|
|
|
85
93
|
...process.env,
|
|
86
94
|
...env
|
|
87
95
|
}
|
|
88
|
-
})`babel --config-file ${configFile} --extensions ${TO_TRANSFORM_EXTENSIONS.join(
|
|
96
|
+
})`babel --config-file ${configFile} ${minifiedArgs} --extensions ${TO_TRANSFORM_EXTENSIONS.join(
|
|
89
97
|
","
|
|
90
98
|
)} ${sourceDir} --out-dir ${outDir} --ignore ${BASE_IGNORES.concat(
|
|
91
99
|
ignores
|
|
@@ -97,14 +105,14 @@ ${res.stderr}`
|
|
|
97
105
|
);
|
|
98
106
|
}
|
|
99
107
|
if (verbose) {
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
);
|
|
108
|
+
const output = res.stdout ? `
|
|
109
|
+
${res.stdout}` : "";
|
|
110
|
+
console.log(chalk.green(`\u2705 Babel compilation succeeded!${output}`));
|
|
104
111
|
}
|
|
105
112
|
}
|
|
113
|
+
|
|
106
114
|
export {
|
|
107
|
-
|
|
115
|
+
getVersionEnvVariables,
|
|
108
116
|
cjsCopy,
|
|
109
|
-
|
|
117
|
+
build
|
|
110
118
|
};
|
|
@@ -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";
|
|
@@ -185,6 +186,7 @@ async function createPackageExports({
|
|
|
185
186
|
const buildFiles = await globby("**/*", { cwd: scanDir });
|
|
186
187
|
const jsDirs = /* @__PURE__ */ new Set();
|
|
187
188
|
const otherFiles = /* @__PURE__ */ new Set();
|
|
189
|
+
let exportableFileCount = 0;
|
|
188
190
|
for (const file of buildFiles) {
|
|
189
191
|
if (file.endsWith(".d.ts") || file.endsWith(".d.mts") || file.endsWith(".d.cts")) {
|
|
190
192
|
continue;
|
|
@@ -193,12 +195,15 @@ async function createPackageExports({
|
|
|
193
195
|
const normalizedFile = file.split(path.sep).join(path.posix.sep);
|
|
194
196
|
if (exportExtensions.includes(ext)) {
|
|
195
197
|
jsDirs.add(path.posix.dirname(normalizedFile));
|
|
198
|
+
exportableFileCount++;
|
|
196
199
|
} else {
|
|
200
|
+
if (normalizedFile.endsWith("package.json")) continue;
|
|
197
201
|
otherFiles.add(normalizedFile);
|
|
198
202
|
}
|
|
199
203
|
}
|
|
200
204
|
const getIndexFileName = (type) => `index${getOutExtension(type, { isFlat, packageType: resolvedPackageType })}`;
|
|
201
205
|
const rootIndexExists = await fs.stat(path.join(scanDir, getIndexFileName(baseBundle.type))).then((s) => s.isFile()).catch(() => false);
|
|
206
|
+
const hasOnlyRootIndex = exportableFileCount === 1 && rootIndexExists;
|
|
202
207
|
if (rootIndexExists && originalExports["."] === void 0) {
|
|
203
208
|
newExports["."] ??= {};
|
|
204
209
|
const rootConditions = newExports["."];
|
|
@@ -226,6 +231,9 @@ async function createPackageExports({
|
|
|
226
231
|
}
|
|
227
232
|
for (const dir of jsDirs) {
|
|
228
233
|
const globKey = dir === "." ? "./*" : `./${dir}/*`;
|
|
234
|
+
if (dir === "." && hasOnlyRootIndex) {
|
|
235
|
+
continue;
|
|
236
|
+
}
|
|
229
237
|
if (originalExports[globKey] === void 0) {
|
|
230
238
|
newExports[globKey] ??= {};
|
|
231
239
|
const globConditions = newExports[globKey];
|
|
@@ -336,17 +344,17 @@ async function createPackageExports({
|
|
|
336
344
|
if (typeFileExists && type === "cjs") {
|
|
337
345
|
result.types = typeExportDir;
|
|
338
346
|
}
|
|
339
|
-
const
|
|
340
|
-
for (const
|
|
341
|
-
const
|
|
342
|
-
if (!
|
|
343
|
-
newExports[
|
|
347
|
+
const subExportKeys = Object.keys(originalExports);
|
|
348
|
+
for (const subKey of subExportKeys) {
|
|
349
|
+
const subImportPath = originalExports[subKey];
|
|
350
|
+
if (!subImportPath) {
|
|
351
|
+
newExports[subKey] = null;
|
|
344
352
|
continue;
|
|
345
353
|
}
|
|
346
|
-
if (
|
|
354
|
+
if (subKey === ".") continue;
|
|
347
355
|
await createExportsFor({
|
|
348
|
-
importPath:
|
|
349
|
-
key:
|
|
356
|
+
importPath: subImportPath,
|
|
357
|
+
key: subKey,
|
|
350
358
|
cwd,
|
|
351
359
|
dir,
|
|
352
360
|
type,
|
|
@@ -361,6 +369,7 @@ async function createPackageExports({
|
|
|
361
369
|
}
|
|
362
370
|
bundles.forEach(({ dir }) => {
|
|
363
371
|
if (dir !== ".") {
|
|
372
|
+
newExports[`./${dir}/package.json`] = null;
|
|
364
373
|
newExports[`./${dir}`] = null;
|
|
365
374
|
newExports[`./${dir}/*`] = null;
|
|
366
375
|
}
|
|
@@ -540,7 +549,8 @@ async function addLicense({
|
|
|
540
549
|
${content}`,
|
|
541
550
|
{ encoding: "utf8" }
|
|
542
551
|
);
|
|
543
|
-
if (process.env.SSE_BUILD_VERBOSE)
|
|
552
|
+
if (process.env.SSE_BUILD_VERBOSE)
|
|
553
|
+
console.log(chalk.gray(`License added to ${file}`));
|
|
544
554
|
}
|
|
545
555
|
async function writePackageJson({
|
|
546
556
|
packageJson,
|