@bamboocss/postcss 1.11.1 → 1.11.3
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 +91 -0
- package/dist/index.d.cts +15 -0
- package/dist/index.d.mts +15 -0
- package/dist/index.mjs +60 -68
- package/package.json +10 -10
- package/dist/index.js +0 -105
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
Object.defineProperties(exports, {
|
|
2
|
+
__esModule: { value: true },
|
|
3
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
4
|
+
});
|
|
5
|
+
//#region \0rolldown/runtime.js
|
|
6
|
+
var __create = Object.create;
|
|
7
|
+
var __defProp = Object.defineProperty;
|
|
8
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
9
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
10
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
11
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
14
|
+
key = keys[i];
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
16
|
+
get: ((k) => from[k]).bind(null, key),
|
|
17
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
22
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
23
|
+
value: mod,
|
|
24
|
+
enumerable: true
|
|
25
|
+
}) : target, mod));
|
|
26
|
+
//#endregion
|
|
27
|
+
let _bamboocss_node = require("@bamboocss/node");
|
|
28
|
+
let module$1 = require("module");
|
|
29
|
+
let path = require("path");
|
|
30
|
+
path = __toESM(path);
|
|
31
|
+
//#region src/index.ts
|
|
32
|
+
const customRequire = (0, module$1.createRequire)(__dirname);
|
|
33
|
+
const PLUGIN_NAME = "bamboocss";
|
|
34
|
+
const interopDefault = (obj) => obj && obj.__esModule ? obj.default : obj;
|
|
35
|
+
const loadConfig = () => interopDefault(customRequire("@bamboocss/postcss"));
|
|
36
|
+
let stream;
|
|
37
|
+
const builder = new _bamboocss_node.Builder();
|
|
38
|
+
let builderGuard;
|
|
39
|
+
const bamboocss = (options = {}) => {
|
|
40
|
+
const { configPath, cwd, logfile, allow } = options;
|
|
41
|
+
if (!stream && logfile) stream = (0, _bamboocss_node.setLogStream)({
|
|
42
|
+
cwd,
|
|
43
|
+
logfile
|
|
44
|
+
});
|
|
45
|
+
const postcssProcess = async function(root, result) {
|
|
46
|
+
const fileName = result.opts.from;
|
|
47
|
+
if (shouldSkip(fileName, allow)) return;
|
|
48
|
+
await builder.setup({
|
|
49
|
+
configPath,
|
|
50
|
+
cwd
|
|
51
|
+
});
|
|
52
|
+
if (!builder.isValidRoot(root)) return;
|
|
53
|
+
await builder.emit();
|
|
54
|
+
builder.extract();
|
|
55
|
+
builder.registerDependency((dep) => {
|
|
56
|
+
result.messages.push({
|
|
57
|
+
...dep,
|
|
58
|
+
plugin: PLUGIN_NAME,
|
|
59
|
+
parent: result.opts.from
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
builder.write(root);
|
|
63
|
+
root.walk((node) => {
|
|
64
|
+
if (!node.source) node.source = root.source;
|
|
65
|
+
});
|
|
66
|
+
};
|
|
67
|
+
return {
|
|
68
|
+
postcssPlugin: PLUGIN_NAME,
|
|
69
|
+
plugins: [function(...args) {
|
|
70
|
+
builderGuard = Promise.resolve(builderGuard).catch(() => {}).then(() => postcssProcess(...args));
|
|
71
|
+
return builderGuard;
|
|
72
|
+
}]
|
|
73
|
+
};
|
|
74
|
+
};
|
|
75
|
+
bamboocss.postcss = true;
|
|
76
|
+
const nodeModulesRegex = /node_modules/;
|
|
77
|
+
function isValidCss(file) {
|
|
78
|
+
const [filePath] = file.split("?");
|
|
79
|
+
return path.default.extname(filePath) === ".css";
|
|
80
|
+
}
|
|
81
|
+
const shouldSkip = (fileName, allow) => {
|
|
82
|
+
if (!fileName) return true;
|
|
83
|
+
if (!isValidCss(fileName)) return true;
|
|
84
|
+
if (allow?.some((p) => p.test(fileName))) return false;
|
|
85
|
+
return nodeModulesRegex.test(fileName);
|
|
86
|
+
};
|
|
87
|
+
//#endregion
|
|
88
|
+
exports.bamboocss = bamboocss;
|
|
89
|
+
exports.default = bamboocss;
|
|
90
|
+
exports.builder = builder;
|
|
91
|
+
exports.loadConfig = loadConfig;
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Builder } from "@bamboocss/node";
|
|
2
|
+
import { PluginCreator } from "postcss";
|
|
3
|
+
|
|
4
|
+
//#region src/index.d.ts
|
|
5
|
+
interface PluginOptions {
|
|
6
|
+
configPath?: string;
|
|
7
|
+
cwd?: string;
|
|
8
|
+
logfile?: string;
|
|
9
|
+
allow?: RegExp[];
|
|
10
|
+
}
|
|
11
|
+
declare const loadConfig: () => any;
|
|
12
|
+
declare const builder: Builder;
|
|
13
|
+
declare const bamboocss: PluginCreator<PluginOptions>;
|
|
14
|
+
//#endregion
|
|
15
|
+
export { PluginOptions, bamboocss, bamboocss as default, builder, loadConfig };
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Builder } from "@bamboocss/node";
|
|
2
|
+
import { PluginCreator } from "postcss";
|
|
3
|
+
|
|
4
|
+
//#region src/index.d.ts
|
|
5
|
+
interface PluginOptions {
|
|
6
|
+
configPath?: string;
|
|
7
|
+
cwd?: string;
|
|
8
|
+
logfile?: string;
|
|
9
|
+
allow?: RegExp[];
|
|
10
|
+
}
|
|
11
|
+
declare const loadConfig: () => any;
|
|
12
|
+
declare const builder: Builder;
|
|
13
|
+
declare const bamboocss: PluginCreator<PluginOptions>;
|
|
14
|
+
//#endregion
|
|
15
|
+
export { PluginOptions, bamboocss, bamboocss as default, builder, loadConfig };
|
package/dist/index.mjs
CHANGED
|
@@ -1,75 +1,67 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import { fileURLToPath } from "url";
|
|
4
|
-
var getFilename = () => fileURLToPath(import.meta.url);
|
|
5
|
-
var getDirname = () => path.dirname(getFilename());
|
|
6
|
-
var __dirname = /* @__PURE__ */ getDirname();
|
|
7
|
-
|
|
8
|
-
// src/index.ts
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import { fileURLToPath } from "node:url";
|
|
9
3
|
import { Builder, setLogStream } from "@bamboocss/node";
|
|
10
4
|
import { createRequire } from "module";
|
|
11
|
-
import
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
5
|
+
import path$1 from "path";
|
|
6
|
+
//#region ../../node_modules/.pnpm/tsdown@0.22.0_oxc-resolver@11.19.1_@emnapi+core@1.10.0_@emnapi+runtime@1.10.0__tsx@4.20.6_typescript@6.0.2/node_modules/tsdown/esm-shims.js
|
|
7
|
+
const getFilename = () => fileURLToPath(import.meta.url);
|
|
8
|
+
const getDirname = () => path.dirname(getFilename());
|
|
9
|
+
//#endregion
|
|
10
|
+
//#region src/index.ts
|
|
11
|
+
const customRequire = createRequire(/* @__PURE__ */ getDirname());
|
|
12
|
+
const PLUGIN_NAME = "bamboocss";
|
|
13
|
+
const interopDefault = (obj) => obj && obj.__esModule ? obj.default : obj;
|
|
14
|
+
const loadConfig = () => interopDefault(customRequire("@bamboocss/postcss"));
|
|
15
|
+
let stream;
|
|
16
|
+
const builder = new Builder();
|
|
17
|
+
let builderGuard;
|
|
18
|
+
const bamboocss = (options = {}) => {
|
|
19
|
+
const { configPath, cwd, logfile, allow } = options;
|
|
20
|
+
if (!stream && logfile) stream = setLogStream({
|
|
21
|
+
cwd,
|
|
22
|
+
logfile
|
|
23
|
+
});
|
|
24
|
+
const postcssProcess = async function(root, result) {
|
|
25
|
+
const fileName = result.opts.from;
|
|
26
|
+
if (shouldSkip(fileName, allow)) return;
|
|
27
|
+
await builder.setup({
|
|
28
|
+
configPath,
|
|
29
|
+
cwd
|
|
30
|
+
});
|
|
31
|
+
if (!builder.isValidRoot(root)) return;
|
|
32
|
+
await builder.emit();
|
|
33
|
+
builder.extract();
|
|
34
|
+
builder.registerDependency((dep) => {
|
|
35
|
+
result.messages.push({
|
|
36
|
+
...dep,
|
|
37
|
+
plugin: PLUGIN_NAME,
|
|
38
|
+
parent: result.opts.from
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
builder.write(root);
|
|
42
|
+
root.walk((node) => {
|
|
43
|
+
if (!node.source) node.source = root.source;
|
|
44
|
+
});
|
|
45
|
+
};
|
|
46
|
+
return {
|
|
47
|
+
postcssPlugin: PLUGIN_NAME,
|
|
48
|
+
plugins: [function(...args) {
|
|
49
|
+
builderGuard = Promise.resolve(builderGuard).catch(() => {}).then(() => postcssProcess(...args));
|
|
50
|
+
return builderGuard;
|
|
51
|
+
}]
|
|
52
|
+
};
|
|
56
53
|
};
|
|
57
54
|
bamboocss.postcss = true;
|
|
58
|
-
|
|
59
|
-
var nodeModulesRegex = /node_modules/;
|
|
55
|
+
const nodeModulesRegex = /node_modules/;
|
|
60
56
|
function isValidCss(file) {
|
|
61
|
-
|
|
62
|
-
|
|
57
|
+
const [filePath] = file.split("?");
|
|
58
|
+
return path$1.extname(filePath) === ".css";
|
|
63
59
|
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
};
|
|
70
|
-
export {
|
|
71
|
-
bamboocss,
|
|
72
|
-
builder,
|
|
73
|
-
index_default as default,
|
|
74
|
-
loadConfig
|
|
60
|
+
const shouldSkip = (fileName, allow) => {
|
|
61
|
+
if (!fileName) return true;
|
|
62
|
+
if (!isValidCss(fileName)) return true;
|
|
63
|
+
if (allow?.some((p) => p.test(fileName))) return false;
|
|
64
|
+
return nodeModulesRegex.test(fileName);
|
|
75
65
|
};
|
|
66
|
+
//#endregion
|
|
67
|
+
export { bamboocss, bamboocss as default, builder, loadConfig };
|
package/package.json
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bamboocss/postcss",
|
|
3
|
-
"version": "1.11.
|
|
3
|
+
"version": "1.11.3",
|
|
4
4
|
"description": "PostCSS integration for Bamboo CSS",
|
|
5
5
|
"homepage": "https://bamboo-css.com",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"author": "Segun Adebayo <joseshegs@gmail.com>",
|
|
8
8
|
"repository": {
|
|
9
9
|
"type": "git",
|
|
10
|
-
"url": "git+https://github.com/
|
|
10
|
+
"url": "git+https://github.com/bamboocss/bamboo.git",
|
|
11
11
|
"directory": "packages/postcss"
|
|
12
12
|
},
|
|
13
13
|
"files": [
|
|
14
14
|
"dist"
|
|
15
15
|
],
|
|
16
16
|
"sideEffects": false,
|
|
17
|
-
"main": "dist/index.
|
|
17
|
+
"main": "dist/index.cjs",
|
|
18
18
|
"module": "dist/index.mjs",
|
|
19
|
-
"types": "dist/index.d.
|
|
19
|
+
"types": "dist/index.d.cts",
|
|
20
20
|
"exports": {
|
|
21
21
|
".": {
|
|
22
22
|
"source": "./src/index.ts",
|
|
23
|
-
"types": "./dist/index.d.
|
|
24
|
-
"require": "./dist/index.
|
|
23
|
+
"types": "./dist/index.d.cts",
|
|
24
|
+
"require": "./dist/index.cjs",
|
|
25
25
|
"import": {
|
|
26
26
|
"types": "./dist/index.d.mts",
|
|
27
27
|
"default": "./dist/index.mjs"
|
|
@@ -34,14 +34,14 @@
|
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"postcss": "8.5.14",
|
|
37
|
-
"@bamboocss/node": "1.11.
|
|
37
|
+
"@bamboocss/node": "1.11.3"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@bamboocss/logger": "1.11.
|
|
40
|
+
"@bamboocss/logger": "1.11.3"
|
|
41
41
|
},
|
|
42
42
|
"scripts": {
|
|
43
|
-
"build": "
|
|
44
|
-
"build-fast": "
|
|
43
|
+
"build": "tsdown src/index.ts --format=cjs,esm --shims --dts",
|
|
44
|
+
"build-fast": "tsdown --dts=false src/index.ts --format=cjs,esm --shims",
|
|
45
45
|
"dev": "pnpm build-fast --watch"
|
|
46
46
|
}
|
|
47
47
|
}
|
package/dist/index.js
DELETED
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
|
|
30
|
-
// src/index.ts
|
|
31
|
-
var index_exports = {};
|
|
32
|
-
__export(index_exports, {
|
|
33
|
-
bamboocss: () => bamboocss,
|
|
34
|
-
builder: () => builder,
|
|
35
|
-
default: () => index_default,
|
|
36
|
-
loadConfig: () => loadConfig
|
|
37
|
-
});
|
|
38
|
-
module.exports = __toCommonJS(index_exports);
|
|
39
|
-
var import_node = require("@bamboocss/node");
|
|
40
|
-
var import_module = require("module");
|
|
41
|
-
var import_path = __toESM(require("path"));
|
|
42
|
-
var customRequire = (0, import_module.createRequire)(__dirname);
|
|
43
|
-
var PLUGIN_NAME = "bamboocss";
|
|
44
|
-
var interopDefault = (obj) => obj && obj.__esModule ? obj.default : obj;
|
|
45
|
-
var loadConfig = () => interopDefault(customRequire("@bamboocss/postcss"));
|
|
46
|
-
var stream;
|
|
47
|
-
var builder = new import_node.Builder();
|
|
48
|
-
var builderGuard;
|
|
49
|
-
var bamboocss = (options = {}) => {
|
|
50
|
-
const { configPath, cwd, logfile, allow } = options;
|
|
51
|
-
if (!stream && logfile) {
|
|
52
|
-
stream = (0, import_node.setLogStream)({ cwd, logfile });
|
|
53
|
-
}
|
|
54
|
-
const postcssProcess = async function(root, result) {
|
|
55
|
-
const fileName = result.opts.from;
|
|
56
|
-
const skip = shouldSkip(fileName, allow);
|
|
57
|
-
if (skip) return;
|
|
58
|
-
await builder.setup({ configPath, cwd });
|
|
59
|
-
if (!builder.isValidRoot(root)) return;
|
|
60
|
-
await builder.emit();
|
|
61
|
-
builder.extract();
|
|
62
|
-
builder.registerDependency((dep) => {
|
|
63
|
-
result.messages.push({
|
|
64
|
-
...dep,
|
|
65
|
-
plugin: PLUGIN_NAME,
|
|
66
|
-
parent: result.opts.from
|
|
67
|
-
});
|
|
68
|
-
});
|
|
69
|
-
builder.write(root);
|
|
70
|
-
root.walk((node) => {
|
|
71
|
-
if (!node.source) {
|
|
72
|
-
node.source = root.source;
|
|
73
|
-
}
|
|
74
|
-
});
|
|
75
|
-
};
|
|
76
|
-
return {
|
|
77
|
-
postcssPlugin: PLUGIN_NAME,
|
|
78
|
-
plugins: [
|
|
79
|
-
function(...args) {
|
|
80
|
-
builderGuard = Promise.resolve(builderGuard).catch(() => {
|
|
81
|
-
}).then(() => postcssProcess(...args));
|
|
82
|
-
return builderGuard;
|
|
83
|
-
}
|
|
84
|
-
]
|
|
85
|
-
};
|
|
86
|
-
};
|
|
87
|
-
bamboocss.postcss = true;
|
|
88
|
-
var index_default = bamboocss;
|
|
89
|
-
var nodeModulesRegex = /node_modules/;
|
|
90
|
-
function isValidCss(file) {
|
|
91
|
-
const [filePath] = file.split("?");
|
|
92
|
-
return import_path.default.extname(filePath) === ".css";
|
|
93
|
-
}
|
|
94
|
-
var shouldSkip = (fileName, allow) => {
|
|
95
|
-
if (!fileName) return true;
|
|
96
|
-
if (!isValidCss(fileName)) return true;
|
|
97
|
-
if (allow?.some((p) => p.test(fileName))) return false;
|
|
98
|
-
return nodeModulesRegex.test(fileName);
|
|
99
|
-
};
|
|
100
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
101
|
-
0 && (module.exports = {
|
|
102
|
-
bamboocss,
|
|
103
|
-
builder,
|
|
104
|
-
loadConfig
|
|
105
|
-
});
|