@bamboocss/node 1.48.1 → 1.48.2

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
@@ -3268,6 +3268,48 @@ const assembleExtractedSheet = (ctx, { layerParams = false, sourceScanCache, mti
3268
3268
  //#endregion
3269
3269
  //#region src/builder.ts
3270
3270
  const fileModifiedMap = /* @__PURE__ */ new Map();
3271
+ /** Binary minimum heap; callers provide the stable semantic rank used for ties/order. */
3272
+ var MinPriorityQueue = class {
3273
+ compare;
3274
+ values = [];
3275
+ constructor(compare) {
3276
+ this.compare = compare;
3277
+ }
3278
+ get size() {
3279
+ return this.values.length;
3280
+ }
3281
+ push = (value) => {
3282
+ let index = this.values.length;
3283
+ this.values.push(value);
3284
+ while (index > 0) {
3285
+ const parent = index - 1 >> 1;
3286
+ const parentValue = this.values[parent];
3287
+ if (this.compare(value, parentValue) >= 0) break;
3288
+ this.values[index] = parentValue;
3289
+ index = parent;
3290
+ }
3291
+ this.values[index] = value;
3292
+ };
3293
+ pop = () => {
3294
+ if (!this.values.length) return void 0;
3295
+ const first = this.values[0];
3296
+ const last = this.values.pop();
3297
+ if (!this.values.length) return first;
3298
+ let index = 0;
3299
+ while (true) {
3300
+ const left = index * 2 + 1;
3301
+ if (left >= this.values.length) break;
3302
+ const right = left + 1;
3303
+ let next = left;
3304
+ if (right < this.values.length && this.compare(this.values[right], this.values[left]) < 0) next = right;
3305
+ if (this.compare(last, this.values[next]) <= 0) break;
3306
+ this.values[index] = this.values[next];
3307
+ index = next;
3308
+ }
3309
+ this.values[index] = last;
3310
+ return first;
3311
+ };
3312
+ };
3271
3313
  var Builder = class {
3272
3314
  /**
3273
3315
  * The current bamboo context
@@ -3606,21 +3648,21 @@ var Builder = class {
3606
3648
  for (const fact of ledger) addEdge(fact.target, fact.importer);
3607
3649
  for (const [target, importer] of syntheticEdges) addEdge(target, importer);
3608
3650
  const compare = (left, right) => (inventoryRank.get(left) ?? 0) - (inventoryRank.get(right) ?? 0);
3609
- const ready = [...indegree].filter(([, degree]) => degree === 0).map(([file]) => file).sort(compare);
3651
+ const ready = new MinPriorityQueue(compare);
3652
+ for (const [file, degree] of indegree) if (degree === 0) ready.push(file);
3610
3653
  const ordered = [];
3611
- while (ready.length) {
3612
- const file = ready.shift();
3654
+ const emitted = /* @__PURE__ */ new Set();
3655
+ while (ready.size) {
3656
+ const file = ready.pop();
3613
3657
  ordered.push(file);
3614
- for (const importer of [...outgoing.get(file) ?? []].sort(compare)) {
3658
+ emitted.add(file);
3659
+ for (const importer of outgoing.get(file) ?? []) {
3615
3660
  const next = (indegree.get(importer) ?? 0) - 1;
3616
3661
  indegree.set(importer, next);
3617
- if (next === 0) {
3618
- ready.push(importer);
3619
- ready.sort(compare);
3620
- }
3662
+ if (next === 0) ready.push(importer);
3621
3663
  }
3622
3664
  }
3623
- for (const file of [...byPath.keys()].sort(compare)) if (!ordered.includes(file)) ordered.push(file);
3665
+ for (const file of byPath.keys()) if (!emitted.has(file)) ordered.push(file);
3624
3666
  return ordered.map((file) => byPath.get(file));
3625
3667
  };
3626
3668
  /**
package/dist/index.mjs CHANGED
@@ -3256,6 +3256,48 @@ const assembleExtractedSheet = (ctx, { layerParams = false, sourceScanCache, mti
3256
3256
  //#endregion
3257
3257
  //#region src/builder.ts
3258
3258
  const fileModifiedMap = /* @__PURE__ */ new Map();
3259
+ /** Binary minimum heap; callers provide the stable semantic rank used for ties/order. */
3260
+ var MinPriorityQueue = class {
3261
+ compare;
3262
+ values = [];
3263
+ constructor(compare) {
3264
+ this.compare = compare;
3265
+ }
3266
+ get size() {
3267
+ return this.values.length;
3268
+ }
3269
+ push = (value) => {
3270
+ let index = this.values.length;
3271
+ this.values.push(value);
3272
+ while (index > 0) {
3273
+ const parent = index - 1 >> 1;
3274
+ const parentValue = this.values[parent];
3275
+ if (this.compare(value, parentValue) >= 0) break;
3276
+ this.values[index] = parentValue;
3277
+ index = parent;
3278
+ }
3279
+ this.values[index] = value;
3280
+ };
3281
+ pop = () => {
3282
+ if (!this.values.length) return void 0;
3283
+ const first = this.values[0];
3284
+ const last = this.values.pop();
3285
+ if (!this.values.length) return first;
3286
+ let index = 0;
3287
+ while (true) {
3288
+ const left = index * 2 + 1;
3289
+ if (left >= this.values.length) break;
3290
+ const right = left + 1;
3291
+ let next = left;
3292
+ if (right < this.values.length && this.compare(this.values[right], this.values[left]) < 0) next = right;
3293
+ if (this.compare(last, this.values[next]) <= 0) break;
3294
+ this.values[index] = this.values[next];
3295
+ index = next;
3296
+ }
3297
+ this.values[index] = last;
3298
+ return first;
3299
+ };
3300
+ };
3259
3301
  var Builder = class {
3260
3302
  /**
3261
3303
  * The current bamboo context
@@ -3594,21 +3636,21 @@ var Builder = class {
3594
3636
  for (const fact of ledger) addEdge(fact.target, fact.importer);
3595
3637
  for (const [target, importer] of syntheticEdges) addEdge(target, importer);
3596
3638
  const compare = (left, right) => (inventoryRank.get(left) ?? 0) - (inventoryRank.get(right) ?? 0);
3597
- const ready = [...indegree].filter(([, degree]) => degree === 0).map(([file]) => file).sort(compare);
3639
+ const ready = new MinPriorityQueue(compare);
3640
+ for (const [file, degree] of indegree) if (degree === 0) ready.push(file);
3598
3641
  const ordered = [];
3599
- while (ready.length) {
3600
- const file = ready.shift();
3642
+ const emitted = /* @__PURE__ */ new Set();
3643
+ while (ready.size) {
3644
+ const file = ready.pop();
3601
3645
  ordered.push(file);
3602
- for (const importer of [...outgoing.get(file) ?? []].sort(compare)) {
3646
+ emitted.add(file);
3647
+ for (const importer of outgoing.get(file) ?? []) {
3603
3648
  const next = (indegree.get(importer) ?? 0) - 1;
3604
3649
  indegree.set(importer, next);
3605
- if (next === 0) {
3606
- ready.push(importer);
3607
- ready.sort(compare);
3608
- }
3650
+ if (next === 0) ready.push(importer);
3609
3651
  }
3610
3652
  }
3611
- for (const file of [...byPath.keys()].sort(compare)) if (!ordered.includes(file)) ordered.push(file);
3653
+ for (const file of byPath.keys()) if (!emitted.has(file)) ordered.push(file);
3612
3654
  return ordered.map((file) => byPath.get(file));
3613
3655
  };
3614
3656
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bamboocss/node",
3
- "version": "1.48.1",
3
+ "version": "1.48.2",
4
4
  "description": "The core css bamboo library",
5
5
  "homepage": "https://bamboocss.com",
6
6
  "license": "MIT",
@@ -62,17 +62,17 @@
62
62
  "pluralize": "8.0.0",
63
63
  "ts-morph": "28.0.0",
64
64
  "ts-pattern": "5.9.0",
65
- "@bamboocss/config": "1.48.1",
66
- "@bamboocss/core": "1.48.1",
67
- "@bamboocss/generator": "1.48.1",
68
- "@bamboocss/logger": "1.48.1",
69
- "@bamboocss/parser": "1.48.1",
70
- "@bamboocss/plugin-svelte": "1.48.1",
71
- "@bamboocss/plugin-vue": "1.48.1",
72
- "@bamboocss/reporter": "1.48.1",
73
- "@bamboocss/shared": "1.48.1",
74
- "@bamboocss/token-dictionary": "1.48.1",
75
- "@bamboocss/types": "1.48.1"
65
+ "@bamboocss/config": "1.48.2",
66
+ "@bamboocss/core": "1.48.2",
67
+ "@bamboocss/generator": "1.48.2",
68
+ "@bamboocss/logger": "1.48.2",
69
+ "@bamboocss/parser": "1.48.2",
70
+ "@bamboocss/plugin-svelte": "1.48.2",
71
+ "@bamboocss/plugin-vue": "1.48.2",
72
+ "@bamboocss/reporter": "1.48.2",
73
+ "@bamboocss/shared": "1.48.2",
74
+ "@bamboocss/token-dictionary": "1.48.2",
75
+ "@bamboocss/types": "1.48.2"
76
76
  },
77
77
  "devDependencies": {
78
78
  "@types/fs-extra": "11.0.4",