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,75 +1,52 @@
|
|
|
1
1
|
import type { StylePackageContext } from '#auklet/css/core/stylePackageContext';
|
|
2
2
|
import type { NormalizedAukletConfig } from '#auklet/types';
|
|
3
3
|
type StyleModulePart = {
|
|
4
|
-
|
|
4
|
+
type: 'module';
|
|
5
5
|
};
|
|
6
6
|
type StyleThemesPart = {
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
type: 'themes';
|
|
8
|
+
themeNames: Array<string>;
|
|
9
9
|
};
|
|
10
10
|
type DependenciesPart = {
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
type: 'dependencies';
|
|
12
|
+
specifiers: Array<string>;
|
|
13
13
|
};
|
|
14
14
|
type ThemePart = {
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
type: 'theme';
|
|
16
|
+
themeName: string;
|
|
17
17
|
};
|
|
18
18
|
export type ExternalEntryPart = DependenciesPart;
|
|
19
19
|
export type ThemeEntryPart = DependenciesPart | ThemePart;
|
|
20
|
-
export type StyleEntryPart =
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}
|
|
33
|
-
| {
|
|
34
|
-
type: 'module';
|
|
35
|
-
themeNames?: undefined;
|
|
36
|
-
}
|
|
37
|
-
)[];
|
|
38
|
-
export declare function createThemeEntryParts(
|
|
39
|
-
config: NormalizedAukletConfig,
|
|
40
|
-
themeName: string,
|
|
41
|
-
options?: {
|
|
20
|
+
export type StyleEntryPart = DependenciesPart | StyleThemesPart | StyleModulePart;
|
|
21
|
+
export declare function createStyleEntryParts(config: NormalizedAukletConfig): ({
|
|
22
|
+
type: "dependencies";
|
|
23
|
+
specifiers: string[];
|
|
24
|
+
} | {
|
|
25
|
+
type: "themes";
|
|
26
|
+
themeNames: string[];
|
|
27
|
+
} | {
|
|
28
|
+
type: "module";
|
|
29
|
+
themeNames?: undefined;
|
|
30
|
+
})[];
|
|
31
|
+
export declare function createThemeEntryParts(config: NormalizedAukletConfig, themeName: string, options?: {
|
|
42
32
|
includeDependencies?: boolean;
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
)[];
|
|
51
|
-
export declare function createExternalEntryParts(
|
|
52
|
-
config: NormalizedAukletConfig,
|
|
53
|
-
): {
|
|
54
|
-
type: 'dependencies';
|
|
55
|
-
specifiers: string[];
|
|
33
|
+
}): (ThemePart | {
|
|
34
|
+
type: "dependencies";
|
|
35
|
+
specifiers: string[];
|
|
36
|
+
})[];
|
|
37
|
+
export declare function createExternalEntryParts(config: NormalizedAukletConfig): {
|
|
38
|
+
type: "dependencies";
|
|
39
|
+
specifiers: string[];
|
|
56
40
|
}[];
|
|
57
|
-
export declare function collectModuleStyleImports(
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
sourceDir: string,
|
|
63
|
-
): {
|
|
64
|
-
sourceDir: string;
|
|
65
|
-
moduleStyleImports: string[];
|
|
66
|
-
ownStyleFiles: string[];
|
|
41
|
+
export declare function collectModuleStyleImports(packageContext: StylePackageContext): Map<string, string[]>;
|
|
42
|
+
export declare function createComponentStyleEntryPlan(packageContext: StylePackageContext, sourceDir: string): {
|
|
43
|
+
sourceDir: string;
|
|
44
|
+
moduleStyleImports: string[];
|
|
45
|
+
ownStyleFiles: string[];
|
|
67
46
|
};
|
|
68
|
-
export declare function createComponentStyleEntryPlans(
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
moduleStyleImports: string[];
|
|
73
|
-
ownStyleFiles: string[];
|
|
47
|
+
export declare function createComponentStyleEntryPlans(packageContext: StylePackageContext): {
|
|
48
|
+
sourceDir: string;
|
|
49
|
+
moduleStyleImports: string[];
|
|
50
|
+
ownStyleFiles: string[];
|
|
74
51
|
}[];
|
|
75
52
|
export {};
|
|
@@ -1,46 +1,35 @@
|
|
|
1
|
-
import {
|
|
2
|
-
getExternalStyleDependencies,
|
|
3
|
-
getGlobalStyleDependencies,
|
|
4
|
-
getThemeNames,
|
|
5
|
-
getThemeStyleDependencies,
|
|
6
|
-
} from '#auklet/css/core/style/dependencies';
|
|
1
|
+
import { getExternalStyleDependencies, getGlobalStyleDependencies, getThemeNames, getThemeStyleDependencies, } from '#auklet/css/core/style/dependencies';
|
|
7
2
|
import { StyleModuleEntryPlanner } from '#auklet/css/core/styleModuleEntryPlanner';
|
|
8
3
|
const dependenciesPart = (specifiers) => ({ type: 'dependencies', specifiers });
|
|
9
4
|
// 环境无关的 style entry graph。production writer 和 Vite/dev renderer 都从这里取入口语义。
|
|
10
5
|
export function createStyleEntryParts(config) {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
6
|
+
return [
|
|
7
|
+
dependenciesPart(getGlobalStyleDependencies(config)),
|
|
8
|
+
{ type: 'themes', themeNames: getThemeNames(config) },
|
|
9
|
+
{ type: 'module' },
|
|
10
|
+
];
|
|
16
11
|
}
|
|
17
12
|
export function createThemeEntryParts(config, themeName, options = {}) {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
13
|
+
const themePart = { type: 'theme', themeName };
|
|
14
|
+
if (options.includeDependencies === false) {
|
|
15
|
+
return [themePart];
|
|
16
|
+
}
|
|
17
|
+
return [
|
|
18
|
+
dependenciesPart(getThemeStyleDependencies(config, themeName)),
|
|
19
|
+
themePart,
|
|
20
|
+
];
|
|
26
21
|
}
|
|
27
22
|
export function createExternalEntryParts(config) {
|
|
28
|
-
|
|
23
|
+
return [
|
|
24
|
+
dependenciesPart(getExternalStyleDependencies(config)),
|
|
25
|
+
];
|
|
29
26
|
}
|
|
30
27
|
export function collectModuleStyleImports(packageContext) {
|
|
31
|
-
|
|
32
|
-
packageContext.sourceFiles,
|
|
33
|
-
packageContext.normalizedConfig,
|
|
34
|
-
);
|
|
28
|
+
return packageContext.importCollector.collect(packageContext.sourceFiles, packageContext.normalizedConfig);
|
|
35
29
|
}
|
|
36
30
|
export function createComponentStyleEntryPlan(packageContext, sourceDir) {
|
|
37
|
-
|
|
38
|
-
sourceDir,
|
|
39
|
-
collectModuleStyleImports(packageContext),
|
|
40
|
-
);
|
|
31
|
+
return new StyleModuleEntryPlanner(packageContext).createEntry(sourceDir, collectModuleStyleImports(packageContext));
|
|
41
32
|
}
|
|
42
33
|
export function createComponentStyleEntryPlans(packageContext) {
|
|
43
|
-
|
|
44
|
-
collectModuleStyleImports(packageContext),
|
|
45
|
-
);
|
|
34
|
+
return new StyleModuleEntryPlanner(packageContext).createEntries(collectModuleStyleImports(packageContext));
|
|
46
35
|
}
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
export declare function groupStyleFilesByDir(
|
|
2
|
-
|
|
3
|
-
styleFiles: Array<string>,
|
|
4
|
-
): Map<string, string[]>;
|
|
5
|
-
export declare function createStyleFileKeySet(
|
|
6
|
-
styleFiles: Iterable<string>,
|
|
7
|
-
): Set<string>;
|
|
1
|
+
export declare function groupStyleFilesByDir(sourceRoot: string, styleFiles: Array<string>): Map<string, string[]>;
|
|
2
|
+
export declare function createStyleFileKeySet(styleFiles: Iterable<string>): Set<string>;
|
|
8
3
|
export declare function createStyleFileKey(styleFile: string): string;
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import path from 'node:path';
|
|
2
2
|
import { getSourceModuleDir, normalizeFileKey } from '#auklet/utils';
|
|
3
3
|
export function groupStyleFilesByDir(sourceRoot, styleFiles) {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
4
|
+
const styleFilesByDir = new Map();
|
|
5
|
+
for (const styleFile of styleFiles) {
|
|
6
|
+
const sourceRelative = path.relative(sourceRoot, styleFile);
|
|
7
|
+
const sourceDir = getSourceModuleDir(sourceRelative);
|
|
8
|
+
const values = styleFilesByDir.get(sourceDir) ?? [];
|
|
9
|
+
values.push(styleFile);
|
|
10
|
+
styleFilesByDir.set(sourceDir, values);
|
|
11
|
+
}
|
|
12
|
+
return styleFilesByDir;
|
|
13
13
|
}
|
|
14
14
|
export function createStyleFileKeySet(styleFiles) {
|
|
15
|
-
|
|
15
|
+
return new Set(Array.from(styleFiles, normalizeFileKey));
|
|
16
16
|
}
|
|
17
17
|
export function createStyleFileKey(styleFile) {
|
|
18
|
-
|
|
18
|
+
return normalizeFileKey(styleFile);
|
|
19
19
|
}
|
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
export type PackageStyleSpecifier = {
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
packageName: string;
|
|
3
|
+
stylePath: string;
|
|
4
4
|
};
|
|
5
5
|
export declare function parsePackageStyleSpecifier(specifier: string): {
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
packageName: string;
|
|
7
|
+
stylePath: string;
|
|
8
8
|
} | null;
|
|
9
|
-
export declare function joinDependencySpecifier(
|
|
10
|
-
packageName: string,
|
|
11
|
-
dependencyPath: string,
|
|
12
|
-
): string;
|
|
9
|
+
export declare function joinDependencySpecifier(packageName: string, dependencyPath: string): string;
|
|
13
10
|
export declare function createImportCode(specifiers: Array<string>): string;
|
|
14
11
|
export declare function removeStyleExtension(stylePath: string): string;
|
|
@@ -1,27 +1,30 @@
|
|
|
1
1
|
import path from 'node:path';
|
|
2
2
|
export function parsePackageStyleSpecifier(specifier) {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
3
|
+
if (specifier.startsWith('.'))
|
|
4
|
+
return null;
|
|
5
|
+
const parts = specifier.split('/');
|
|
6
|
+
const packageName = specifier.startsWith('@')
|
|
7
|
+
? `${parts.shift() ?? ''}/${parts.shift() ?? ''}`
|
|
8
|
+
: (parts.shift() ?? '');
|
|
9
|
+
if (!packageName)
|
|
10
|
+
return null;
|
|
11
|
+
return {
|
|
12
|
+
packageName,
|
|
13
|
+
stylePath: parts.join('/'),
|
|
14
|
+
};
|
|
13
15
|
}
|
|
14
16
|
export function joinDependencySpecifier(packageName, dependencyPath) {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
if (!dependencyPath)
|
|
18
|
+
return packageName;
|
|
19
|
+
return dependencyPath.startsWith('/')
|
|
20
|
+
? `${packageName}${dependencyPath}`
|
|
21
|
+
: `${packageName}/${dependencyPath}`;
|
|
19
22
|
}
|
|
20
23
|
export function createImportCode(specifiers) {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
+
return Array.from(new Set(specifiers))
|
|
25
|
+
.map((specifier) => `@import "${specifier}";`)
|
|
26
|
+
.join('\n');
|
|
24
27
|
}
|
|
25
28
|
export function removeStyleExtension(stylePath) {
|
|
26
|
-
|
|
29
|
+
return stylePath.slice(0, -path.extname(stylePath).length);
|
|
27
30
|
}
|
|
@@ -1,29 +1,21 @@
|
|
|
1
1
|
import type { NormalizedAukletConfig } from '#auklet/types';
|
|
2
2
|
import type { WorkspaceStyleResolver } from '#auklet/css/core/workspaceStyleResolver';
|
|
3
3
|
export declare class ModuleStyleImportCollector {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
private resolveSourceImportPaths;
|
|
22
|
-
private toSourceBase;
|
|
23
|
-
private toRelativeSpecifier;
|
|
24
|
-
private createAutoImportRules;
|
|
25
|
-
private matchAutoImportRules;
|
|
26
|
-
private getImportPathValues;
|
|
27
|
-
private createStyleSpecifier;
|
|
28
|
-
private createDirectStyleSpecifier;
|
|
4
|
+
private readonly srcRoot;
|
|
5
|
+
private readonly packageRoot;
|
|
6
|
+
private readonly resolver;
|
|
7
|
+
private readonly styleExtensions;
|
|
8
|
+
constructor(srcRoot: string, packageRoot: string, resolver: WorkspaceStyleResolver, styleExtensions?: Array<string>);
|
|
9
|
+
collect(files: Array<string>, config: NormalizedAukletConfig): Map<string, string[]>;
|
|
10
|
+
private collectSourceImportStyle;
|
|
11
|
+
private resolveSourceImportStyleEntry;
|
|
12
|
+
private isInsideSourceRoot;
|
|
13
|
+
private resolveSourceImportPaths;
|
|
14
|
+
private toSourceBase;
|
|
15
|
+
private toRelativeSpecifier;
|
|
16
|
+
private createAutoImportRules;
|
|
17
|
+
private matchAutoImportRules;
|
|
18
|
+
private getImportPathValues;
|
|
19
|
+
private createStyleSpecifier;
|
|
20
|
+
private createDirectStyleSpecifier;
|
|
29
21
|
}
|