auklet 0.0.3 → 0.0.4
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 +81 -42
- package/bin/entry.cjs +33 -11
- package/dist/build/runTsdown.js +2 -3
- package/dist/build/tsdownConfig.d.ts +138 -2
- package/dist/build/tsdownConfig.js +108 -63
- package/dist/config.d.ts +38 -6
- package/dist/config.js +43 -7
- package/dist/configLoader.js +1 -2
- package/dist/css/config.d.ts +2 -0
- package/dist/css/config.js +10 -0
- package/dist/css/constants.d.ts +6 -0
- package/dist/css/constants.js +6 -0
- package/dist/css/core/moduleGraph.d.ts +55 -0
- package/dist/css/core/moduleGraph.js +362 -0
- package/dist/css/core/moduleGraphRequestCache.d.ts +80 -0
- package/dist/css/core/moduleGraphRequestCache.js +92 -0
- package/dist/css/core/moduleStyleImportCollector.d.ts +5 -3
- package/dist/css/core/moduleStyleImportCollector.js +27 -45
- package/dist/css/core/style/dependencies.d.ts +20 -0
- package/dist/css/core/style/dependencies.js +55 -0
- package/dist/css/core/style/files.d.ts +8 -0
- package/dist/css/core/style/files.js +19 -0
- package/dist/css/core/style/plan.d.ts +59 -0
- package/dist/css/core/style/plan.js +27 -0
- package/dist/css/core/style/specifier.d.ts +14 -0
- package/dist/css/core/style/specifier.js +27 -0
- package/dist/css/core/styleModuleEntryPlanner.d.ts +29 -0
- package/dist/css/core/styleModuleEntryPlanner.js +66 -0
- package/dist/css/core/stylePackageContext.d.ts +27 -0
- package/dist/css/core/stylePackageContext.js +57 -0
- package/dist/css/core/styleProcessor.d.ts +3 -3
- package/dist/css/core/styleProcessor.js +18 -35
- package/dist/css/core/workspaceStyleResolver.d.ts +4 -5
- package/dist/css/core/workspaceStyleResolver.js +12 -28
- package/dist/css/production/builder.d.ts +18 -0
- package/dist/css/production/builder.js +68 -0
- package/dist/css/production/format/componentWriter.d.ts +12 -0
- package/dist/css/production/format/componentWriter.js +67 -0
- package/dist/css/production/format/entryWriter.d.ts +12 -0
- package/dist/css/production/format/entryWriter.js +54 -0
- package/dist/css/production/format/externalWriter.d.ts +9 -0
- package/dist/css/production/format/externalWriter.js +39 -0
- package/dist/css/production/format/moduleWriter.d.ts +8 -0
- package/dist/css/production/format/moduleWriter.js +31 -0
- package/dist/css/production/format/shared.d.ts +20 -0
- package/dist/css/production/format/shared.js +8 -0
- package/dist/css/production/format/sourceWriter.d.ts +6 -0
- package/dist/css/production/format/sourceWriter.js +16 -0
- package/dist/css/production/format/themeWriter.d.ts +16 -0
- package/dist/css/production/format/themeWriter.js +80 -0
- package/dist/css/production/moduleOutputWriter.d.ts +26 -0
- package/dist/css/production/moduleOutputWriter.js +83 -0
- package/dist/css/production/packageEntryWriter.d.ts +20 -0
- package/dist/css/production/packageEntryWriter.js +55 -0
- package/dist/css/vite/hmr.d.ts +4 -4
- package/dist/css/vite/hmr.js +14 -27
- package/dist/css/vite/vitePlugin.d.ts +5 -5
- package/dist/css/vite/vitePlugin.js +21 -30
- package/dist/css/watch/{moduleCssWatcher.d.ts → watcher.d.ts} +7 -4
- package/dist/css/watch/watcher.js +82 -0
- package/dist/index.d.ts +15 -12
- package/dist/index.js +6 -5
- package/dist/types.d.ts +40 -20
- package/dist/utils.d.ts +5 -1
- package/dist/utils.js +37 -12
- package/package.json +19 -14
- package/dist/css/core/config.d.ts +0 -2
- package/dist/css/core/config.js +0 -11
- package/dist/css/core/constants.d.ts +0 -3
- package/dist/css/core/constants.js +0 -3
- package/dist/css/core/moduleCssGraph.d.ts +0 -51
- package/dist/css/core/moduleCssGraph.js +0 -416
- package/dist/css/core/path.d.ts +0 -4
- package/dist/css/core/path.js +0 -26
- package/dist/css/core/styleEntry.d.ts +0 -45
- package/dist/css/core/styleEntry.js +0 -108
- package/dist/css/production/moduleCssBuilder.d.ts +0 -33
- package/dist/css/production/moduleCssBuilder.js +0 -445
- package/dist/css/watch/moduleCssWatcher.js +0 -106
|
@@ -2,6 +2,7 @@ import fs from 'node:fs';
|
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
import { defineConfig } from 'tsdown/config';
|
|
4
4
|
import { loadAukletConfig } from '#auklet/configLoader';
|
|
5
|
+
import { normalizeAukletConfig } from '#auklet/config';
|
|
5
6
|
const formatMap = {
|
|
6
7
|
cjs: '.cjs',
|
|
7
8
|
iife: '.global.js',
|
|
@@ -16,23 +17,19 @@ const getExternal = (names) => {
|
|
|
16
17
|
return [...external];
|
|
17
18
|
};
|
|
18
19
|
const getPackageExternal = (pkg, options) => {
|
|
19
|
-
var _a, _b, _c;
|
|
20
20
|
return getExternal([
|
|
21
|
-
...Object.keys(
|
|
22
|
-
...Object.keys(
|
|
23
|
-
|
|
24
|
-
),
|
|
25
|
-
...(
|
|
21
|
+
...Object.keys(pkg.dependencies ?? {}),
|
|
22
|
+
...Object.keys(pkg.peerDependencies ?? {}),
|
|
23
|
+
...Object.keys(pkg.optionalDependencies ?? {}),
|
|
24
|
+
...Object.keys(pkg.devDependencies ?? {}),
|
|
25
|
+
...(options.externals ?? []),
|
|
26
26
|
]);
|
|
27
27
|
};
|
|
28
28
|
const getPeerExternal = (pkg, options) => {
|
|
29
|
-
var _a, _b;
|
|
30
29
|
return [
|
|
31
30
|
...new Set([
|
|
32
|
-
...Object.keys(
|
|
33
|
-
|
|
34
|
-
),
|
|
35
|
-
...((_b = options.externals) !== null && _b !== void 0 ? _b : []),
|
|
31
|
+
...Object.keys(pkg.peerDependencies ?? {}),
|
|
32
|
+
...(options.externals ?? []),
|
|
36
33
|
]),
|
|
37
34
|
];
|
|
38
35
|
};
|
|
@@ -50,7 +47,7 @@ const getIifeGlobals = (context) => {
|
|
|
50
47
|
);
|
|
51
48
|
};
|
|
52
49
|
const getIifeAlwaysBundle = (context) => {
|
|
53
|
-
const names = new Set(context.
|
|
50
|
+
const names = new Set(context.runtimeDependencyNames);
|
|
54
51
|
if (context.peerExternal.includes('react')) {
|
|
55
52
|
names.add('react/jsx-runtime');
|
|
56
53
|
names.add('react/jsx-dev-runtime');
|
|
@@ -58,13 +55,7 @@ const getIifeAlwaysBundle = (context) => {
|
|
|
58
55
|
return [...names];
|
|
59
56
|
};
|
|
60
57
|
const getGlobalName = (pkg) => {
|
|
61
|
-
|
|
62
|
-
return (
|
|
63
|
-
(_a = pkg === null || pkg === void 0 ? void 0 : pkg.name) !== null &&
|
|
64
|
-
_a !== void 0
|
|
65
|
-
? _a
|
|
66
|
-
: ''
|
|
67
|
-
)
|
|
58
|
+
return (pkg?.name ?? '')
|
|
68
59
|
.replace(/@/g, '')
|
|
69
60
|
.split(/[/-]/g)
|
|
70
61
|
.map((label) => label[0].toUpperCase() + label.slice(1))
|
|
@@ -80,43 +71,89 @@ const findWorkspaceTsconfig = (packageRoot) => {
|
|
|
80
71
|
current = parent;
|
|
81
72
|
}
|
|
82
73
|
};
|
|
83
|
-
const
|
|
84
|
-
|
|
74
|
+
const getBundleEntry = (packageRoot) => {
|
|
75
|
+
const tsEntry = 'src/index.ts';
|
|
76
|
+
const tsxEntry = 'src/index.tsx';
|
|
77
|
+
if (fs.existsSync(path.join(packageRoot, tsEntry))) {
|
|
78
|
+
return { index: tsEntry };
|
|
79
|
+
}
|
|
80
|
+
if (fs.existsSync(path.join(packageRoot, tsxEntry))) {
|
|
81
|
+
return { index: tsxEntry };
|
|
82
|
+
}
|
|
83
|
+
return { index: tsEntry };
|
|
84
|
+
};
|
|
85
|
+
const toPosixPath = (value) => {
|
|
86
|
+
return value.split(path.sep).join('/');
|
|
87
|
+
};
|
|
88
|
+
const getModuleEntries = (packageRoot) => {
|
|
89
|
+
const sourceRoot = path.join(packageRoot, 'src');
|
|
90
|
+
const entries = {};
|
|
91
|
+
if (!fs.existsSync(sourceRoot)) {
|
|
92
|
+
return getBundleEntry(packageRoot);
|
|
93
|
+
}
|
|
94
|
+
const collect = (dir) => {
|
|
95
|
+
const dirEntries = fs
|
|
96
|
+
.readdirSync(dir, { withFileTypes: true })
|
|
97
|
+
.sort((a, b) => a.name.localeCompare(b.name));
|
|
98
|
+
for (const dirEntry of dirEntries) {
|
|
99
|
+
const file = path.join(dir, dirEntry.name);
|
|
100
|
+
if (dirEntry.isDirectory()) {
|
|
101
|
+
if (dirEntry.name !== '__tests__') collect(file);
|
|
102
|
+
continue;
|
|
103
|
+
}
|
|
104
|
+
if (!/\.(ts|tsx)$/.test(dirEntry.name)) continue;
|
|
105
|
+
if (/\.d\.ts$/.test(dirEntry.name)) continue;
|
|
106
|
+
if (/\.(spec|test)\.(ts|tsx)$/.test(dirEntry.name)) continue;
|
|
107
|
+
const sourceRelative = toPosixPath(path.relative(packageRoot, file));
|
|
108
|
+
const entryName = toPosixPath(path.relative(sourceRoot, file)).replace(
|
|
109
|
+
/\.(ts|tsx)$/,
|
|
110
|
+
'',
|
|
111
|
+
);
|
|
112
|
+
entries[entryName] ??= sourceRelative;
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
collect(sourceRoot);
|
|
116
|
+
return Object.keys(entries).length > 0
|
|
117
|
+
? entries
|
|
118
|
+
: getBundleEntry(packageRoot);
|
|
119
|
+
};
|
|
120
|
+
const createBuildContext = (packageRoot, options, output) => {
|
|
85
121
|
const pkg = JSON.parse(
|
|
86
122
|
fs.readFileSync(path.join(packageRoot, 'package.json'), 'utf8'),
|
|
87
123
|
);
|
|
88
124
|
const banner =
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
(pkg.author
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
' */';
|
|
125
|
+
options.banner ??
|
|
126
|
+
'/*!\n' +
|
|
127
|
+
` * ${pkg.name}.js v${pkg.version}\n` +
|
|
128
|
+
(pkg.author
|
|
129
|
+
? ` * (c) 2026-${new Date().getFullYear()} ${pkg.author}\n`
|
|
130
|
+
: '') +
|
|
131
|
+
' */';
|
|
97
132
|
return {
|
|
98
|
-
packageRoot,
|
|
99
|
-
tsconfig: options.tsconfig
|
|
100
|
-
? path.resolve(packageRoot, options.tsconfig)
|
|
101
|
-
: findWorkspaceTsconfig(packageRoot),
|
|
102
133
|
pkg,
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
134
|
+
banner,
|
|
135
|
+
packageRoot,
|
|
136
|
+
output,
|
|
137
|
+
runtimeDependencyNames: Object.keys(pkg.dependencies ?? {}),
|
|
106
138
|
packageExternal: getPackageExternal(pkg, options),
|
|
107
139
|
peerExternal: getPeerExternal(pkg, options),
|
|
108
140
|
globalName: getGlobalName(pkg),
|
|
109
|
-
|
|
141
|
+
platform: options.platform,
|
|
142
|
+
target: options.target,
|
|
143
|
+
tsconfig: options.tsconfig
|
|
144
|
+
? path.resolve(packageRoot, options.tsconfig)
|
|
145
|
+
: findWorkspaceTsconfig(packageRoot),
|
|
110
146
|
};
|
|
111
147
|
};
|
|
112
148
|
const createCommonConfig = (context, deps) => {
|
|
113
149
|
return {
|
|
114
150
|
cwd: context.packageRoot,
|
|
151
|
+
root: context.packageRoot,
|
|
115
152
|
clean: false,
|
|
116
153
|
sourcemap: false,
|
|
117
154
|
tsconfig: context.tsconfig,
|
|
118
|
-
target:
|
|
119
|
-
platform:
|
|
155
|
+
target: context.target,
|
|
156
|
+
platform: context.platform,
|
|
120
157
|
deps,
|
|
121
158
|
define: {
|
|
122
159
|
__TEST__: 'false',
|
|
@@ -128,13 +165,16 @@ const createCommonConfig = (context, deps) => {
|
|
|
128
165
|
};
|
|
129
166
|
const createBundleConfigs = (context, formats) => {
|
|
130
167
|
const outputConfigs = [];
|
|
168
|
+
let hasDtsConfig = false;
|
|
131
169
|
for (const format of formats) {
|
|
132
170
|
const extnames = formatMap[format];
|
|
133
171
|
for (const extname of Array.isArray(extnames) ? extnames : [extnames]) {
|
|
134
|
-
|
|
172
|
+
const emitDts = !hasDtsConfig;
|
|
173
|
+
outputConfigs.push({ format, extname, dts: emitDts });
|
|
174
|
+
hasDtsConfig ||= emitDts;
|
|
135
175
|
}
|
|
136
176
|
}
|
|
137
|
-
return outputConfigs.map(({ format, extname }) => {
|
|
177
|
+
return outputConfigs.map(({ format, extname, dts }) => {
|
|
138
178
|
const deps =
|
|
139
179
|
format === 'iife'
|
|
140
180
|
? {
|
|
@@ -147,11 +187,11 @@ const createBundleConfigs = (context, formats) => {
|
|
|
147
187
|
};
|
|
148
188
|
return {
|
|
149
189
|
...createCommonConfig(context, deps),
|
|
150
|
-
entry:
|
|
190
|
+
entry: getBundleEntry(context.packageRoot),
|
|
151
191
|
format,
|
|
152
192
|
globalName: context.globalName,
|
|
153
|
-
outDir:
|
|
154
|
-
dts
|
|
193
|
+
outDir: context.output,
|
|
194
|
+
dts,
|
|
155
195
|
treeshake: true,
|
|
156
196
|
banner: context.banner,
|
|
157
197
|
outExtensions: () => ({
|
|
@@ -165,17 +205,10 @@ const createBundleConfigs = (context, formats) => {
|
|
|
165
205
|
};
|
|
166
206
|
});
|
|
167
207
|
};
|
|
168
|
-
const createModuleConfig = (commonConfig, format, outDir) => {
|
|
208
|
+
const createModuleConfig = (commonConfig, entry, format, outDir) => {
|
|
169
209
|
return {
|
|
170
210
|
...commonConfig,
|
|
171
|
-
entry
|
|
172
|
-
'src/**/*.ts',
|
|
173
|
-
'src/**/*.tsx',
|
|
174
|
-
'!src/**/*.d.ts',
|
|
175
|
-
'!src/**/__tests__/**',
|
|
176
|
-
'!src/**/*.spec.ts',
|
|
177
|
-
'!src/**/*.spec.tsx',
|
|
178
|
-
],
|
|
211
|
+
entry,
|
|
179
212
|
format,
|
|
180
213
|
outDir,
|
|
181
214
|
dts: true,
|
|
@@ -190,24 +223,36 @@ const createModuleConfigs = (context) => {
|
|
|
190
223
|
const commonConfig = createCommonConfig(context, {
|
|
191
224
|
neverBundle: context.packageExternal,
|
|
192
225
|
});
|
|
226
|
+
const entry = getModuleEntries(context.packageRoot);
|
|
193
227
|
return [
|
|
194
|
-
createModuleConfig(
|
|
195
|
-
|
|
228
|
+
createModuleConfig(
|
|
229
|
+
commonConfig,
|
|
230
|
+
entry,
|
|
231
|
+
'esm',
|
|
232
|
+
path.join(context.output, 'es'),
|
|
233
|
+
),
|
|
234
|
+
createModuleConfig(
|
|
235
|
+
commonConfig,
|
|
236
|
+
entry,
|
|
237
|
+
'cjs',
|
|
238
|
+
path.join(context.output, 'lib'),
|
|
239
|
+
),
|
|
196
240
|
];
|
|
197
241
|
};
|
|
198
242
|
export function defineKernelPackageConfigFromOptions(
|
|
199
243
|
packageRoot = process.cwd(),
|
|
200
244
|
config = {},
|
|
201
245
|
) {
|
|
202
|
-
|
|
203
|
-
const buildOptions =
|
|
204
|
-
const formats =
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
246
|
+
const normalizedConfig = normalizeAukletConfig(config);
|
|
247
|
+
const buildOptions = normalizedConfig.build;
|
|
248
|
+
const formats = buildOptions.formats;
|
|
249
|
+
const context = createBuildContext(
|
|
250
|
+
packageRoot,
|
|
251
|
+
buildOptions,
|
|
252
|
+
normalizedConfig.output,
|
|
253
|
+
);
|
|
209
254
|
const bundleConfigs = createBundleConfigs(context, formats);
|
|
210
|
-
const moduleConfigs =
|
|
255
|
+
const moduleConfigs = normalizedConfig.modules
|
|
211
256
|
? createModuleConfigs(context)
|
|
212
257
|
: [];
|
|
213
258
|
return [...bundleConfigs, ...moduleConfigs];
|
package/dist/config.d.ts
CHANGED
|
@@ -1,8 +1,40 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { AukletConfig, StyleDependencyGroup } from '#auklet/types';
|
|
2
2
|
export declare const aukletConfigFile = 'auklet.config.ts';
|
|
3
|
-
export declare const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
export declare const aukletDefaultOptions: {
|
|
4
|
+
source: string;
|
|
5
|
+
output: string;
|
|
6
|
+
modules: false;
|
|
7
|
+
build: {
|
|
8
|
+
formats: ('cjs' | 'esm' | 'iife')[];
|
|
9
|
+
target: string;
|
|
10
|
+
platform: 'neutral';
|
|
11
|
+
};
|
|
12
|
+
styles: {
|
|
13
|
+
themes: {};
|
|
14
|
+
dependencies: {};
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
export declare const aukletDefaultStyleDependencyConfig: StyleDependencyGroup;
|
|
18
|
+
export declare function normalizeAukletConfig(config?: AukletConfig): {
|
|
19
|
+
source: string;
|
|
20
|
+
output: string;
|
|
21
|
+
modules: boolean;
|
|
22
|
+
build: {
|
|
23
|
+
formats: Array<import('#auklet/types').PackageBuildFormat>;
|
|
24
|
+
target: import('#auklet/types').PackageBuildTarget;
|
|
25
|
+
platform: import('#auklet/types').PackageBuildPlatform;
|
|
26
|
+
banner?: string;
|
|
27
|
+
externals?: Array<string>;
|
|
28
|
+
tsconfig?: string;
|
|
29
|
+
};
|
|
30
|
+
styles: {
|
|
31
|
+
themes: {};
|
|
32
|
+
dependencies: {
|
|
33
|
+
[k: string]: {
|
|
34
|
+
entry: string | string[] | undefined;
|
|
35
|
+
themes: Record<string, string> | undefined;
|
|
36
|
+
components: string | string[] | undefined;
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
};
|
|
7
40
|
};
|
|
8
|
-
export declare const aukletDefaultCssDependencyConfig: CssDependencyGroup;
|
package/dist/config.js
CHANGED
|
@@ -1,14 +1,50 @@
|
|
|
1
1
|
export const aukletConfigFile = 'auklet.config.ts';
|
|
2
|
-
export const
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
export const aukletDefaultOptions = {
|
|
3
|
+
source: 'src',
|
|
4
|
+
output: 'dist',
|
|
5
|
+
modules: false,
|
|
6
|
+
build: {
|
|
7
|
+
formats: ['cjs', 'esm', 'iife'],
|
|
8
|
+
target: 'es2020',
|
|
9
|
+
platform: 'neutral',
|
|
10
|
+
},
|
|
11
|
+
styles: {
|
|
12
|
+
themes: {},
|
|
13
|
+
dependencies: {},
|
|
14
|
+
},
|
|
6
15
|
};
|
|
7
|
-
export const
|
|
8
|
-
|
|
9
|
-
|
|
16
|
+
export const aukletDefaultStyleDependencyConfig = {
|
|
17
|
+
entry: '/style.css',
|
|
18
|
+
components: ['/pages/**.css', '/components/**.css'],
|
|
10
19
|
themes: {
|
|
11
20
|
dark: '/themes/dark.css',
|
|
12
21
|
light: '/themes/light.css',
|
|
13
22
|
},
|
|
14
23
|
};
|
|
24
|
+
const normalizeStyleDependency = (dependency) => ({
|
|
25
|
+
entry: dependency.entry,
|
|
26
|
+
themes: dependency.themes,
|
|
27
|
+
components: dependency.components,
|
|
28
|
+
});
|
|
29
|
+
export function normalizeAukletConfig(config = {}) {
|
|
30
|
+
const dependencies =
|
|
31
|
+
config.styles?.dependencies ?? aukletDefaultOptions.styles.dependencies;
|
|
32
|
+
return {
|
|
33
|
+
source: config.source ?? aukletDefaultOptions.source,
|
|
34
|
+
output: config.output ?? aukletDefaultOptions.output,
|
|
35
|
+
modules: config.modules ?? aukletDefaultOptions.modules,
|
|
36
|
+
build: {
|
|
37
|
+
...aukletDefaultOptions.build,
|
|
38
|
+
...config.build,
|
|
39
|
+
},
|
|
40
|
+
styles: {
|
|
41
|
+
themes: config.styles?.themes ?? aukletDefaultOptions.styles.themes,
|
|
42
|
+
dependencies: Object.fromEntries(
|
|
43
|
+
Object.entries(dependencies).map(([packageName, dependency]) => [
|
|
44
|
+
packageName,
|
|
45
|
+
normalizeStyleDependency(dependency),
|
|
46
|
+
]),
|
|
47
|
+
),
|
|
48
|
+
},
|
|
49
|
+
};
|
|
50
|
+
}
|
package/dist/configLoader.js
CHANGED
|
@@ -64,10 +64,9 @@ export function resolveAukletConfigModule(module) {
|
|
|
64
64
|
return {};
|
|
65
65
|
}
|
|
66
66
|
export async function loadAukletConfig(packageRoot, options = {}) {
|
|
67
|
-
var _a;
|
|
68
67
|
const configPath = path.join(
|
|
69
68
|
packageRoot,
|
|
70
|
-
|
|
69
|
+
options.configFile ?? aukletConfigFile,
|
|
71
70
|
);
|
|
72
71
|
if (!fs.existsSync(configPath)) {
|
|
73
72
|
return {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const NODE_MODULES_DIR = 'node_modules';
|
|
2
|
+
export declare const THEMES_DIR = 'themes';
|
|
3
|
+
export declare const THEMES_ENTRY_PREFIX = 'themes/';
|
|
4
|
+
export declare const STYLE_ENTRY = 'style.css';
|
|
5
|
+
export declare const MODULE_ENTRY = 'module.css';
|
|
6
|
+
export declare const EXTERNAL_ENTRY = 'external.css';
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { type LoadAukletConfig } from '#auklet/css/core/moduleGraphRequestCache';
|
|
2
|
+
import type { ModuleStyleBuildConfig } from '#auklet/types';
|
|
3
|
+
export interface ModuleStyleGraphOptions {
|
|
4
|
+
workspaceRoot: string;
|
|
5
|
+
packagesDir?: string;
|
|
6
|
+
config?: ModuleStyleBuildConfig;
|
|
7
|
+
loadAukletConfig?: LoadAukletConfig;
|
|
8
|
+
}
|
|
9
|
+
export type PackageStyleId = {
|
|
10
|
+
packageName: string;
|
|
11
|
+
stylePath: string;
|
|
12
|
+
};
|
|
13
|
+
export type PackageStyleLoadResult = {
|
|
14
|
+
code: string;
|
|
15
|
+
watchFiles: Array<string>;
|
|
16
|
+
};
|
|
17
|
+
export declare class ModuleStyleGraph {
|
|
18
|
+
private readonly config;
|
|
19
|
+
private readonly workspaceRoot;
|
|
20
|
+
private readonly packagesDir;
|
|
21
|
+
private readonly loadAukletConfig;
|
|
22
|
+
constructor(options: ModuleStyleGraphOptions);
|
|
23
|
+
parsePackageStyleId(id: string): {
|
|
24
|
+
packageName: string;
|
|
25
|
+
stylePath: string;
|
|
26
|
+
} | null;
|
|
27
|
+
isWorkspaceSourceGraphFile(file: string): boolean;
|
|
28
|
+
isStyleConfigFile(file: string): boolean;
|
|
29
|
+
isStyleFile(file: string): boolean;
|
|
30
|
+
getWorkspacePackageNames(): string[];
|
|
31
|
+
getWatchRoots(): string[];
|
|
32
|
+
createPackageStyleCode(parsed: PackageStyleId): Promise<{
|
|
33
|
+
code: string;
|
|
34
|
+
watchFiles: string[];
|
|
35
|
+
}>;
|
|
36
|
+
private createPackageStyleCodeWithCache;
|
|
37
|
+
private createStyleCode;
|
|
38
|
+
private createDependencyStyleCode;
|
|
39
|
+
private createExternalStyleCode;
|
|
40
|
+
private createThemeStyleCode;
|
|
41
|
+
private createModuleStyleCode;
|
|
42
|
+
private createSourceModuleStyleCode;
|
|
43
|
+
private toDevModuleImportSpecifier;
|
|
44
|
+
private toDevExternalStyleSpecifier;
|
|
45
|
+
private parsePackageStyleIdInRequest;
|
|
46
|
+
private isWorkspacePackageName;
|
|
47
|
+
private createRequestCache;
|
|
48
|
+
}
|
|
49
|
+
export declare function parsePackageStyleId(
|
|
50
|
+
id: string,
|
|
51
|
+
packageNames: Array<string>,
|
|
52
|
+
): {
|
|
53
|
+
packageName: string;
|
|
54
|
+
stylePath: string;
|
|
55
|
+
} | null;
|