@sse-ui/builder 1.1.0 → 1.2.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.
@@ -0,0 +1,12 @@
1
+ import {
2
+ build,
3
+ cjsCopy,
4
+ getVersionEnvVariables
5
+ } from "./chunk-MBPIJFGX.js";
6
+ import "./chunk-B6FMAT44.js";
7
+ import "./chunk-MLKGABMK.js";
8
+ export {
9
+ build,
10
+ cjsCopy,
11
+ getVersionEnvVariables
12
+ };
@@ -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
- "MUI_VERSION",
47
- "MUI_MAJOR_VERSION",
48
- "MUI_MINOR_VERSION",
49
- "MUI_PATCH_VERSION",
50
- "MUI_PRERELEASE"
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"
@@ -139,16 +141,16 @@ function getBabelConfig(api) {
139
141
  noResolveImports = api.noResolveImports || false;
140
142
  }
141
143
  return getBaseConfig({
142
- debug: process.env.MUI_BUILD_VERBOSE === "true",
144
+ debug: process.env.SSE_BUILD_VERBOSE === "true",
143
145
  bundle,
144
- outExtension: process.env.MUI_OUT_FILE_EXTENSION || null,
146
+ outExtension: process.env.SSE_OUT_FILE_EXTENSION || null,
145
147
  // any package needs to declare 7.25.0 as a runtime dependency. default is ^7.0.0
146
- runtimeVersion: process.env.MUI_BABEL_RUNTIME_VERSION || "^7.25.0",
147
- optimizeClsx: process.env.MUI_OPTIMIZE_CLSX === "true",
148
- removePropTypes: process.env.MUI_REMOVE_PROP_TYPES === "true",
148
+ runtimeVersion: process.env.SSE_BABEL_RUNTIME_VERSION || "^7.25.0",
149
+ optimizeClsx: process.env.SSE_OPTIMIZE_CLSX === "true",
150
+ removePropTypes: process.env.SSE_REMOVE_PROP_TYPES === "true",
149
151
  noResolveImports,
150
- reactCompilerReactVersion: process.env.MUI_REACT_COMPILER_REACT_VERSION,
151
- reactCompilerMode: process.env.MUI_REACT_COMPILER_MODE
152
+ reactCompilerReactVersion: process.env.SSE_REACT_COMPILER_REACT_VERSION,
153
+ reactCompilerMode: process.env.SSE_REACT_COMPILER_MODE
152
154
  });
153
155
  }
154
156
  export {
@@ -185,6 +185,7 @@ async function createPackageExports({
185
185
  const buildFiles = await globby("**/*", { cwd: scanDir });
186
186
  const jsDirs = /* @__PURE__ */ new Set();
187
187
  const otherFiles = /* @__PURE__ */ new Set();
188
+ let exportableFileCount = 0;
188
189
  for (const file of buildFiles) {
189
190
  if (file.endsWith(".d.ts") || file.endsWith(".d.mts") || file.endsWith(".d.cts")) {
190
191
  continue;
@@ -193,12 +194,15 @@ async function createPackageExports({
193
194
  const normalizedFile = file.split(path.sep).join(path.posix.sep);
194
195
  if (exportExtensions.includes(ext)) {
195
196
  jsDirs.add(path.posix.dirname(normalizedFile));
197
+ exportableFileCount++;
196
198
  } else {
199
+ if (normalizedFile.endsWith("package.json")) continue;
197
200
  otherFiles.add(normalizedFile);
198
201
  }
199
202
  }
200
203
  const getIndexFileName = (type) => `index${getOutExtension(type, { isFlat, packageType: resolvedPackageType })}`;
201
204
  const rootIndexExists = await fs.stat(path.join(scanDir, getIndexFileName(baseBundle.type))).then((s) => s.isFile()).catch(() => false);
205
+ const hasOnlyRootIndex = exportableFileCount === 1 && rootIndexExists;
202
206
  if (rootIndexExists && originalExports["."] === void 0) {
203
207
  newExports["."] ??= {};
204
208
  const rootConditions = newExports["."];
@@ -226,6 +230,9 @@ async function createPackageExports({
226
230
  }
227
231
  for (const dir of jsDirs) {
228
232
  const globKey = dir === "." ? "./*" : `./${dir}/*`;
233
+ if (dir === "." && hasOnlyRootIndex) {
234
+ continue;
235
+ }
229
236
  if (originalExports[globKey] === void 0) {
230
237
  newExports[globKey] ??= {};
231
238
  const globConditions = newExports[globKey];
@@ -336,17 +343,17 @@ async function createPackageExports({
336
343
  if (typeFileExists && type === "cjs") {
337
344
  result.types = typeExportDir;
338
345
  }
339
- const exportKeys2 = Object.keys(originalExports);
340
- for (const key2 of exportKeys2) {
341
- const importPath2 = originalExports[key2];
342
- if (!importPath2) {
343
- newExports[key2] = null;
346
+ const subExportKeys = Object.keys(originalExports);
347
+ for (const subKey of subExportKeys) {
348
+ const subImportPath = originalExports[subKey];
349
+ if (!subImportPath) {
350
+ newExports[subKey] = null;
344
351
  continue;
345
352
  }
346
- if (key2 === ".") continue;
353
+ if (subKey === ".") continue;
347
354
  await createExportsFor({
348
- importPath: importPath2,
349
- key: key2,
355
+ importPath: subImportPath,
356
+ key: subKey,
350
357
  cwd,
351
358
  dir,
352
359
  type,
@@ -361,6 +368,7 @@ async function createPackageExports({
361
368
  }
362
369
  bundles.forEach(({ dir }) => {
363
370
  if (dir !== ".") {
371
+ newExports[`./${dir}/package.json`] = null;
364
372
  newExports[`./${dir}`] = null;
365
373
  newExports[`./${dir}/*`] = null;
366
374
  }
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  BASE_IGNORES
3
- } from "./chunk-44E7L73Q.js";
3
+ } from "./chunk-B6FMAT44.js";
4
4
 
5
5
  // src/utils/babel.ts
6
6
  import { findWorkspacesRoot } from "find-workspaces";
@@ -19,11 +19,11 @@ function getVersionEnvVariables(pkgVersion) {
19
19
  throw new Error(`Couldn't parse version from package.json`);
20
20
  }
21
21
  return {
22
- MUI_VERSION: pkgVersion,
23
- MUI_MAJOR_VERSION: major,
24
- MUI_MINOR_VERSION: minor,
25
- MUI_PATCH_VERSION: patch,
26
- MUI_PRERELEASE: prerelease
22
+ SSE_VERSION: pkgVersion,
23
+ SSE_MAJOR_VERSION: major,
24
+ SSE_MINOR_VERSION: minor,
25
+ SSE_PATCH_VERSION: patch,
26
+ SSE_PRERELEASE: prerelease
27
27
  };
28
28
  }
29
29
  async function cjsCopy({ from, to }) {
@@ -53,9 +53,11 @@ async function build({
53
53
  ignores = [],
54
54
  reactCompiler
55
55
  }) {
56
- console.log(
57
- `Transpiling files to "${path.relative(path.dirname(sourceDir), outDir)}" for "${bundle}" bundle.`
58
- );
56
+ if (verbose) {
57
+ console.log(
58
+ `Transpiling files to "${path.relative(path.dirname(sourceDir), outDir)}" for "${bundle}" bundle.`
59
+ );
60
+ }
59
61
  const workspaceDir = await findWorkspacesRoot(cwd);
60
62
  const rootDir = workspaceDir ? workspaceDir.location : cwd;
61
63
  let configFile = path.join(rootDir, "babel.config.js");
@@ -67,14 +69,14 @@ async function build({
67
69
  const env = {
68
70
  NODE_ENV: "production",
69
71
  BABEL_ENV: bundle === "esm" ? "stable" : "node",
70
- MUI_BUILD_VERBOSE: verbose ? "true" : void 0,
71
- MUI_OPTIMIZE_CLSX: optimizeClsx ? "true" : void 0,
72
- MUI_REMOVE_PROP_TYPES: removePropTypes ? "true" : void 0,
73
- MUI_BABEL_RUNTIME_VERSION: babelRuntimeVersion,
74
- MUI_OUT_FILE_EXTENSION: outExtension ?? ".js",
72
+ SSE_BUILD_VERBOSE: verbose ? "true" : void 0,
73
+ SSE_OPTIMIZE_CLSX: optimizeClsx ? "true" : void 0,
74
+ SSE_REMOVE_PROP_TYPES: removePropTypes ? "true" : void 0,
75
+ SSE_BABEL_RUNTIME_VERSION: babelRuntimeVersion,
76
+ SSE_OUT_FILE_EXTENSION: outExtension ?? ".js",
75
77
  ...getVersionEnvVariables(pkgVersion),
76
- MUI_REACT_COMPILER: reactVersion ? "1" : "0",
77
- MUI_REACT_COMPILER_REACT_VERSION: reactVersion
78
+ SSE_REACT_COMPILER: reactVersion ? "1" : "0",
79
+ SSE_REACT_COMPILER_REACT_VERSION: reactVersion
78
80
  };
79
81
  const resolvedOutExtension = outExtension ?? ".js";
80
82
  const res = await $({
@@ -103,8 +105,9 @@ ${res.stdout}`
103
105
  );
104
106
  }
105
107
  }
108
+
106
109
  export {
107
- build,
110
+ getVersionEnvVariables,
108
111
  cjsCopy,
109
- getVersionEnvVariables
112
+ build
110
113
  };
@@ -0,0 +1,9 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __export = (target, all) => {
3
+ for (var name in all)
4
+ __defProp(target, name, { get: all[name], enumerable: true });
5
+ };
6
+
7
+ export {
8
+ __export
9
+ };