robuild 0.0.9 → 0.0.10

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.
@@ -1043,11 +1043,48 @@ async function rolldownBuild(ctx, entry, hooks, config) {
1043
1043
  }
1044
1044
  return;
1045
1045
  }
1046
- const externalDeps = [
1046
+ let externalDeps = [
1047
1047
  ...builtinModules,
1048
1048
  ...builtinModules.map((m) => `node:${m}`),
1049
1049
  ...[...Object.keys(ctx.pkg.dependencies || {}), ...Object.keys(ctx.pkg.peerDependencies || {})].flatMap((p) => [p, /* @__PURE__ */ new RegExp(`^${p}/`)])
1050
1050
  ];
1051
+ if (entry.noExternal) {
1052
+ const escapeRegExp = (s) => s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
1053
+ if (typeof entry.noExternal === "function") {
1054
+ const predicate = entry.noExternal;
1055
+ const depNames = [...Object.keys(ctx.pkg.dependencies || {}), ...Object.keys(ctx.pkg.peerDependencies || {})];
1056
+ const excludedNames = /* @__PURE__ */ new Set();
1057
+ for (const name of depNames) try {
1058
+ if (predicate(name)) excludedNames.add(name);
1059
+ } catch {}
1060
+ externalDeps = externalDeps.filter((dep) => {
1061
+ if (typeof dep === "string") return !excludedNames.has(dep);
1062
+ if (dep instanceof RegExp) {
1063
+ for (const name of excludedNames) if (dep.source.startsWith(`^${escapeRegExp(name)}/`)) return false;
1064
+ return true;
1065
+ }
1066
+ return true;
1067
+ });
1068
+ } else if (Array.isArray(entry.noExternal)) {
1069
+ const rules = entry.noExternal;
1070
+ externalDeps = externalDeps.filter((dep) => {
1071
+ for (const rule of rules) if (typeof rule === "string") {
1072
+ if (typeof dep === "string") {
1073
+ if (dep === rule) return false;
1074
+ } else if (dep instanceof RegExp) {
1075
+ if (dep.source.startsWith(`^${escapeRegExp(rule)}/`)) return false;
1076
+ }
1077
+ } else if (rule instanceof RegExp) {
1078
+ if (typeof dep === "string") {
1079
+ if (rule.test(dep)) return false;
1080
+ } else if (dep instanceof RegExp) {
1081
+ if (dep.source === rule.source && dep.flags === rule.flags) return false;
1082
+ }
1083
+ }
1084
+ return true;
1085
+ });
1086
+ }
1087
+ }
1051
1088
  if (entry.external) if (typeof entry.external === "function") {} else externalDeps.push(...entry.external);
1052
1089
  const defineOptions = {};
1053
1090
  if (entry.env) for (const [key, value] of Object.entries(entry.env)) defineOptions[`process.env.${key}`] = JSON.stringify(value);
@@ -1,7 +1,7 @@
1
1
  //#region package.json
2
2
  var name = "robuild";
3
3
  var type = "module";
4
- var version = "0.0.9";
4
+ var version = "0.0.10";
5
5
  var packageManager = "pnpm@10.11.1";
6
6
  var description = "Zero-config ESM/TS package builder. Powered by Rolldown and Oxc";
7
7
  var license = "MIT";
package/dist/cli.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { build } from "./_chunks/build-BwB_tOe9.mjs";
2
+ import { build } from "./_chunks/build-C8jF81Ux.mjs";
3
3
  import { consola } from "consola";
4
4
  import { parseArgs } from "node:util";
5
5
  import { loadConfig } from "c12";
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { build } from "./_chunks/build-BwB_tOe9.mjs";
1
+ import { build } from "./_chunks/build-C8jF81Ux.mjs";
2
2
  import { defineConfig } from "./_chunks/config-B_2eqpNJ.mjs";
3
3
 
4
4
  export { build, defineConfig };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "robuild",
3
3
  "type": "module",
4
- "version": "0.0.9",
4
+ "version": "0.0.10",
5
5
  "packageManager": "pnpm@10.11.1",
6
6
  "description": "Zero-config ESM/TS package builder. Powered by Rolldown and Oxc",
7
7
  "license": "MIT",