@nx/rollup 22.4.0-beta.3 → 22.4.0-beta.5
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/package.json +7 -5
- package/src/plugins/postcss/index.d.ts +16 -0
- package/src/plugins/postcss/index.d.ts.map +1 -0
- package/src/plugins/postcss/index.js +19 -0
- package/src/plugins/postcss/loaders/index.d.ts +38 -0
- package/src/plugins/postcss/loaders/index.d.ts.map +1 -0
- package/src/plugins/postcss/loaders/index.js +90 -0
- package/src/plugins/postcss/loaders/less-loader.d.ts +7 -0
- package/src/plugins/postcss/loaders/less-loader.d.ts.map +1 -0
- package/src/plugins/postcss/loaders/less-loader.js +48 -0
- package/src/plugins/postcss/loaders/postcss-loader.d.ts +7 -0
- package/src/plugins/postcss/loaders/postcss-loader.d.ts.map +1 -0
- package/src/plugins/postcss/loaders/postcss-loader.js +172 -0
- package/src/plugins/postcss/loaders/sass-loader.d.ts +7 -0
- package/src/plugins/postcss/loaders/sass-loader.d.ts.map +1 -0
- package/src/plugins/postcss/loaders/sass-loader.js +164 -0
- package/src/plugins/postcss/loaders/stylus-loader.d.ts +7 -0
- package/src/plugins/postcss/loaders/stylus-loader.d.ts.map +1 -0
- package/src/plugins/postcss/loaders/stylus-loader.js +60 -0
- package/src/plugins/postcss/loaders/types.d.ts +88 -0
- package/src/plugins/postcss/loaders/types.d.ts.map +1 -0
- package/src/plugins/postcss/loaders/types.js +2 -0
- package/src/plugins/postcss/options.d.ts +111 -0
- package/src/plugins/postcss/options.d.ts.map +1 -0
- package/src/plugins/postcss/options.js +19 -0
- package/src/plugins/postcss/postcss-plugin.d.ts +10 -0
- package/src/plugins/postcss/postcss-plugin.d.ts.map +1 -0
- package/src/plugins/postcss/postcss-plugin.js +275 -0
- package/src/plugins/postcss/types/concat-with-sourcemaps.d.ts +29 -0
- package/src/plugins/postcss/utils/index.d.ts +5 -0
- package/src/plugins/postcss/utils/index.d.ts.map +1 -0
- package/src/plugins/postcss/utils/index.js +16 -0
- package/src/plugins/postcss/utils/load-module.d.ts +11 -0
- package/src/plugins/postcss/utils/load-module.d.ts.map +1 -0
- package/src/plugins/postcss/utils/load-module.js +36 -0
- package/src/plugins/postcss/utils/normalize-path.d.ts +10 -0
- package/src/plugins/postcss/utils/normalize-path.d.ts.map +1 -0
- package/src/plugins/postcss/utils/normalize-path.js +21 -0
- package/src/plugins/postcss/utils/safe-identifier.d.ts +14 -0
- package/src/plugins/postcss/utils/safe-identifier.d.ts.map +1 -0
- package/src/plugins/postcss/utils/safe-identifier.js +89 -0
- package/src/plugins/postcss/utils/style-inject.d.ts +21 -0
- package/src/plugins/postcss/utils/style-inject.d.ts.map +1 -0
- package/src/plugins/postcss/utils/style-inject.js +55 -0
- package/src/plugins/with-nx/with-nx.d.ts.map +1 -1
- package/src/plugins/with-nx/with-nx.js +3 -2
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.loadModule = loadModule;
|
|
4
|
+
exports.requireModule = requireModule;
|
|
5
|
+
const path_1 = require("path");
|
|
6
|
+
/**
|
|
7
|
+
* Load a module with fallback to loading from cwd
|
|
8
|
+
* This allows preprocessors like sass, less, stylus to be loaded from
|
|
9
|
+
* either the plugin's node_modules or the project's node_modules
|
|
10
|
+
*/
|
|
11
|
+
function loadModule(moduleId) {
|
|
12
|
+
try {
|
|
13
|
+
// First try to load from the plugin's node_modules
|
|
14
|
+
return require(moduleId);
|
|
15
|
+
}
|
|
16
|
+
catch {
|
|
17
|
+
// If that fails, try to load from the current working directory
|
|
18
|
+
try {
|
|
19
|
+
const modulePath = (0, path_1.resolve)(process.cwd(), 'node_modules', moduleId);
|
|
20
|
+
return require(modulePath);
|
|
21
|
+
}
|
|
22
|
+
catch {
|
|
23
|
+
return undefined;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Load a module and throw an error if it's not found
|
|
29
|
+
*/
|
|
30
|
+
function requireModule(moduleId, feature) {
|
|
31
|
+
const module = loadModule(moduleId);
|
|
32
|
+
if (!module) {
|
|
33
|
+
throw new Error(`You need to install "${moduleId}" package in order to process ${feature} files.`);
|
|
34
|
+
}
|
|
35
|
+
return module;
|
|
36
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Normalize file path to use forward slashes (POSIX style)
|
|
3
|
+
* This ensures consistent path handling across Windows and Unix systems
|
|
4
|
+
*/
|
|
5
|
+
export declare function normalizePath(path: string | undefined): string;
|
|
6
|
+
/**
|
|
7
|
+
* Convert an absolute path to a human-readable relative path from cwd
|
|
8
|
+
*/
|
|
9
|
+
export declare function humanizePath(filepath: string): string;
|
|
10
|
+
//# sourceMappingURL=normalize-path.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"normalize-path.d.ts","sourceRoot":"","sources":["../../../../../../../packages/rollup/src/plugins/postcss/utils/normalize-path.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAK9D;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAGrD"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.normalizePath = normalizePath;
|
|
4
|
+
exports.humanizePath = humanizePath;
|
|
5
|
+
/**
|
|
6
|
+
* Normalize file path to use forward slashes (POSIX style)
|
|
7
|
+
* This ensures consistent path handling across Windows and Unix systems
|
|
8
|
+
*/
|
|
9
|
+
function normalizePath(path) {
|
|
10
|
+
if (!path) {
|
|
11
|
+
return '';
|
|
12
|
+
}
|
|
13
|
+
return path.replace(/\\+/g, '/');
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Convert an absolute path to a human-readable relative path from cwd
|
|
17
|
+
*/
|
|
18
|
+
function humanizePath(filepath) {
|
|
19
|
+
const { relative } = require('path');
|
|
20
|
+
return normalizePath(relative(process.cwd(), filepath));
|
|
21
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Convert a CSS class name to a valid JavaScript identifier
|
|
3
|
+
* This is used when generating exports for CSS modules
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Escape dashes in class names to make them valid JS identifiers
|
|
7
|
+
* e.g., "my-class" -> "myClass"
|
|
8
|
+
*/
|
|
9
|
+
export declare function escapeClassNameDashes(name: string): string;
|
|
10
|
+
/**
|
|
11
|
+
* Convert a CSS class name to a safe JavaScript identifier
|
|
12
|
+
*/
|
|
13
|
+
export declare function safeIdentifier(name: string): string;
|
|
14
|
+
//# sourceMappingURL=safe-identifier.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"safe-identifier.d.ts","sourceRoot":"","sources":["../../../../../../../packages/rollup/src/plugins/postcss/utils/safe-identifier.ts"],"names":[],"mappings":"AAAA;;;GAGG;AA4DH;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAE1D;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAkBnD"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Convert a CSS class name to a valid JavaScript identifier
|
|
4
|
+
* This is used when generating exports for CSS modules
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.escapeClassNameDashes = escapeClassNameDashes;
|
|
8
|
+
exports.safeIdentifier = safeIdentifier;
|
|
9
|
+
/**
|
|
10
|
+
* Reserved JavaScript keywords that cannot be used as identifiers
|
|
11
|
+
*/
|
|
12
|
+
const RESERVED_WORDS = new Set([
|
|
13
|
+
'break',
|
|
14
|
+
'case',
|
|
15
|
+
'catch',
|
|
16
|
+
'continue',
|
|
17
|
+
'debugger',
|
|
18
|
+
'default',
|
|
19
|
+
'delete',
|
|
20
|
+
'do',
|
|
21
|
+
'else',
|
|
22
|
+
'finally',
|
|
23
|
+
'for',
|
|
24
|
+
'function',
|
|
25
|
+
'if',
|
|
26
|
+
'in',
|
|
27
|
+
'instanceof',
|
|
28
|
+
'new',
|
|
29
|
+
'return',
|
|
30
|
+
'switch',
|
|
31
|
+
'this',
|
|
32
|
+
'throw',
|
|
33
|
+
'try',
|
|
34
|
+
'typeof',
|
|
35
|
+
'var',
|
|
36
|
+
'void',
|
|
37
|
+
'while',
|
|
38
|
+
'with',
|
|
39
|
+
'class',
|
|
40
|
+
'const',
|
|
41
|
+
'enum',
|
|
42
|
+
'export',
|
|
43
|
+
'extends',
|
|
44
|
+
'import',
|
|
45
|
+
'super',
|
|
46
|
+
'implements',
|
|
47
|
+
'interface',
|
|
48
|
+
'let',
|
|
49
|
+
'package',
|
|
50
|
+
'private',
|
|
51
|
+
'protected',
|
|
52
|
+
'public',
|
|
53
|
+
'static',
|
|
54
|
+
'yield',
|
|
55
|
+
'null',
|
|
56
|
+
'true',
|
|
57
|
+
'false',
|
|
58
|
+
]);
|
|
59
|
+
/**
|
|
60
|
+
* Check if a string starts with a digit
|
|
61
|
+
*/
|
|
62
|
+
function startsWithDigit(str) {
|
|
63
|
+
return /^\d/.test(str);
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Escape dashes in class names to make them valid JS identifiers
|
|
67
|
+
* e.g., "my-class" -> "myClass"
|
|
68
|
+
*/
|
|
69
|
+
function escapeClassNameDashes(name) {
|
|
70
|
+
return name.replace(/-+(\w)/g, (_, char) => char.toUpperCase());
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Convert a CSS class name to a safe JavaScript identifier
|
|
74
|
+
*/
|
|
75
|
+
function safeIdentifier(name) {
|
|
76
|
+
// First escape dashes
|
|
77
|
+
let safeName = escapeClassNameDashes(name);
|
|
78
|
+
// If it starts with a digit, prefix with underscore
|
|
79
|
+
if (startsWithDigit(safeName)) {
|
|
80
|
+
safeName = '_' + safeName;
|
|
81
|
+
}
|
|
82
|
+
// If it's a reserved word, prefix with underscore
|
|
83
|
+
if (RESERVED_WORDS.has(safeName)) {
|
|
84
|
+
safeName = '_' + safeName;
|
|
85
|
+
}
|
|
86
|
+
// Replace any remaining invalid characters with underscores
|
|
87
|
+
safeName = safeName.replace(/[^a-zA-Z0-9_$]/g, '_');
|
|
88
|
+
return safeName;
|
|
89
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Inlined style-inject module
|
|
3
|
+
* Original: https://github.com/nicolo-ribaudo/style-inject
|
|
4
|
+
*
|
|
5
|
+
* This module is used at runtime to inject CSS into the DOM when
|
|
6
|
+
* the `inject` option is enabled and `extract` is disabled.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* The style-inject runtime code that gets injected into the bundle
|
|
10
|
+
* This is the ES module version that will be imported at runtime
|
|
11
|
+
*/
|
|
12
|
+
export declare const styleInjectCode: string;
|
|
13
|
+
/**
|
|
14
|
+
* Virtual module ID for style-inject
|
|
15
|
+
*/
|
|
16
|
+
export declare const STYLE_INJECT_ID = "\0style-inject";
|
|
17
|
+
/**
|
|
18
|
+
* Path that will be used in imports
|
|
19
|
+
*/
|
|
20
|
+
export declare const STYLE_INJECT_PATH = "style-inject";
|
|
21
|
+
//# sourceMappingURL=style-inject.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"style-inject.d.ts","sourceRoot":"","sources":["../../../../../../../packages/rollup/src/plugins/postcss/utils/style-inject.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;GAGG;AACH,eAAO,MAAM,eAAe,QAgCpB,CAAC;AAET;;GAEG;AACH,eAAO,MAAM,eAAe,mBAAmB,CAAC;AAEhD;;GAEG;AACH,eAAO,MAAM,iBAAiB,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Inlined style-inject module
|
|
4
|
+
* Original: https://github.com/nicolo-ribaudo/style-inject
|
|
5
|
+
*
|
|
6
|
+
* This module is used at runtime to inject CSS into the DOM when
|
|
7
|
+
* the `inject` option is enabled and `extract` is disabled.
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.STYLE_INJECT_PATH = exports.STYLE_INJECT_ID = exports.styleInjectCode = void 0;
|
|
11
|
+
/**
|
|
12
|
+
* The style-inject runtime code that gets injected into the bundle
|
|
13
|
+
* This is the ES module version that will be imported at runtime
|
|
14
|
+
*/
|
|
15
|
+
exports.styleInjectCode = `
|
|
16
|
+
function styleInject(css, ref) {
|
|
17
|
+
if (ref === void 0) ref = {};
|
|
18
|
+
var insertAt = ref.insertAt;
|
|
19
|
+
|
|
20
|
+
if (typeof document === 'undefined') {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
var head = document.head || document.getElementsByTagName('head')[0];
|
|
25
|
+
var style = document.createElement('style');
|
|
26
|
+
style.type = 'text/css';
|
|
27
|
+
|
|
28
|
+
if (insertAt === 'top') {
|
|
29
|
+
if (head.firstChild) {
|
|
30
|
+
head.insertBefore(style, head.firstChild);
|
|
31
|
+
} else {
|
|
32
|
+
head.appendChild(style);
|
|
33
|
+
}
|
|
34
|
+
} else {
|
|
35
|
+
head.appendChild(style);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
if (style.styleSheet) {
|
|
39
|
+
style.styleSheet.cssText = css;
|
|
40
|
+
} else {
|
|
41
|
+
style.appendChild(document.createTextNode(css));
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export { styleInject };
|
|
46
|
+
export default styleInject;
|
|
47
|
+
`.trim();
|
|
48
|
+
/**
|
|
49
|
+
* Virtual module ID for style-inject
|
|
50
|
+
*/
|
|
51
|
+
exports.STYLE_INJECT_ID = '\0style-inject';
|
|
52
|
+
/**
|
|
53
|
+
* Path that will be used in imports
|
|
54
|
+
*/
|
|
55
|
+
exports.STYLE_INJECT_PATH = 'style-inject';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"with-nx.d.ts","sourceRoot":"","sources":["../../../../../../packages/rollup/src/plugins/with-nx/with-nx.ts"],"names":[],"mappings":"AASA,OAAO,EAIL,6BAA6B,EAC9B,MAAM,uCAAuC,CAAC;AAW/C,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AAQjC,OAAO,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"with-nx.d.ts","sourceRoot":"","sources":["../../../../../../packages/rollup/src/plugins/with-nx/with-nx.ts"],"names":[],"mappings":"AASA,OAAO,EAIL,6BAA6B,EAC9B,MAAM,uCAAuC,CAAC;AAW/C,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AAQjC,OAAO,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AA4B9D,wBAAgB,MAAM,CACpB,UAAU,EAAE,yBAAyB,EACrC,YAAY,GAAE,MAAM,CAAC,aAAkB,EAEvC,YAAY,CAAC,EAAE,6BAA6B,EAAE,GAC7C,MAAM,CAAC,aAAa,CAwRtB"}
|
|
@@ -21,7 +21,8 @@ const normalize_options_1 = require("./normalize-options");
|
|
|
21
21
|
const commonjs = require('@rollup/plugin-commonjs');
|
|
22
22
|
const image = require('@rollup/plugin-image');
|
|
23
23
|
const json = require('@rollup/plugin-json');
|
|
24
|
-
|
|
24
|
+
// Use our inlined postcss plugin instead of external rollup-plugin-postcss
|
|
25
|
+
const postcss_1 = require("../postcss");
|
|
25
26
|
const fileExtensions = ['.js', '.jsx', '.ts', '.tsx'];
|
|
26
27
|
let ts;
|
|
27
28
|
function ensureTypeScript() {
|
|
@@ -197,7 +198,7 @@ dependencies) {
|
|
|
197
198
|
(0, type_definitions_1.typeDefinitions)({
|
|
198
199
|
projectRoot,
|
|
199
200
|
}),
|
|
200
|
-
postcss({
|
|
201
|
+
(0, postcss_1.postcss)({
|
|
201
202
|
inject: true,
|
|
202
203
|
extract: options.extractCss,
|
|
203
204
|
autoModules: true,
|