@lipemat/js-boilerplate-shared 0.0.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/README.md +1 -0
- package/config/jest.config.js +29 -0
- package/config/jest.config.js.map +1 -0
- package/config/jest.config.ts +31 -0
- package/helpers/browserslist.js +18 -0
- package/helpers/browserslist.js.map +1 -0
- package/helpers/browserslist.ts +18 -0
- package/helpers/camel-case.js +93 -0
- package/helpers/camel-case.js.map +1 -0
- package/helpers/camel-case.ts +101 -0
- package/helpers/config.js +61 -0
- package/helpers/config.js.map +1 -0
- package/helpers/config.ts +66 -0
- package/helpers/css-classnames.js +104 -0
- package/helpers/css-classnames.js.map +1 -0
- package/helpers/css-classnames.ts +124 -0
- package/helpers/package-config.js +45 -0
- package/helpers/package-config.js.map +1 -0
- package/helpers/package-config.ts +97 -0
- package/helpers/postcss-config.js +135 -0
- package/helpers/postcss-config.js.map +1 -0
- package/helpers/postcss-config.ts +159 -0
- package/helpers/wp-externals.js +83 -0
- package/helpers/wp-externals.js.map +1 -0
- package/helpers/wp-externals.ts +87 -0
- package/lib/package.json +114 -0
- package/lib/postcss-clean.js +38 -0
- package/lib/postcss-clean.js.map +1 -0
- package/lib/postcss-clean.ts +42 -0
- package/lib/postcss-pretty.js +50 -0
- package/lib/postcss-pretty.js.map +1 -0
- package/lib/postcss-pretty.ts +67 -0
- package/package.json +70 -0
- package/types/css-loader.d.ts +87 -0
- package/types/utility.d.ts +6 -0
package/lib/package.json
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@lipemat/js-boilerplate",
|
|
3
|
+
"version": "11.0.0-alpha.0",
|
|
4
|
+
"description": "Dependencies and scripts for a no config JavaScript app",
|
|
5
|
+
"author": "Mat Lipe",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"jsPath": "./",
|
|
8
|
+
"type": "module",
|
|
9
|
+
"engines": {
|
|
10
|
+
"node": ">=22.21.1"
|
|
11
|
+
},
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/lipemat/js-boilerplate/issues"
|
|
14
|
+
},
|
|
15
|
+
"homepage": "https://github.com/lipemat/js-boilerplate#readme",
|
|
16
|
+
"repository": {
|
|
17
|
+
"type": "git",
|
|
18
|
+
"url": "git+https://github.com/lipemat/js-boilerplate.git"
|
|
19
|
+
},
|
|
20
|
+
"sideEffects": false,
|
|
21
|
+
"keywords": [
|
|
22
|
+
"boilerplate",
|
|
23
|
+
"ES6",
|
|
24
|
+
"no-config"
|
|
25
|
+
],
|
|
26
|
+
"files": [
|
|
27
|
+
"tsconfig.json",
|
|
28
|
+
"bin/",
|
|
29
|
+
"config/",
|
|
30
|
+
"helpers/",
|
|
31
|
+
"lib/",
|
|
32
|
+
"scripts/",
|
|
33
|
+
"types/"
|
|
34
|
+
],
|
|
35
|
+
"bin": {
|
|
36
|
+
"lipemat-js-boilerplate": "bin/lipemat-js-boilerplate.js"
|
|
37
|
+
},
|
|
38
|
+
"scripts": {
|
|
39
|
+
"browserslist": "lipemat-js-boilerplate browserslist",
|
|
40
|
+
"build": "tsc --project ./bin",
|
|
41
|
+
"prepublishOnly": "yarn run build",
|
|
42
|
+
"test": "NODE_OPTIONS=--experimental-vm-modules jest --config=jest/jest.config.ts",
|
|
43
|
+
"validate-ts": "tsc --noEmit",
|
|
44
|
+
"watch": "tsc --project ./bin --watch"
|
|
45
|
+
},
|
|
46
|
+
"dependencies": {
|
|
47
|
+
"@babel/core": "^7.24.7",
|
|
48
|
+
"@babel/preset-env": "^7.24.7",
|
|
49
|
+
"@babel/preset-react": "^7.24.7",
|
|
50
|
+
"@babel/preset-typescript": "^7.24.7",
|
|
51
|
+
"@csstools/postcss-global-data": "2.0.0",
|
|
52
|
+
"@lipemat/js-boilerplate-shared": "link:../js-boilerplate-shared",
|
|
53
|
+
"@pmmmwh/react-refresh-webpack-plugin": "^0.6.1",
|
|
54
|
+
"@statoscope/webpack-plugin": "^5.29.0",
|
|
55
|
+
"@types/babel__preset-env": "^7.9.6",
|
|
56
|
+
"@types/clean-css": "^4.2.11",
|
|
57
|
+
"@types/postcss-load-config": "^3.0.1",
|
|
58
|
+
"@types/postcss-preset-env": "^7.7.0",
|
|
59
|
+
"@wordpress/browserslist-config": "^6.19.0",
|
|
60
|
+
"babel-jest": "^30.2.0",
|
|
61
|
+
"babel-loader": "^10.0.0",
|
|
62
|
+
"browserslist": "^4.28.1",
|
|
63
|
+
"chalk": "^4.0",
|
|
64
|
+
"clean-css": "^5.3.3",
|
|
65
|
+
"clean-webpack-plugin": "^4.0.0",
|
|
66
|
+
"compression-webpack-plugin": "^10.0.0",
|
|
67
|
+
"core-js": "^3.33.1",
|
|
68
|
+
"cross-spawn": "^7.0.6",
|
|
69
|
+
"css-loader": "6.7.1",
|
|
70
|
+
"fork-ts-checker-webpack-plugin": "^7.2.13",
|
|
71
|
+
"html-webpack-plugin": "^5.5.0",
|
|
72
|
+
"identity-obj-proxy": "^3.0.0",
|
|
73
|
+
"jest-environment-jsdom": "^30.2.0",
|
|
74
|
+
"mini-css-extract-plugin": "^2.9.2",
|
|
75
|
+
"minimist": "^1.2.8",
|
|
76
|
+
"postcss": "^8.4.47",
|
|
77
|
+
"postcss-color-mod-function": "^4.1.1",
|
|
78
|
+
"postcss-custom-media": "^8.0.1",
|
|
79
|
+
"postcss-import": "^15.1.0",
|
|
80
|
+
"postcss-loader": "^8.1.1",
|
|
81
|
+
"postcss-nested": "^5.0.6",
|
|
82
|
+
"postcss-preset-env": "^7.8.3",
|
|
83
|
+
"postcss-scss": "^4.0.4",
|
|
84
|
+
"postcss-sort-media-queries": "^5.2.0",
|
|
85
|
+
"react-refresh": "^0.17.0",
|
|
86
|
+
"style-loader": "^3.3.1",
|
|
87
|
+
"ts-node": "^10.9.1",
|
|
88
|
+
"typescript": "^5.9.3",
|
|
89
|
+
"webpack": "^5.101.0",
|
|
90
|
+
"webpack-assets-manifest": "^6.2.1",
|
|
91
|
+
"webpack-cli": "^6.0.1",
|
|
92
|
+
"webpack-dev-server": "^5.2.2",
|
|
93
|
+
"webpack-subresource-integrity": "^5.1.0"
|
|
94
|
+
},
|
|
95
|
+
"devDependencies": {
|
|
96
|
+
"@jest/globals": "^30.2.0",
|
|
97
|
+
"@lipemat/eslint-config": "^5.1.4",
|
|
98
|
+
"@types/jest": "^29.5.3",
|
|
99
|
+
"@types/minimist": "^1",
|
|
100
|
+
"@types/node": "^22.19.3",
|
|
101
|
+
"@types/react": "^18.2.64",
|
|
102
|
+
"chokidar": "^3.5.3",
|
|
103
|
+
"eslint": "^9",
|
|
104
|
+
"glob": "^11.1.0",
|
|
105
|
+
"jest": "^30.2.0",
|
|
106
|
+
"memfs": "^3.5.3",
|
|
107
|
+
"react": "^18.2.0",
|
|
108
|
+
"setimmediate": "^1.0.5"
|
|
109
|
+
},
|
|
110
|
+
"resolutions": {
|
|
111
|
+
"type-fest": "^4.41.0"
|
|
112
|
+
},
|
|
113
|
+
"packageManager": "yarn@4.12.0"
|
|
114
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Mimic the `postcss-clean` plugin.
|
|
3
|
+
*
|
|
4
|
+
* Override due to the plugin using version 4 of `clean-css`, which
|
|
5
|
+
* has issues with PostCSS 7/8 and results in inconsistent CSS.
|
|
6
|
+
*
|
|
7
|
+
* This may potentially be removed in favor of using that plugin again if
|
|
8
|
+
* they change the version of PostCSS to 8 and Clean CSS to 5.
|
|
9
|
+
*
|
|
10
|
+
* Decided to use this `lib` instead of maintaining another fork.
|
|
11
|
+
*
|
|
12
|
+
* @link https://www.npmjs.com/package/postcss-clean
|
|
13
|
+
*/
|
|
14
|
+
import postCss, {} from 'postcss';
|
|
15
|
+
import CleanCSS, {} from 'clean-css';
|
|
16
|
+
const cleaner = (opts = {}) => {
|
|
17
|
+
const clean = new CleanCSS(opts);
|
|
18
|
+
return {
|
|
19
|
+
postcssPlugin: 'clean',
|
|
20
|
+
OnceExit(css, { result }) {
|
|
21
|
+
return new Promise((resolve, reject) => {
|
|
22
|
+
clean.minify(css.toString(), (err, min) => {
|
|
23
|
+
if (null !== err) {
|
|
24
|
+
return reject(new Error(err.join('\n')));
|
|
25
|
+
}
|
|
26
|
+
if (min.warnings.length > 0) {
|
|
27
|
+
return reject(new Error('postcss-clean minify failed! \n' + min.warnings.join('\n')));
|
|
28
|
+
}
|
|
29
|
+
result.root = postCss.parse(min.styles);
|
|
30
|
+
resolve();
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
export const postcss = true;
|
|
37
|
+
export default cleaner;
|
|
38
|
+
//# sourceMappingURL=postcss-clean.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"postcss-clean.js","sourceRoot":"","sources":["postcss-clean.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,OAAO,EAAE,EAAsC,MAAM,SAAS,CAAC;AACtE,OAAO,QAAQ,EAAE,EAAsD,MAAM,WAAW,CAAC;AAEzF,MAAM,OAAO,GAAG,CAAE,OAAsB,EAAE,EAAW,EAAE;IACtD,MAAM,KAAK,GAAmB,IAAI,QAAQ,CAAE,IAAI,CAAE,CAAC;IAEnD,OAAO;QACN,aAAa,EAAE,OAAO;QACtB,QAAQ,CAAE,GAAS,EAAE,EAAC,MAAM,EAAU;YACrC,OAAO,IAAI,OAAO,CAAE,CAAE,OAAO,EAAE,MAAM,EAAG,EAAE;gBACzC,KAAK,CAAC,MAAM,CAAE,GAAG,CAAC,QAAQ,EAAE,EAAE,CAAE,GAAG,EAAE,GAAW,EAAG,EAAE;oBACpD,IAAK,IAAI,KAAK,GAAG,EAAG,CAAC;wBACpB,OAAO,MAAM,CAAE,IAAI,KAAK,CAAE,GAAG,CAAC,IAAI,CAAE,IAAI,CAAE,CAAE,CAAE,CAAC;oBAChD,CAAC;oBAED,IAAK,GAAG,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAG,CAAC;wBAC/B,OAAO,MAAM,CAAE,IAAI,KAAK,CAAE,iCAAiC,GAAG,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAE,IAAI,CAAE,CAAE,CAAE,CAAC;oBAC7F,CAAC;oBAED,MAAM,CAAC,IAAI,GAAG,OAAO,CAAC,KAAK,CAAE,GAAG,CAAC,MAAM,CAAE,CAAC;oBAC1C,OAAO,EAAE,CAAC;gBACX,CAAC,CAAE,CAAC;YACL,CAAC,CAAE,CAAC;QACL,CAAC;KACD,CAAC;AACH,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,OAAO,GAAG,IAAI,CAAC;AAC5B,eAAe,OAAO,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Mimic the `postcss-clean` plugin.
|
|
3
|
+
*
|
|
4
|
+
* Override due to the plugin using version 4 of `clean-css`, which
|
|
5
|
+
* has issues with PostCSS 7/8 and results in inconsistent CSS.
|
|
6
|
+
*
|
|
7
|
+
* This may potentially be removed in favor of using that plugin again if
|
|
8
|
+
* they change the version of PostCSS to 8 and Clean CSS to 5.
|
|
9
|
+
*
|
|
10
|
+
* Decided to use this `lib` instead of maintaining another fork.
|
|
11
|
+
*
|
|
12
|
+
* @link https://www.npmjs.com/package/postcss-clean
|
|
13
|
+
*/
|
|
14
|
+
import postCss, {type Helpers, type Plugin, type Root} from 'postcss';
|
|
15
|
+
import CleanCSS, {type MinifierOutput, type OptionsOutput, type Output} from 'clean-css';
|
|
16
|
+
|
|
17
|
+
const cleaner = ( opts: OptionsOutput = {} ): Plugin => {
|
|
18
|
+
const clean: MinifierOutput = new CleanCSS( opts );
|
|
19
|
+
|
|
20
|
+
return {
|
|
21
|
+
postcssPlugin: 'clean',
|
|
22
|
+
OnceExit( css: Root, {result}: Helpers ) {
|
|
23
|
+
return new Promise( ( resolve, reject ) => {
|
|
24
|
+
clean.minify( css.toString(), ( err, min: Output ) => {
|
|
25
|
+
if ( null !== err ) {
|
|
26
|
+
return reject( new Error( err.join( '\n' ) ) );
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
if ( min.warnings.length > 0 ) {
|
|
30
|
+
return reject( new Error( 'postcss-clean minify failed! \n' + min.warnings.join( '\n' ) ) );
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
result.root = postCss.parse( min.styles );
|
|
34
|
+
resolve();
|
|
35
|
+
} );
|
|
36
|
+
} );
|
|
37
|
+
},
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export const postcss = true;
|
|
42
|
+
export default cleaner;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
/**
|
|
3
|
+
* Get the depth of the current node.
|
|
4
|
+
*/
|
|
5
|
+
function getDepth(node) {
|
|
6
|
+
let depth = 0;
|
|
7
|
+
let parent = node.parent;
|
|
8
|
+
if ('undefined' === typeof parent) {
|
|
9
|
+
return 0;
|
|
10
|
+
}
|
|
11
|
+
while (parent && parent.type !== 'root') {
|
|
12
|
+
depth += 1;
|
|
13
|
+
parent = parent.parent;
|
|
14
|
+
}
|
|
15
|
+
return depth;
|
|
16
|
+
}
|
|
17
|
+
function indent(node, depth, position = 'before') {
|
|
18
|
+
if (node.raws[position] === undefined) {
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
const indentStr = '\t'.repeat(depth);
|
|
22
|
+
if ('string' === typeof node.raws[position]) {
|
|
23
|
+
const content = node.raws[position];
|
|
24
|
+
node.raws[position] = content.trim().concat(`\n${indentStr}`);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
function processCss(node) {
|
|
28
|
+
const nodeDepth = getDepth(node);
|
|
29
|
+
indent(node, nodeDepth, 'before');
|
|
30
|
+
indent(node, nodeDepth, 'after');
|
|
31
|
+
if (0 === nodeDepth) {
|
|
32
|
+
if ('undefined' === typeof node.raws.before) {
|
|
33
|
+
node.raws.before = '\n\n';
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
node.raws.before += '\n';
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
const plugin = {
|
|
41
|
+
postcssPlugin: 'js-boilerplate/postcss-pretty',
|
|
42
|
+
OnceExit(css) {
|
|
43
|
+
css.walk(processCss);
|
|
44
|
+
if (css.first !== undefined && css.first.raws !== undefined) {
|
|
45
|
+
css.first.raws.before = '';
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
};
|
|
49
|
+
export default plugin;
|
|
50
|
+
//# sourceMappingURL=postcss-pretty.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"postcss-pretty.js","sourceRoot":"","sources":["postcss-pretty.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAeb;;GAEG;AACH,SAAS,QAAQ,CAAE,IAAe;IACjC,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,IAAI,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;IACzB,IAAK,WAAW,KAAK,OAAO,MAAM,EAAG,CAAC;QACrC,OAAO,CAAC,CAAC;IACV,CAAC;IACD,OAAQ,MAAM,IAAI,MAAM,CAAC,IAAI,KAAK,MAAM,EAAG,CAAC;QAC3C,KAAK,IAAI,CAAC,CAAC;QACX,MAAM,GAAG,MAAM,CAAC,MAA0C,CAAC;IAC5D,CAAC;IACD,OAAO,KAAK,CAAC;AACd,CAAC;AAED,SAAS,MAAM,CAAE,IAAe,EAAE,KAAa,EAAE,WAA6B,QAAQ;IACrF,IAAK,IAAI,CAAC,IAAI,CAAE,QAAQ,CAAE,KAAK,SAAS,EAAG,CAAC;QAC3C,OAAO;IACR,CAAC;IACD,MAAM,SAAS,GAAG,IAAI,CAAC,MAAM,CAAE,KAAK,CAAE,CAAC;IACvC,IAAK,QAAQ,KAAK,OAAO,IAAI,CAAC,IAAI,CAAE,QAAQ,CAAE,EAAG,CAAC;QACjD,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAE,QAAQ,CAAY,CAAC;QAChD,IAAI,CAAC,IAAI,CAAE,QAAQ,CAAE,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC,MAAM,CAAE,KAAK,SAAS,EAAE,CAAE,CAAC;IACnE,CAAC;AACF,CAAC;AAED,SAAS,UAAU,CAAE,IAAe;IACnC,MAAM,SAAS,GAAG,QAAQ,CAAE,IAAI,CAAE,CAAC;IACnC,MAAM,CAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,CAAE,CAAC;IACpC,MAAM,CAAE,IAAI,EAAE,SAAS,EAAE,OAAO,CAAE,CAAC;IAEnC,IAAK,CAAC,KAAK,SAAS,EAAG,CAAC;QACvB,IAAK,WAAW,KAAK,OAAO,IAAI,CAAC,IAAI,CAAC,MAAM,EAAG,CAAC;YAC/C,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QAC3B,CAAC;aAAM,CAAC;YACP,IAAI,CAAC,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC;QAC1B,CAAC;IACF,CAAC;AACF,CAAC;AAED,MAAM,MAAM,GAAW;IACtB,aAAa,EAAE,+BAA+B;IAC9C,QAAQ,CAAE,GAAS;QAClB,GAAG,CAAC,IAAI,CAAE,UAAU,CAAE,CAAC;QACvB,IAAK,GAAG,CAAC,KAAK,KAAK,SAAS,IAAI,GAAG,CAAC,KAAK,CAAC,IAAI,KAAK,SAAS,EAAG,CAAC;YAC/D,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC;QAC5B,CAAC;IACF,CAAC;CACD,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Custom PostCSS plugin to format CSS output.
|
|
5
|
+
*
|
|
6
|
+
* - Fix indentation.
|
|
7
|
+
*
|
|
8
|
+
* Inspired by postcss-prettify.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
import type {Container, Plugin, Root} from 'postcss';
|
|
13
|
+
import type {ChildNode} from 'postcss/lib/node';
|
|
14
|
+
import type {AtRuleRaws} from 'postcss/lib/at-rule';
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Get the depth of the current node.
|
|
18
|
+
*/
|
|
19
|
+
function getDepth( node: ChildNode ): number {
|
|
20
|
+
let depth = 0;
|
|
21
|
+
let parent = node.parent;
|
|
22
|
+
if ( 'undefined' === typeof parent ) {
|
|
23
|
+
return 0;
|
|
24
|
+
}
|
|
25
|
+
while ( parent && parent.type !== 'root' ) {
|
|
26
|
+
depth += 1;
|
|
27
|
+
parent = parent.parent as Container<ChildNode> | undefined;
|
|
28
|
+
}
|
|
29
|
+
return depth;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function indent( node: ChildNode, depth: number, position: keyof AtRuleRaws = 'before' ) {
|
|
33
|
+
if ( node.raws[ position ] === undefined ) {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
const indentStr = '\t'.repeat( depth );
|
|
37
|
+
if ( 'string' === typeof node.raws[ position ] ) {
|
|
38
|
+
const content = node.raws[ position ] as string;
|
|
39
|
+
node.raws[ position ] = content.trim().concat( `\n${indentStr}` );
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function processCss( node: ChildNode ) {
|
|
44
|
+
const nodeDepth = getDepth( node );
|
|
45
|
+
indent( node, nodeDepth, 'before' );
|
|
46
|
+
indent( node, nodeDepth, 'after' );
|
|
47
|
+
|
|
48
|
+
if ( 0 === nodeDepth ) {
|
|
49
|
+
if ( 'undefined' === typeof node.raws.before ) {
|
|
50
|
+
node.raws.before = '\n\n';
|
|
51
|
+
} else {
|
|
52
|
+
node.raws.before += '\n';
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const plugin: Plugin = {
|
|
58
|
+
postcssPlugin: 'js-boilerplate/postcss-pretty',
|
|
59
|
+
OnceExit( css: Root ) {
|
|
60
|
+
css.walk( processCss );
|
|
61
|
+
if ( css.first !== undefined && css.first.raws !== undefined ) {
|
|
62
|
+
css.first.raws.before = '';
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
export default plugin;
|
package/package.json
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@lipemat/js-boilerplate-shared",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"description": "Shared utilities for all @lipemat boilerplate packages",
|
|
6
|
+
"engines": {
|
|
7
|
+
"node": ">=22.21.0"
|
|
8
|
+
},
|
|
9
|
+
"type": "module",
|
|
10
|
+
"files": [
|
|
11
|
+
"config",
|
|
12
|
+
"helpers",
|
|
13
|
+
"lib",
|
|
14
|
+
"types"
|
|
15
|
+
],
|
|
16
|
+
"repository": {
|
|
17
|
+
"type": "git",
|
|
18
|
+
"url": "git+https://github.com/lipemat/js-boilerplate-shared.git"
|
|
19
|
+
},
|
|
20
|
+
"bugs": {
|
|
21
|
+
"url": "https://github.com/lipemat/js-boilerplate-shared/issues"
|
|
22
|
+
},
|
|
23
|
+
"homepage": "https://github.com/lipemat/js-boilerplate-shared#readme",
|
|
24
|
+
"scripts": {
|
|
25
|
+
"build": "tsc --project ./bin",
|
|
26
|
+
"lint": "eslint --fix --cache",
|
|
27
|
+
"prepublishOnly": "yarn run build",
|
|
28
|
+
"test": "jest --config ./jest/jest.config.ts",
|
|
29
|
+
"validate-ts": "tsc --noEmit",
|
|
30
|
+
"watch": "tsc --project ./bin --watch"
|
|
31
|
+
},
|
|
32
|
+
"dependencies": {
|
|
33
|
+
"@babel/preset-env": "^7.28.5",
|
|
34
|
+
"@babel/preset-typescript": "^7.28.5",
|
|
35
|
+
"@csstools/postcss-global-data": "2.0.0",
|
|
36
|
+
"@types/clean-css": "^4.2.11",
|
|
37
|
+
"@types/postcss-load-config": "^3.0.1",
|
|
38
|
+
"@types/postcss-preset-env": "^7.7.0",
|
|
39
|
+
"@types/webpack": "^5.28.5",
|
|
40
|
+
"babel-plugin-transform-import-meta": "^2.3.3",
|
|
41
|
+
"browserslist": "^4.28.1",
|
|
42
|
+
"clean-css": "^5.3.3",
|
|
43
|
+
"core-js": "^3.33.1",
|
|
44
|
+
"glob": "^13.0.0",
|
|
45
|
+
"postcss": "^8.4.47",
|
|
46
|
+
"postcss-color-mod-function": "^4.1.1",
|
|
47
|
+
"postcss-custom-media": "^8.0.1",
|
|
48
|
+
"postcss-import": "^15.1.0",
|
|
49
|
+
"postcss-loader": "^8.1.1",
|
|
50
|
+
"postcss-nested": "^5.0.6",
|
|
51
|
+
"postcss-preset-env": "^7.8.3",
|
|
52
|
+
"postcss-scss": "^4.0.4",
|
|
53
|
+
"postcss-sort-media-queries": "^5.2.0"
|
|
54
|
+
},
|
|
55
|
+
"devDependencies": {
|
|
56
|
+
"@jest/types": "^30.2.0",
|
|
57
|
+
"@lipemat/eslint-config": "file:../eslint-config",
|
|
58
|
+
"@types/babel__preset-env": "^7",
|
|
59
|
+
"@types/jest": "^30.0.0",
|
|
60
|
+
"@types/node": "^22.19.3",
|
|
61
|
+
"eslint": "^9",
|
|
62
|
+
"jest": "^30.2.0",
|
|
63
|
+
"typescript": "^5.9.3",
|
|
64
|
+
"webpack": "^5.101.0"
|
|
65
|
+
},
|
|
66
|
+
"peerDependencies": {
|
|
67
|
+
"typescript": "^5.9.3"
|
|
68
|
+
},
|
|
69
|
+
"packageManager": "yarn@4.12.0"
|
|
70
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* No public types available.
|
|
3
|
+
*
|
|
4
|
+
* @link https://webpack.js.org/loaders/css-loader/#options
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import type {LoaderContext} from 'webpack';
|
|
8
|
+
|
|
9
|
+
export type Mode = 'local' | 'global' | 'pure' | 'icss';
|
|
10
|
+
|
|
11
|
+
export type Resource = LoaderContext<{
|
|
12
|
+
resourcePath: string
|
|
13
|
+
}>;
|
|
14
|
+
|
|
15
|
+
export type GetLocalIdent = ( context: Resource, localIdentName: string, localName: string ) => string;
|
|
16
|
+
|
|
17
|
+
export type Modules =
|
|
18
|
+
| boolean
|
|
19
|
+
| 'local'
|
|
20
|
+
| 'global'
|
|
21
|
+
| 'pure'
|
|
22
|
+
| 'icss'
|
|
23
|
+
| {
|
|
24
|
+
auto: boolean | RegExp | ( ( resourcePath: string ) => boolean );
|
|
25
|
+
mode: Mode | ( ( resourcePath: string ) => Mode );
|
|
26
|
+
localIdentName: string;
|
|
27
|
+
localIdentContext: string;
|
|
28
|
+
localIdentHashSalt: string;
|
|
29
|
+
localIdentHashFunction: string;
|
|
30
|
+
localIdentHashDigest: string;
|
|
31
|
+
localIdentRegExp: string | RegExp;
|
|
32
|
+
getLocalIdent: GetLocalIdent;
|
|
33
|
+
namedExport: boolean;
|
|
34
|
+
exportGlobals: boolean;
|
|
35
|
+
exportLocalsConvention:
|
|
36
|
+
| 'asIs'
|
|
37
|
+
| 'camelCase'
|
|
38
|
+
| 'camelCaseOnly'
|
|
39
|
+
| 'dashes'
|
|
40
|
+
| 'dashesOnly'
|
|
41
|
+
| ( ( name: string ) => string );
|
|
42
|
+
exportOnlyLocals: boolean;
|
|
43
|
+
getJSON: ( {
|
|
44
|
+
resourcePath,
|
|
45
|
+
imports,
|
|
46
|
+
exports,
|
|
47
|
+
replacements,
|
|
48
|
+
}: {
|
|
49
|
+
resourcePath: string;
|
|
50
|
+
imports: object[];
|
|
51
|
+
exports: object[];
|
|
52
|
+
replacements: object[];
|
|
53
|
+
} ) => Promise<void> | void;
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
type Base = {
|
|
57
|
+
importLoaders?: number;
|
|
58
|
+
sourceMap?: boolean;
|
|
59
|
+
url?: boolean | {
|
|
60
|
+
filter: ( url: string, resourcePath: string ) => boolean;
|
|
61
|
+
};
|
|
62
|
+
importFn?: boolean | {
|
|
63
|
+
filter: (
|
|
64
|
+
url: string,
|
|
65
|
+
media: string,
|
|
66
|
+
resourcePath: string,
|
|
67
|
+
supports?: string,
|
|
68
|
+
layer?: string,
|
|
69
|
+
) => boolean;
|
|
70
|
+
};
|
|
71
|
+
esModule?: boolean;
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
type CssStyleSheetExport = Base & {
|
|
76
|
+
exportType?: 'css-style-sheet' | 'string';
|
|
77
|
+
modules?: Partial<Modules> & {
|
|
78
|
+
exportLocalsConvention: 'camelCaseOnly' | 'dashesOnly'
|
|
79
|
+
};
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
type ArrayExport = Base & {
|
|
83
|
+
exportType?: 'array';
|
|
84
|
+
modules: Partial<Modules>
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
export type Config = CssStyleSheetExport | ArrayExport;
|