@bamboocss/node 1.64.3 → 1.64.4

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/index.cjs CHANGED
@@ -5685,6 +5685,48 @@ var Builder = class {
5685
5685
  const bases = this.includeBases(ctx);
5686
5686
  return this.sourcePathsOf(absolutePath).some((source) => bases.some((base) => source === base.path || source.startsWith(base.prefix)) && isSource(this.sourcePath(ctx.runtime.path.relative(ctx.config.cwd, source))));
5687
5687
  };
5688
+ /** The packages the inventory holds files of, by name, for one inventory. @see isSourcePackage */
5689
+ sourcePackages;
5690
+ /**
5691
+ * @internal Whether a package is one the inventory holds files of — a workspace package `include`
5692
+ * reaches, such as a design system imported as `@acme/ds`. `true` before an inventory exists.
5693
+ *
5694
+ * What the Vite compiler asks of a module importing a package by name. A published package ships
5695
+ * its own output, but a call into this one folds against its source, and the compiled source no
5696
+ * longer defines what a module left uncompiled would call. Named as a workspace links a package:
5697
+ * by the nearest `package.json` above each file that has a name.
5698
+ */
5699
+ isSourcePackage = (name) => {
5700
+ const ctx = this.getContextOrThrow();
5701
+ const inventory = this.sourceInventory;
5702
+ if (!inventory) return true;
5703
+ if (this.sourcePackages?.inventory !== inventory) {
5704
+ const nameByDirectory = /* @__PURE__ */ new Map();
5705
+ const packageNameOf = (directory) => {
5706
+ if (nameByDirectory.has(directory)) return nameByDirectory.get(directory);
5707
+ let packageName;
5708
+ const manifest = (0, node_path.resolve)(directory, "package.json");
5709
+ if ((0, node_fs.existsSync)(manifest)) try {
5710
+ const parsed = JSON.parse((0, node_fs.readFileSync)(manifest, "utf8"));
5711
+ if (typeof parsed.name === "string") packageName = parsed.name;
5712
+ } catch {}
5713
+ const parent = (0, node_path.dirname)(directory);
5714
+ if (packageName === void 0 && parent !== directory) packageName = packageNameOf(parent);
5715
+ nameByDirectory.set(directory, packageName);
5716
+ return packageName;
5717
+ };
5718
+ const names = /* @__PURE__ */ new Set();
5719
+ for (const file of inventory) {
5720
+ const packageName = packageNameOf((0, node_path.dirname)(this.absOwner(ctx, file)));
5721
+ if (packageName) names.add(packageName);
5722
+ }
5723
+ this.sourcePackages = {
5724
+ inventory,
5725
+ names
5726
+ };
5727
+ }
5728
+ return this.sourcePackages.names.has(name);
5729
+ };
5688
5730
  /** The folders each context's `include` is globbed from. @see isPotentialSourceFile */
5689
5731
  includeBaseCache = /* @__PURE__ */ new WeakMap();
5690
5732
  includeBases = (ctx) => {
package/dist/index.d.cts CHANGED
@@ -950,6 +950,18 @@ declare class Builder {
950
950
  * compiling it is wasted — and with the TypeScript 7 backend, far from free.
951
951
  */
952
952
  isPotentialSourceFile: (filePath: string) => boolean;
953
+ /** The packages the inventory holds files of, by name, for one inventory. @see isSourcePackage */
954
+ private sourcePackages;
955
+ /**
956
+ * @internal Whether a package is one the inventory holds files of — a workspace package `include`
957
+ * reaches, such as a design system imported as `@acme/ds`. `true` before an inventory exists.
958
+ *
959
+ * What the Vite compiler asks of a module importing a package by name. A published package ships
960
+ * its own output, but a call into this one folds against its source, and the compiled source no
961
+ * longer defines what a module left uncompiled would call. Named as a workspace links a package:
962
+ * by the nearest `package.json` above each file that has a name.
963
+ */
964
+ isSourcePackage: (name: string) => boolean;
953
965
  /** The folders each context's `include` is globbed from. @see isPotentialSourceFile */
954
966
  private includeBaseCache;
955
967
  private includeBases;
package/dist/index.d.mts CHANGED
@@ -950,6 +950,18 @@ declare class Builder {
950
950
  * compiling it is wasted — and with the TypeScript 7 backend, far from free.
951
951
  */
952
952
  isPotentialSourceFile: (filePath: string) => boolean;
953
+ /** The packages the inventory holds files of, by name, for one inventory. @see isSourcePackage */
954
+ private sourcePackages;
955
+ /**
956
+ * @internal Whether a package is one the inventory holds files of — a workspace package `include`
957
+ * reaches, such as a design system imported as `@acme/ds`. `true` before an inventory exists.
958
+ *
959
+ * What the Vite compiler asks of a module importing a package by name. A published package ships
960
+ * its own output, but a call into this one folds against its source, and the compiled source no
961
+ * longer defines what a module left uncompiled would call. Named as a workspace links a package:
962
+ * by the nearest `package.json` above each file that has a name.
963
+ */
964
+ isSourcePackage: (name: string) => boolean;
953
965
  /** The folders each context's `include` is globbed from. @see isPotentialSourceFile */
954
966
  private includeBaseCache;
955
967
  private includeBases;
package/dist/index.mjs CHANGED
@@ -5674,6 +5674,48 @@ var Builder = class {
5674
5674
  const bases = this.includeBases(ctx);
5675
5675
  return this.sourcePathsOf(absolutePath).some((source) => bases.some((base) => source === base.path || source.startsWith(base.prefix)) && isSource(this.sourcePath(ctx.runtime.path.relative(ctx.config.cwd, source))));
5676
5676
  };
5677
+ /** The packages the inventory holds files of, by name, for one inventory. @see isSourcePackage */
5678
+ sourcePackages;
5679
+ /**
5680
+ * @internal Whether a package is one the inventory holds files of — a workspace package `include`
5681
+ * reaches, such as a design system imported as `@acme/ds`. `true` before an inventory exists.
5682
+ *
5683
+ * What the Vite compiler asks of a module importing a package by name. A published package ships
5684
+ * its own output, but a call into this one folds against its source, and the compiled source no
5685
+ * longer defines what a module left uncompiled would call. Named as a workspace links a package:
5686
+ * by the nearest `package.json` above each file that has a name.
5687
+ */
5688
+ isSourcePackage = (name) => {
5689
+ const ctx = this.getContextOrThrow();
5690
+ const inventory = this.sourceInventory;
5691
+ if (!inventory) return true;
5692
+ if (this.sourcePackages?.inventory !== inventory) {
5693
+ const nameByDirectory = /* @__PURE__ */ new Map();
5694
+ const packageNameOf = (directory) => {
5695
+ if (nameByDirectory.has(directory)) return nameByDirectory.get(directory);
5696
+ let packageName;
5697
+ const manifest = resolve(directory, "package.json");
5698
+ if (existsSync(manifest)) try {
5699
+ const parsed = JSON.parse(readFileSync(manifest, "utf8"));
5700
+ if (typeof parsed.name === "string") packageName = parsed.name;
5701
+ } catch {}
5702
+ const parent = dirname(directory);
5703
+ if (packageName === void 0 && parent !== directory) packageName = packageNameOf(parent);
5704
+ nameByDirectory.set(directory, packageName);
5705
+ return packageName;
5706
+ };
5707
+ const names = /* @__PURE__ */ new Set();
5708
+ for (const file of inventory) {
5709
+ const packageName = packageNameOf(dirname(this.absOwner(ctx, file)));
5710
+ if (packageName) names.add(packageName);
5711
+ }
5712
+ this.sourcePackages = {
5713
+ inventory,
5714
+ names
5715
+ };
5716
+ }
5717
+ return this.sourcePackages.names.has(name);
5718
+ };
5677
5719
  /** The folders each context's `include` is globbed from. @see isPotentialSourceFile */
5678
5720
  includeBaseCache = /* @__PURE__ */ new WeakMap();
5679
5721
  includeBases = (ctx) => {
Binary file
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bamboocss/node",
3
- "version": "1.64.3",
3
+ "version": "1.64.4",
4
4
  "description": "The core css bamboo library",
5
5
  "homepage": "https://bamboocss.com",
6
6
  "license": "MIT",
@@ -59,23 +59,23 @@
59
59
  "pkg-types": "2.3.0",
60
60
  "pluralize": "8.0.0",
61
61
  "ts-pattern": "5.9.0",
62
- "@bamboocss/config": "1.64.3",
63
- "@bamboocss/core": "1.64.3",
64
- "@bamboocss/generator": "1.64.3",
65
- "@bamboocss/logger": "1.64.3",
66
- "@bamboocss/plugin-svelte": "1.64.3",
67
- "@bamboocss/plugin-vue": "1.64.3",
68
- "@bamboocss/reporter": "1.64.3",
69
- "@bamboocss/shared": "1.64.3",
70
- "@bamboocss/token-dictionary": "1.64.3",
71
- "@bamboocss/types": "1.64.3"
62
+ "@bamboocss/config": "1.64.4",
63
+ "@bamboocss/core": "1.64.4",
64
+ "@bamboocss/generator": "1.64.4",
65
+ "@bamboocss/logger": "1.64.4",
66
+ "@bamboocss/plugin-svelte": "1.64.4",
67
+ "@bamboocss/plugin-vue": "1.64.4",
68
+ "@bamboocss/reporter": "1.64.4",
69
+ "@bamboocss/shared": "1.64.4",
70
+ "@bamboocss/token-dictionary": "1.64.4",
71
+ "@bamboocss/types": "1.64.4"
72
72
  },
73
73
  "devDependencies": {
74
74
  "@astrojs/compiler": "3.0.1",
75
75
  "@astrojs/compiler-rs": "0.5.1",
76
76
  "@types/picomatch": "4.0.2",
77
77
  "boxen": "8.0.1",
78
- "@bamboocss/native-extractor": "1.64.3"
78
+ "@bamboocss/native-extractor": "1.64.4"
79
79
  },
80
80
  "peerDependencies": {
81
81
  "@astrojs/compiler": ">=2",