auklet 0.0.16 → 0.0.17
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/build/bundleConfig.d.ts +1 -4
- package/dist/build/bundleConfig.js +59 -71
- package/dist/build/cleanOutput.d.ts +2 -8
- package/dist/build/cleanOutput.js +7 -7
- package/dist/build/moduleConfig.d.ts +1 -3
- package/dist/build/moduleConfig.js +21 -40
- package/dist/build/runTsdown.d.ts +2 -5
- package/dist/build/runTsdown.js +18 -23
- package/dist/build/tsdown/common.d.ts +17 -28
- package/dist/build/tsdown/common.js +22 -25
- package/dist/build/tsdown/context.d.ts +16 -20
- package/dist/build/tsdown/context.js +41 -45
- package/dist/build/tsdown/define.d.ts +2 -7
- package/dist/build/tsdown/define.js +13 -22
- package/dist/build/tsdown/dependencies.d.ts +4 -12
- package/dist/build/tsdown/dependencies.js +47 -51
- package/dist/build/tsdown/entries.d.ts +4 -6
- package/dist/build/tsdown/entries.js +39 -38
- package/dist/build/tsdown/parseModuleId.d.ts +4 -4
- package/dist/build/tsdown/parseModuleId.js +92 -77
- package/dist/build/tsdown/types.d.ts +24 -31
- package/dist/build/tsdownConfig.js +1 -4
- package/dist/config.d.ts +37 -37
- package/dist/config.js +38 -41
- package/dist/configLoader.d.ts +2 -7
- package/dist/configLoader.js +59 -64
- package/dist/css/config.js +8 -8
- package/dist/css/constants.d.ts +6 -6
- package/dist/css/core/resolvers/packageImports.d.ts +1 -5
- package/dist/css/core/resolvers/packageImports.js +35 -40
- package/dist/css/core/resolvers/relative.d.ts +1 -4
- package/dist/css/core/resolvers/relative.js +3 -2
- package/dist/css/core/resolvers/tsconfigPaths.d.ts +1 -5
- package/dist/css/core/resolvers/tsconfigPaths.js +59 -66
- package/dist/css/core/style/dependencies.d.ts +6 -16
- package/dist/css/core/style/dependencies.js +35 -38
- package/dist/css/core/style/entries.d.ts +35 -58
- package/dist/css/core/style/entries.js +20 -31
- package/dist/css/core/style/files.d.ts +2 -7
- package/dist/css/core/style/files.js +11 -11
- package/dist/css/core/style/specifier.d.ts +5 -8
- package/dist/css/core/style/specifier.js +21 -18
- package/dist/css/core/styleImports/collector.d.ts +17 -25
- package/dist/css/core/styleImports/collector.js +162 -201
- package/dist/css/core/styleImports/sourceReference.d.ts +8 -16
- package/dist/css/core/styleImports/sourceReference.js +153 -173
- package/dist/css/core/styleModuleEntryPlanner.d.ts +21 -24
- package/dist/css/core/styleModuleEntryPlanner.js +44 -61
- package/dist/css/core/stylePackageContext.d.ts +16 -20
- package/dist/css/core/stylePackageContext.js +33 -49
- package/dist/css/core/styleProcessor.js +105 -104
- package/dist/css/core/workspaceStyleResolver.d.ts +9 -15
- package/dist/css/core/workspaceStyleResolver.js +62 -72
- package/dist/css/production/builder.d.ts +9 -16
- package/dist/css/production/builder.js +51 -57
- package/dist/css/production/format/componentWriter.js +45 -66
- package/dist/css/production/format/entryWriter.js +36 -49
- package/dist/css/production/format/externalWriter.js +21 -33
- package/dist/css/production/format/moduleWriter.js +23 -26
- package/dist/css/production/format/shared.d.ts +8 -15
- package/dist/css/production/format/shared.js +5 -6
- package/dist/css/production/format/sourceWriter.js +11 -11
- package/dist/css/production/format/themeWriter.js +56 -71
- package/dist/css/production/moduleOutputWriter.d.ts +18 -21
- package/dist/css/production/moduleOutputWriter.js +56 -65
- package/dist/css/production/packageEntryWriter.d.ts +12 -15
- package/dist/css/production/packageEntryWriter.js +42 -45
- package/dist/css/vite/hmr.d.ts +11 -11
- package/dist/css/vite/hmr.js +93 -109
- package/dist/css/vite/moduleGraph/devDependency.d.ts +7 -12
- package/dist/css/vite/moduleGraph/devDependency.js +8 -8
- package/dist/css/vite/moduleGraph/graph.d.ts +20 -23
- package/dist/css/vite/moduleGraph/graph.js +46 -49
- package/dist/css/vite/moduleGraph/loadResult.d.ts +3 -5
- package/dist/css/vite/moduleGraph/loadResult.js +7 -9
- package/dist/css/vite/moduleGraph/packageSource/monorepo.d.ts +4 -6
- package/dist/css/vite/moduleGraph/packageSource/monorepo.js +59 -64
- package/dist/css/vite/moduleGraph/packageSource/types.d.ts +7 -7
- package/dist/css/vite/moduleGraph/requestCache.d.ts +46 -57
- package/dist/css/vite/moduleGraph/requestCache.js +53 -51
- package/dist/css/vite/moduleGraph/styleCodeFactory.d.ts +15 -18
- package/dist/css/vite/moduleGraph/styleCodeFactory.js +182 -263
- package/dist/css/vite/moduleGraph/styleId.d.ts +3 -6
- package/dist/css/vite/moduleGraph/styleId.js +12 -11
- package/dist/css/vite/moduleGraph/types.d.ts +11 -14
- package/dist/css/vite/vitePlugin.d.ts +16 -20
- package/dist/css/vite/vitePlugin.js +110 -109
- package/dist/css/watch/watcher.d.ts +15 -21
- package/dist/css/watch/watcher.js +83 -80
- package/dist/index.d.ts +3 -25
- package/dist/index.js +2 -9
- package/dist/types.d.ts +59 -62
- package/dist/utils.d.ts +3 -7
- package/dist/utils.js +50 -47
- package/package.json +31 -33
|
@@ -1,55 +1,42 @@
|
|
|
1
1
|
import path from 'node:path';
|
|
2
2
|
import { createStyleEntryParts } from '#auklet/css/core/style/entries';
|
|
3
|
-
import {
|
|
4
|
-
writeStyleFile,
|
|
5
|
-
toRelativeImportSpecifier,
|
|
6
|
-
} from '#auklet/css/production/format/shared';
|
|
3
|
+
import { writeStyleFile, toRelativeImportSpecifier, } from '#auklet/css/production/format/shared';
|
|
7
4
|
export class StyleEntryWriter {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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
|
-
toRelativeImportSpecifier(styleDir, themeStyle),
|
|
40
|
-
);
|
|
5
|
+
config;
|
|
6
|
+
packageContext;
|
|
7
|
+
styleProcessor;
|
|
8
|
+
constructor(options) {
|
|
9
|
+
this.config = options.config;
|
|
10
|
+
this.packageContext = options.packageContext;
|
|
11
|
+
this.styleProcessor = options.packageContext.styleProcessor;
|
|
12
|
+
}
|
|
13
|
+
write(outRoot, themeStyles, moduleStyle) {
|
|
14
|
+
const target = path.join(outRoot, this.config.output.styleDir, this.config.output.indexStyleFile);
|
|
15
|
+
const root = this.styleProcessor.createRoot();
|
|
16
|
+
const styleDir = path.dirname(target);
|
|
17
|
+
for (const part of createStyleEntryParts(this.packageContext.normalizedConfig)) {
|
|
18
|
+
if (part.type === 'dependencies') {
|
|
19
|
+
for (const specifier of part.specifiers) {
|
|
20
|
+
this.styleProcessor.appendImportRule(root, specifier);
|
|
21
|
+
}
|
|
22
|
+
continue;
|
|
23
|
+
}
|
|
24
|
+
if (part.type === 'themes') {
|
|
25
|
+
for (const themeName of part.themeNames) {
|
|
26
|
+
const themeStyle = themeStyles.get(themeName);
|
|
27
|
+
if (!themeStyle)
|
|
28
|
+
continue;
|
|
29
|
+
this.styleProcessor.appendImportRule(root, toRelativeImportSpecifier(styleDir, themeStyle));
|
|
30
|
+
}
|
|
31
|
+
continue;
|
|
32
|
+
}
|
|
33
|
+
if (moduleStyle) {
|
|
34
|
+
this.styleProcessor.appendImportRule(root, toRelativeImportSpecifier(styleDir, moduleStyle));
|
|
35
|
+
}
|
|
41
36
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
root,
|
|
47
|
-
toRelativeImportSpecifier(styleDir, moduleStyle),
|
|
48
|
-
);
|
|
49
|
-
}
|
|
37
|
+
if (!root.nodes?.length)
|
|
38
|
+
return null;
|
|
39
|
+
writeStyleFile(target, this.styleProcessor.stringify(root));
|
|
40
|
+
return target;
|
|
50
41
|
}
|
|
51
|
-
if (!root.nodes?.length) return null;
|
|
52
|
-
writeStyleFile(target, this.styleProcessor.stringify(root));
|
|
53
|
-
return target;
|
|
54
|
-
}
|
|
55
42
|
}
|
|
@@ -1,38 +1,26 @@
|
|
|
1
1
|
import path from 'node:path';
|
|
2
2
|
import { createExternalEntryParts } from '#auklet/css/core/style/entries';
|
|
3
|
-
import { writeStyleFile } from '#auklet/css/production/format/shared';
|
|
3
|
+
import { writeStyleFile, } from '#auklet/css/production/format/shared';
|
|
4
4
|
export class ExternalStyleWriter {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
for (const specifier of part.specifiers) {
|
|
26
|
-
this.styleProcessor.appendImportRule(
|
|
27
|
-
root,
|
|
28
|
-
this.resolver.toExternalStyleSpecifier(specifier, outRoot),
|
|
29
|
-
);
|
|
30
|
-
}
|
|
5
|
+
config;
|
|
6
|
+
packageContext;
|
|
7
|
+
resolver;
|
|
8
|
+
styleProcessor;
|
|
9
|
+
constructor(options) {
|
|
10
|
+
this.config = options.config;
|
|
11
|
+
this.packageContext = options.packageContext;
|
|
12
|
+
this.resolver = options.packageContext.resolver;
|
|
13
|
+
this.styleProcessor = options.packageContext.styleProcessor;
|
|
14
|
+
}
|
|
15
|
+
write(outRoot) {
|
|
16
|
+
const target = path.join(outRoot, this.config.output.styleDir, this.config.output.externalStyleFile);
|
|
17
|
+
const root = this.styleProcessor.createRoot();
|
|
18
|
+
for (const part of createExternalEntryParts(this.packageContext.normalizedConfig)) {
|
|
19
|
+
for (const specifier of part.specifiers) {
|
|
20
|
+
this.styleProcessor.appendImportRule(root, this.resolver.toExternalStyleSpecifier(specifier, outRoot));
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
writeStyleFile(target, root.nodes?.length ? this.styleProcessor.stringify(root) : '');
|
|
24
|
+
return target;
|
|
31
25
|
}
|
|
32
|
-
writeStyleFile(
|
|
33
|
-
target,
|
|
34
|
-
root.nodes?.length ? this.styleProcessor.stringify(root) : '',
|
|
35
|
-
);
|
|
36
|
-
return target;
|
|
37
|
-
}
|
|
38
26
|
}
|
|
@@ -1,30 +1,27 @@
|
|
|
1
1
|
import path from 'node:path';
|
|
2
|
-
import { writeStyleFile } from '#auklet/css/production/format/shared';
|
|
2
|
+
import { writeStyleFile, } from '#auklet/css/production/format/shared';
|
|
3
3
|
export class ModuleStyleWriter {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
4
|
+
config;
|
|
5
|
+
packageContext;
|
|
6
|
+
styleProcessor;
|
|
7
|
+
constructor(options) {
|
|
8
|
+
this.config = options.config;
|
|
9
|
+
this.packageContext = options.packageContext;
|
|
10
|
+
this.styleProcessor = options.packageContext.styleProcessor;
|
|
11
|
+
}
|
|
12
|
+
write(outRoot) {
|
|
13
|
+
const target = path.join(outRoot, this.config.output.styleDir, this.config.output.moduleStyleFile);
|
|
14
|
+
const seen = new Set();
|
|
15
|
+
const root = this.styleProcessor.createRoot();
|
|
16
|
+
for (const styleFile of this.packageContext.styleFiles) {
|
|
17
|
+
const content = this.styleProcessor.readStyleFile(styleFile, seen);
|
|
18
|
+
if (content.trim()) {
|
|
19
|
+
this.styleProcessor.appendStyleContent(root, content, styleFile);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
if (!root.nodes?.length)
|
|
23
|
+
return null;
|
|
24
|
+
writeStyleFile(target, this.styleProcessor.stringify(root));
|
|
25
|
+
return target;
|
|
25
26
|
}
|
|
26
|
-
if (!root.nodes?.length) return null;
|
|
27
|
-
writeStyleFile(target, this.styleProcessor.stringify(root));
|
|
28
|
-
return target;
|
|
29
|
-
}
|
|
30
27
|
}
|
|
@@ -1,21 +1,14 @@
|
|
|
1
1
|
import type { StylePackageContext } from '#auklet/css/core/stylePackageContext';
|
|
2
|
-
import type {
|
|
3
|
-
|
|
4
|
-
ResolvedModuleStyleBuildContext,
|
|
5
|
-
} from '#auklet/types';
|
|
6
|
-
export declare const emptyStyleFileComment =
|
|
7
|
-
'/* Empty style file kept so automated tooling can resolve this CSS path. */\n';
|
|
2
|
+
import type { ModuleStyleBuildConfig, ResolvedModuleStyleBuildContext } from '#auklet/types';
|
|
3
|
+
export declare const emptyStyleFileComment = "/* Empty style file kept so automated tooling can resolve this CSS path. */\n";
|
|
8
4
|
export type FormatWriterOptions = {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
5
|
+
config: ModuleStyleBuildConfig;
|
|
6
|
+
context: ResolvedModuleStyleBuildContext;
|
|
7
|
+
packageContext: StylePackageContext;
|
|
12
8
|
};
|
|
13
9
|
export type ThemeStyleOutput = {
|
|
14
|
-
|
|
15
|
-
|
|
10
|
+
themeName: string;
|
|
11
|
+
file: string;
|
|
16
12
|
};
|
|
17
|
-
export declare function toRelativeImportSpecifier(
|
|
18
|
-
fromDir: string,
|
|
19
|
-
file: string,
|
|
20
|
-
): string;
|
|
13
|
+
export declare function toRelativeImportSpecifier(fromDir: string, file: string): string;
|
|
21
14
|
export declare function writeStyleFile(file: string, code: string): void;
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import fs from 'node:fs';
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
import { toPosixPath } from '#auklet/utils';
|
|
4
|
-
export const emptyStyleFileComment =
|
|
5
|
-
'/* Empty style file kept so automated tooling can resolve this CSS path. */\n';
|
|
4
|
+
export const emptyStyleFileComment = '/* Empty style file kept so automated tooling can resolve this CSS path. */\n';
|
|
6
5
|
export function toRelativeImportSpecifier(fromDir, file) {
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
const relative = toPosixPath(path.relative(fromDir, file));
|
|
7
|
+
return relative.startsWith('.') ? relative : `./${relative}`;
|
|
9
8
|
}
|
|
10
9
|
export function writeStyleFile(file, code) {
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
fs.mkdirSync(path.dirname(file), { recursive: true });
|
|
11
|
+
fs.writeFileSync(file, code.trim() ? code : emptyStyleFileComment);
|
|
13
12
|
}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import fs from 'node:fs';
|
|
2
2
|
import path from 'node:path';
|
|
3
|
-
import { writeStyleFile } from '#auklet/css/production/format/shared';
|
|
3
|
+
import { writeStyleFile, } from '#auklet/css/production/format/shared';
|
|
4
4
|
export class SourceStyleFileWriter {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
5
|
+
sourceRoot;
|
|
6
|
+
constructor(options) {
|
|
7
|
+
this.sourceRoot = options.packageContext.sourceRoot;
|
|
8
|
+
}
|
|
9
|
+
copy(files, outRoot) {
|
|
10
|
+
for (const sourceFile of files) {
|
|
11
|
+
const relative = path.relative(this.sourceRoot, sourceFile);
|
|
12
|
+
const target = path.join(outRoot, relative);
|
|
13
|
+
writeStyleFile(target, fs.readFileSync(sourceFile, 'utf8'));
|
|
14
|
+
}
|
|
14
15
|
}
|
|
15
|
-
}
|
|
16
16
|
}
|
|
@@ -2,80 +2,65 @@ import fs from 'node:fs';
|
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
import { THEMES_DIR } from '#auklet/css/constants';
|
|
4
4
|
import { createThemeEntryParts } from '#auklet/css/core/style/entries';
|
|
5
|
-
import {
|
|
6
|
-
writeStyleFile,
|
|
7
|
-
toRelativeImportSpecifier,
|
|
8
|
-
} from '#auklet/css/production/format/shared';
|
|
5
|
+
import { writeStyleFile, toRelativeImportSpecifier, } from '#auklet/css/production/format/shared';
|
|
9
6
|
export class ThemeStyleWriter {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
clean(outRoot) {
|
|
19
|
-
fs.rmSync(path.join(outRoot, THEMES_DIR), {
|
|
20
|
-
recursive: true,
|
|
21
|
-
force: true,
|
|
22
|
-
});
|
|
23
|
-
fs.rmSync(path.join(outRoot, this.config.output.styleDir, THEMES_DIR), {
|
|
24
|
-
recursive: true,
|
|
25
|
-
force: true,
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
writeThemeStyles(outRoot) {
|
|
29
|
-
const outputs = [];
|
|
30
|
-
const themesDir = path.join(
|
|
31
|
-
outRoot,
|
|
32
|
-
this.config.output.styleDir,
|
|
33
|
-
THEMES_DIR,
|
|
34
|
-
);
|
|
35
|
-
for (const [themeName, stylePath] of this.packageContext.themeFiles) {
|
|
36
|
-
const root = this.styleProcessor.createRoot();
|
|
37
|
-
const content = this.styleProcessor.readStyleFile(stylePath);
|
|
38
|
-
if (content.trim()) {
|
|
39
|
-
this.styleProcessor.appendStyleContent(root, content, stylePath);
|
|
40
|
-
}
|
|
41
|
-
const target = path.join(themesDir, `${themeName}.css`);
|
|
42
|
-
writeStyleFile(
|
|
43
|
-
target,
|
|
44
|
-
root.nodes?.length ? this.styleProcessor.stringify(root) : '',
|
|
45
|
-
);
|
|
46
|
-
outputs.push({ themeName, file: target });
|
|
7
|
+
config;
|
|
8
|
+
packageContext;
|
|
9
|
+
styleProcessor;
|
|
10
|
+
constructor(options) {
|
|
11
|
+
this.config = options.config;
|
|
12
|
+
this.packageContext = options.packageContext;
|
|
13
|
+
this.styleProcessor = options.packageContext.styleProcessor;
|
|
47
14
|
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
15
|
+
clean(outRoot) {
|
|
16
|
+
fs.rmSync(path.join(outRoot, THEMES_DIR), {
|
|
17
|
+
recursive: true,
|
|
18
|
+
force: true,
|
|
19
|
+
});
|
|
20
|
+
fs.rmSync(path.join(outRoot, this.config.output.styleDir, THEMES_DIR), {
|
|
21
|
+
recursive: true,
|
|
22
|
+
force: true,
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
writeThemeStyles(outRoot) {
|
|
26
|
+
const outputs = [];
|
|
27
|
+
const themesDir = path.join(outRoot, this.config.output.styleDir, THEMES_DIR);
|
|
28
|
+
for (const [themeName, stylePath] of this.packageContext.themeFiles) {
|
|
29
|
+
const root = this.styleProcessor.createRoot();
|
|
30
|
+
const content = this.styleProcessor.readStyleFile(stylePath);
|
|
31
|
+
if (content.trim()) {
|
|
32
|
+
this.styleProcessor.appendStyleContent(root, content, stylePath);
|
|
33
|
+
}
|
|
34
|
+
const target = path.join(themesDir, `${themeName}.css`);
|
|
35
|
+
writeStyleFile(target, root.nodes?.length ? this.styleProcessor.stringify(root) : '');
|
|
36
|
+
outputs.push({ themeName, file: target });
|
|
67
37
|
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
38
|
+
return outputs;
|
|
39
|
+
}
|
|
40
|
+
writeThemeEntries(themeStyles, outRoot) {
|
|
41
|
+
const outputs = [];
|
|
42
|
+
const themesDir = path.join(outRoot, THEMES_DIR);
|
|
43
|
+
for (const themeName of this.packageContext.themeNames) {
|
|
44
|
+
const target = path.join(themesDir, `${themeName}.css`);
|
|
45
|
+
const root = this.styleProcessor.createRoot();
|
|
46
|
+
const targetDir = path.dirname(target);
|
|
47
|
+
const themeStyle = themeStyles.get(themeName);
|
|
48
|
+
for (const part of createThemeEntryParts(this.packageContext.normalizedConfig, themeName)) {
|
|
49
|
+
if (part.type === 'dependencies') {
|
|
50
|
+
for (const specifier of part.specifiers) {
|
|
51
|
+
this.styleProcessor.appendImportRule(root, specifier);
|
|
52
|
+
}
|
|
53
|
+
continue;
|
|
54
|
+
}
|
|
55
|
+
if (themeStyle) {
|
|
56
|
+
this.styleProcessor.appendImportRule(root, toRelativeImportSpecifier(targetDir, themeStyle));
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
if (!root.nodes?.length)
|
|
60
|
+
continue;
|
|
61
|
+
writeStyleFile(target, this.styleProcessor.stringify(root));
|
|
62
|
+
outputs.push(target);
|
|
73
63
|
}
|
|
74
|
-
|
|
75
|
-
if (!root.nodes?.length) continue;
|
|
76
|
-
writeStyleFile(target, this.styleProcessor.stringify(root));
|
|
77
|
-
outputs.push(target);
|
|
64
|
+
return outputs;
|
|
78
65
|
}
|
|
79
|
-
return outputs;
|
|
80
|
-
}
|
|
81
66
|
}
|
|
@@ -1,26 +1,23 @@
|
|
|
1
1
|
import type { StylePackageContext } from '#auklet/css/core/stylePackageContext';
|
|
2
|
-
import type {
|
|
3
|
-
ModuleStyleBuildConfig,
|
|
4
|
-
ResolvedModuleStyleBuildContext,
|
|
5
|
-
} from '#auklet/types';
|
|
2
|
+
import type { ModuleStyleBuildConfig, ResolvedModuleStyleBuildContext } from '#auklet/types';
|
|
6
3
|
export type ModuleStyleOutputWriterOptions = {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
config: ModuleStyleBuildConfig;
|
|
5
|
+
context: ResolvedModuleStyleBuildContext;
|
|
6
|
+
packageContext: StylePackageContext;
|
|
10
7
|
};
|
|
11
8
|
export declare class ModuleStyleOutputWriter {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
9
|
+
private readonly config;
|
|
10
|
+
private readonly context;
|
|
11
|
+
private readonly packageContext;
|
|
12
|
+
private readonly sourceWriter;
|
|
13
|
+
private readonly themeWriter;
|
|
14
|
+
private readonly externalWriter;
|
|
15
|
+
private readonly moduleWriter;
|
|
16
|
+
private readonly entryWriter;
|
|
17
|
+
private readonly componentWriter;
|
|
18
|
+
constructor(options: ModuleStyleOutputWriterOptions);
|
|
19
|
+
write(): string[];
|
|
20
|
+
private get outputRoot();
|
|
21
|
+
private createComponentEntries;
|
|
22
|
+
private writeFormat;
|
|
26
23
|
}
|
|
@@ -8,70 +8,61 @@ import { SourceStyleFileWriter } from '#auklet/css/production/format/sourceWrite
|
|
|
8
8
|
import { ThemeStyleWriter } from '#auklet/css/production/format/themeWriter';
|
|
9
9
|
// Coordinates all module-mode style output under format directories such as `dist/es` and `dist/lib`.
|
|
10
10
|
export class ModuleStyleOutputWriter {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
11
|
+
config;
|
|
12
|
+
context;
|
|
13
|
+
packageContext;
|
|
14
|
+
sourceWriter;
|
|
15
|
+
themeWriter;
|
|
16
|
+
externalWriter;
|
|
17
|
+
moduleWriter;
|
|
18
|
+
entryWriter;
|
|
19
|
+
componentWriter;
|
|
20
|
+
constructor(options) {
|
|
21
|
+
this.config = options.config;
|
|
22
|
+
this.context = options.context;
|
|
23
|
+
this.packageContext = options.packageContext;
|
|
24
|
+
this.sourceWriter = new SourceStyleFileWriter(options);
|
|
25
|
+
this.themeWriter = new ThemeStyleWriter(options);
|
|
26
|
+
this.externalWriter = new ExternalStyleWriter(options);
|
|
27
|
+
this.moduleWriter = new ModuleStyleWriter(options);
|
|
28
|
+
this.entryWriter = new StyleEntryWriter(options);
|
|
29
|
+
this.componentWriter = new ComponentStyleEntryWriter(options);
|
|
30
|
+
}
|
|
31
|
+
write() {
|
|
32
|
+
const componentEntries = this.createComponentEntries();
|
|
33
|
+
const outputs = [];
|
|
34
|
+
for (const format of this.config.output.outputFormats) {
|
|
35
|
+
outputs.push(...this.writeFormat(format, componentEntries));
|
|
36
|
+
}
|
|
37
|
+
return outputs;
|
|
38
|
+
}
|
|
39
|
+
get outputRoot() {
|
|
40
|
+
return path.join(this.context.packageRoot, this.context.outputDir);
|
|
41
|
+
}
|
|
42
|
+
createComponentEntries() {
|
|
43
|
+
return createComponentStyleEntryPlans(this.packageContext);
|
|
44
|
+
}
|
|
45
|
+
writeFormat(format, componentEntries) {
|
|
46
|
+
const outRoot = path.join(this.outputRoot, format);
|
|
47
|
+
const outputs = [];
|
|
48
|
+
this.themeWriter.clean(outRoot);
|
|
49
|
+
this.sourceWriter.copy(this.packageContext.styleFiles, outRoot);
|
|
50
|
+
const themeStyles = this.themeWriter.writeThemeStyles(outRoot);
|
|
51
|
+
const themeStyleMap = new Map(themeStyles.map((themeStyle) => [themeStyle.themeName, themeStyle.file]));
|
|
52
|
+
const themeEntries = this.themeWriter.writeThemeEntries(themeStyleMap, outRoot);
|
|
53
|
+
const externalStyle = this.externalWriter.write(outRoot);
|
|
54
|
+
const moduleStyle = this.moduleWriter.write(outRoot);
|
|
55
|
+
const entryStyle = this.entryWriter.write(outRoot, themeStyleMap, moduleStyle);
|
|
56
|
+
const componentStyles = this.componentWriter.write(outRoot, componentEntries);
|
|
57
|
+
outputs.push(...themeStyles.map((themeStyle) => themeStyle.file));
|
|
58
|
+
outputs.push(...themeEntries);
|
|
59
|
+
if (externalStyle)
|
|
60
|
+
outputs.push(externalStyle);
|
|
61
|
+
if (moduleStyle)
|
|
62
|
+
outputs.push(moduleStyle);
|
|
63
|
+
if (entryStyle)
|
|
64
|
+
outputs.push(entryStyle);
|
|
65
|
+
outputs.push(...componentStyles);
|
|
66
|
+
return outputs;
|
|
36
67
|
}
|
|
37
|
-
return outputs;
|
|
38
|
-
}
|
|
39
|
-
get outputRoot() {
|
|
40
|
-
return path.join(this.context.packageRoot, this.context.outputDir);
|
|
41
|
-
}
|
|
42
|
-
createComponentEntries() {
|
|
43
|
-
return createComponentStyleEntryPlans(this.packageContext);
|
|
44
|
-
}
|
|
45
|
-
writeFormat(format, componentEntries) {
|
|
46
|
-
const outRoot = path.join(this.outputRoot, format);
|
|
47
|
-
const outputs = [];
|
|
48
|
-
this.themeWriter.clean(outRoot);
|
|
49
|
-
this.sourceWriter.copy(this.packageContext.styleFiles, outRoot);
|
|
50
|
-
const themeStyles = this.themeWriter.writeThemeStyles(outRoot);
|
|
51
|
-
const themeStyleMap = new Map(
|
|
52
|
-
themeStyles.map((themeStyle) => [themeStyle.themeName, themeStyle.file]),
|
|
53
|
-
);
|
|
54
|
-
const themeEntries = this.themeWriter.writeThemeEntries(
|
|
55
|
-
themeStyleMap,
|
|
56
|
-
outRoot,
|
|
57
|
-
);
|
|
58
|
-
const externalStyle = this.externalWriter.write(outRoot);
|
|
59
|
-
const moduleStyle = this.moduleWriter.write(outRoot);
|
|
60
|
-
const entryStyle = this.entryWriter.write(
|
|
61
|
-
outRoot,
|
|
62
|
-
themeStyleMap,
|
|
63
|
-
moduleStyle,
|
|
64
|
-
);
|
|
65
|
-
const componentStyles = this.componentWriter.write(
|
|
66
|
-
outRoot,
|
|
67
|
-
componentEntries,
|
|
68
|
-
);
|
|
69
|
-
outputs.push(...themeStyles.map((themeStyle) => themeStyle.file));
|
|
70
|
-
outputs.push(...themeEntries);
|
|
71
|
-
if (externalStyle) outputs.push(externalStyle);
|
|
72
|
-
if (moduleStyle) outputs.push(moduleStyle);
|
|
73
|
-
if (entryStyle) outputs.push(entryStyle);
|
|
74
|
-
outputs.push(...componentStyles);
|
|
75
|
-
return outputs;
|
|
76
|
-
}
|
|
77
68
|
}
|
|
@@ -1,20 +1,17 @@
|
|
|
1
1
|
import type { StylePackageContext } from '#auklet/css/core/stylePackageContext';
|
|
2
|
-
import type {
|
|
3
|
-
ModuleStyleBuildConfig,
|
|
4
|
-
ResolvedModuleStyleBuildContext,
|
|
5
|
-
} from '#auklet/types';
|
|
2
|
+
import type { ModuleStyleBuildConfig, ResolvedModuleStyleBuildContext } from '#auklet/types';
|
|
6
3
|
export type PackageStyleEntryWriterOptions = {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
config: ModuleStyleBuildConfig;
|
|
5
|
+
context: ResolvedModuleStyleBuildContext;
|
|
6
|
+
packageContext: StylePackageContext;
|
|
10
7
|
};
|
|
11
8
|
export declare class PackageStyleEntryWriter {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
9
|
+
private readonly config;
|
|
10
|
+
private readonly context;
|
|
11
|
+
private readonly packageContext;
|
|
12
|
+
private readonly resolver;
|
|
13
|
+
private readonly styleProcessor;
|
|
14
|
+
constructor(options: PackageStyleEntryWriterOptions);
|
|
15
|
+
write(): string | null;
|
|
16
|
+
private get outputRoot();
|
|
20
17
|
}
|