@bamboocss/node 1.20.0 → 1.20.1
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 +29 -0
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +28 -0
- package/package.json +13 -13
package/dist/index.cjs
CHANGED
|
@@ -28,6 +28,8 @@ let _bamboocss_config = require("@bamboocss/config");
|
|
|
28
28
|
let _bamboocss_shared = require("@bamboocss/shared");
|
|
29
29
|
let fs = require("fs");
|
|
30
30
|
let path = require("path");
|
|
31
|
+
let postcss = require("postcss");
|
|
32
|
+
postcss = __toESM(postcss);
|
|
31
33
|
let _bamboocss_plugin_lightningcss = require("@bamboocss/plugin-lightningcss");
|
|
32
34
|
let _bamboocss_plugin_svelte = require("@bamboocss/plugin-svelte");
|
|
33
35
|
let _bamboocss_plugin_vue = require("@bamboocss/plugin-vue");
|
|
@@ -2238,6 +2240,30 @@ const keyframeNames = (ctx) => Object.keys(ctx.config.theme?.keyframes ?? {});
|
|
|
2238
2240
|
//#endregion
|
|
2239
2241
|
//#region src/builder.ts
|
|
2240
2242
|
const fileModifiedMap = /* @__PURE__ */ new Map();
|
|
2243
|
+
/**
|
|
2244
|
+
* Bracket the css `write` injects, so a second pass replaces it instead of adding to it.
|
|
2245
|
+
*
|
|
2246
|
+
* Comments rather than a node flag: the root can be stringified and re-parsed between two
|
|
2247
|
+
* plugins in the same chain, and nothing on the node itself survives that round trip.
|
|
2248
|
+
*/
|
|
2249
|
+
const INJECTED_START = "bamboocss:start";
|
|
2250
|
+
const INJECTED_END = "bamboocss:end";
|
|
2251
|
+
/**
|
|
2252
|
+
* Remove a previously injected block, markers included.
|
|
2253
|
+
*
|
|
2254
|
+
* Bounded by the end marker rather than running to the end of the root, so anything a later
|
|
2255
|
+
* plugin appended after the injection is left where it is. A start marker with no end -- the
|
|
2256
|
+
* shape a minifier that strips comments unevenly could leave behind -- removes nothing,
|
|
2257
|
+
* which is the safe direction: a duplicate is a size problem, dropping a user's css is not.
|
|
2258
|
+
*/
|
|
2259
|
+
function dropPreviousInjection(root) {
|
|
2260
|
+
const nodes = root.nodes ?? [];
|
|
2261
|
+
const start = nodes.findIndex((n) => n.type === "comment" && n.text === INJECTED_START);
|
|
2262
|
+
if (start < 0) return;
|
|
2263
|
+
const end = nodes.findIndex((n, i) => i > start && n.type === "comment" && n.text === INJECTED_END);
|
|
2264
|
+
if (end < 0) return;
|
|
2265
|
+
for (const node of nodes.slice(start, end + 1)) node.remove();
|
|
2266
|
+
}
|
|
2241
2267
|
var Builder = class {
|
|
2242
2268
|
/**
|
|
2243
2269
|
* The current bamboo context
|
|
@@ -2381,7 +2407,10 @@ var Builder = class {
|
|
|
2381
2407
|
else ctx.pruneTokens(sheet);
|
|
2382
2408
|
if (ctx.config.pruneUnusedKeyframes) ctx.pruneKeyframes(sheet, collectKeyframeReferences(ctx, keyframeNames(ctx)));
|
|
2383
2409
|
const css = ctx.getCss(sheet);
|
|
2410
|
+
dropPreviousInjection(root);
|
|
2411
|
+
root.append(postcss.default.comment({ text: INJECTED_START }));
|
|
2384
2412
|
root.append(css);
|
|
2413
|
+
root.append(postcss.default.comment({ text: INJECTED_END }));
|
|
2385
2414
|
};
|
|
2386
2415
|
registerDependency = (fn) => {
|
|
2387
2416
|
const ctx = this.getContextOrThrow();
|
package/dist/index.d.mts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { ReportFormat } from "@bamboocss/reporter";
|
|
2
|
+
import { Message, Root } from "postcss";
|
|
2
3
|
import { StyleEncoder, Stylesheet } from "@bamboocss/core";
|
|
3
4
|
import { Generator } from "@bamboocss/generator";
|
|
4
5
|
import { ParserResult, Project } from "@bamboocss/parser";
|
|
5
6
|
import { AnalysisOptions, Artifact, ArtifactId, BambooHooks, Config, CssArtifactType, LoadConfigResult, Runtime, SpecFile, WatchOptions, WatcherEventType } from "@bamboocss/types";
|
|
6
|
-
import { Message, Root } from "postcss";
|
|
7
7
|
|
|
8
8
|
//#region src/diff-engine.d.ts
|
|
9
9
|
declare class DiffEngine {
|
package/dist/index.mjs
CHANGED
|
@@ -4,6 +4,7 @@ import { convertTsPathsToRegexes, diffConfigs, findConfig, getConfigDependencies
|
|
|
4
4
|
import { BambooError, cssVarRefs, uniq } from "@bamboocss/shared";
|
|
5
5
|
import { appendFileSync, existsSync, readFileSync, statSync, writeFileSync } from "fs";
|
|
6
6
|
import { dirname, extname, isAbsolute, join, normalize, parse, relative, resolve, sep } from "path";
|
|
7
|
+
import postcss from "postcss";
|
|
7
8
|
import { pluginLightningcss } from "@bamboocss/plugin-lightningcss";
|
|
8
9
|
import { pluginSvelte } from "@bamboocss/plugin-svelte";
|
|
9
10
|
import { pluginVue } from "@bamboocss/plugin-vue";
|
|
@@ -2223,6 +2224,30 @@ const keyframeNames = (ctx) => Object.keys(ctx.config.theme?.keyframes ?? {});
|
|
|
2223
2224
|
//#endregion
|
|
2224
2225
|
//#region src/builder.ts
|
|
2225
2226
|
const fileModifiedMap = /* @__PURE__ */ new Map();
|
|
2227
|
+
/**
|
|
2228
|
+
* Bracket the css `write` injects, so a second pass replaces it instead of adding to it.
|
|
2229
|
+
*
|
|
2230
|
+
* Comments rather than a node flag: the root can be stringified and re-parsed between two
|
|
2231
|
+
* plugins in the same chain, and nothing on the node itself survives that round trip.
|
|
2232
|
+
*/
|
|
2233
|
+
const INJECTED_START = "bamboocss:start";
|
|
2234
|
+
const INJECTED_END = "bamboocss:end";
|
|
2235
|
+
/**
|
|
2236
|
+
* Remove a previously injected block, markers included.
|
|
2237
|
+
*
|
|
2238
|
+
* Bounded by the end marker rather than running to the end of the root, so anything a later
|
|
2239
|
+
* plugin appended after the injection is left where it is. A start marker with no end -- the
|
|
2240
|
+
* shape a minifier that strips comments unevenly could leave behind -- removes nothing,
|
|
2241
|
+
* which is the safe direction: a duplicate is a size problem, dropping a user's css is not.
|
|
2242
|
+
*/
|
|
2243
|
+
function dropPreviousInjection(root) {
|
|
2244
|
+
const nodes = root.nodes ?? [];
|
|
2245
|
+
const start = nodes.findIndex((n) => n.type === "comment" && n.text === INJECTED_START);
|
|
2246
|
+
if (start < 0) return;
|
|
2247
|
+
const end = nodes.findIndex((n, i) => i > start && n.type === "comment" && n.text === INJECTED_END);
|
|
2248
|
+
if (end < 0) return;
|
|
2249
|
+
for (const node of nodes.slice(start, end + 1)) node.remove();
|
|
2250
|
+
}
|
|
2226
2251
|
var Builder = class {
|
|
2227
2252
|
/**
|
|
2228
2253
|
* The current bamboo context
|
|
@@ -2366,7 +2391,10 @@ var Builder = class {
|
|
|
2366
2391
|
else ctx.pruneTokens(sheet);
|
|
2367
2392
|
if (ctx.config.pruneUnusedKeyframes) ctx.pruneKeyframes(sheet, collectKeyframeReferences(ctx, keyframeNames(ctx)));
|
|
2368
2393
|
const css = ctx.getCss(sheet);
|
|
2394
|
+
dropPreviousInjection(root);
|
|
2395
|
+
root.append(postcss.comment({ text: INJECTED_START }));
|
|
2369
2396
|
root.append(css);
|
|
2397
|
+
root.append(postcss.comment({ text: INJECTED_END }));
|
|
2370
2398
|
};
|
|
2371
2399
|
registerDependency = (fn) => {
|
|
2372
2400
|
const ctx = this.getContextOrThrow();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bamboocss/node",
|
|
3
|
-
"version": "1.20.
|
|
3
|
+
"version": "1.20.1",
|
|
4
4
|
"description": "The core css bamboo library",
|
|
5
5
|
"homepage": "https://bamboocss.com",
|
|
6
6
|
"license": "MIT",
|
|
@@ -52,18 +52,18 @@
|
|
|
52
52
|
"postcss": "8.5.26",
|
|
53
53
|
"ts-morph": "28.0.0",
|
|
54
54
|
"ts-pattern": "5.9.0",
|
|
55
|
-
"@bamboocss/config": "1.20.
|
|
56
|
-
"@bamboocss/core": "1.20.
|
|
57
|
-
"@bamboocss/generator": "1.20.
|
|
58
|
-
"@bamboocss/logger": "1.20.
|
|
59
|
-
"@bamboocss/parser": "1.20.
|
|
60
|
-
"@bamboocss/plugin-lightningcss": "1.20.
|
|
61
|
-
"@bamboocss/plugin-svelte": "1.20.
|
|
62
|
-
"@bamboocss/plugin-vue": "1.20.
|
|
63
|
-
"@bamboocss/reporter": "1.20.
|
|
64
|
-
"@bamboocss/shared": "1.20.
|
|
65
|
-
"@bamboocss/token-dictionary": "1.20.
|
|
66
|
-
"@bamboocss/types": "1.20.
|
|
55
|
+
"@bamboocss/config": "1.20.1",
|
|
56
|
+
"@bamboocss/core": "1.20.1",
|
|
57
|
+
"@bamboocss/generator": "1.20.1",
|
|
58
|
+
"@bamboocss/logger": "1.20.1",
|
|
59
|
+
"@bamboocss/parser": "1.20.1",
|
|
60
|
+
"@bamboocss/plugin-lightningcss": "1.20.1",
|
|
61
|
+
"@bamboocss/plugin-svelte": "1.20.1",
|
|
62
|
+
"@bamboocss/plugin-vue": "1.20.1",
|
|
63
|
+
"@bamboocss/reporter": "1.20.1",
|
|
64
|
+
"@bamboocss/shared": "1.20.1",
|
|
65
|
+
"@bamboocss/token-dictionary": "1.20.1",
|
|
66
|
+
"@bamboocss/types": "1.20.1"
|
|
67
67
|
},
|
|
68
68
|
"devDependencies": {
|
|
69
69
|
"@types/fs-extra": "11.0.4",
|