carbon-preprocess-svelte 0.11.0 → 0.11.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/constants.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ export declare const enum CarbonSvelte {
|
|
|
3
3
|
Icons = "carbon-icons-svelte",
|
|
4
4
|
Pictograms = "carbon-pictograms-svelte"
|
|
5
5
|
}
|
|
6
|
+
export declare const CARBON_PREFIX: RegExp;
|
|
6
7
|
export declare const RE_EXT_SVELTE: RegExp;
|
|
7
8
|
export declare const RE_EXT_CSS: RegExp;
|
|
8
9
|
export declare const BITS_DENOM = 1000;
|
package/dist/constants.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.BITS_DENOM = exports.RE_EXT_CSS = exports.RE_EXT_SVELTE = void 0;
|
|
3
|
+
exports.BITS_DENOM = exports.RE_EXT_CSS = exports.RE_EXT_SVELTE = exports.CARBON_PREFIX = void 0;
|
|
4
|
+
exports.CARBON_PREFIX = /bx--/;
|
|
4
5
|
exports.RE_EXT_SVELTE = /\.svelte$/;
|
|
5
6
|
exports.RE_EXT_CSS = /\.css$/;
|
|
6
7
|
// Vite uses the decimal system for file sizes.
|
|
@@ -8,6 +8,7 @@ const node_path_1 = __importDefault(require("node:path"));
|
|
|
8
8
|
const postcss_1 = __importDefault(require("postcss"));
|
|
9
9
|
const postcss_discard_empty_1 = __importDefault(require("postcss-discard-empty"));
|
|
10
10
|
const component_index_1 = require("../component-index");
|
|
11
|
+
const constants_1 = require("../constants");
|
|
11
12
|
function createOptimizedCss(original_css, ids, options) {
|
|
12
13
|
const preserveAllIBMFonts = (options === null || options === void 0 ? void 0 : options.preserveAllIBMFonts) === true;
|
|
13
14
|
// List of Carbon classes that must be preserved in the CSS
|
|
@@ -24,8 +25,8 @@ function createOptimizedCss(original_css, ids, options) {
|
|
|
24
25
|
postcssPlugin: "postcss-plugin:carbon:optimize-css",
|
|
25
26
|
Rule(node) {
|
|
26
27
|
const selector = node.selector;
|
|
27
|
-
// Ensure that the selector contains a
|
|
28
|
-
if (
|
|
28
|
+
// Ensure that the selector contains a Carbon prefix.
|
|
29
|
+
if (constants_1.CARBON_PREFIX.test(selector)) {
|
|
29
30
|
// Selectors may contain multiple classes, separated by a comma.
|
|
30
31
|
const classes = selector.split(",").filter((selectee) => {
|
|
31
32
|
var _a;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "carbon-preprocess-svelte",
|
|
3
|
-
"version": "0.11.
|
|
3
|
+
"version": "0.11.1",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"description": "Svelte preprocessors for the Carbon Design System",
|
|
6
6
|
"author": "Eric Liu (https://github.com/metonym)",
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"scripts": {
|
|
10
10
|
"index:components": "bun scripts/index-components.ts",
|
|
11
11
|
"prepack": "tsc -p tsconfig.build.json",
|
|
12
|
-
"format": "prettier --write ."
|
|
12
|
+
"format": "bunx --bun prettier --write ."
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
15
|
"magic-string": "^0.30.8",
|