auklet 0.0.2 → 0.0.3
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 -1
- package/dist/config.d.ts +5 -0
- package/dist/config.js +5 -0
- package/dist/css/core/config.js +1 -8
- package/dist/css/core/moduleCssGraph.js +11 -7
- package/dist/css/core/styleProcessor.js +3 -6
- package/dist/css/production/moduleCssBuilder.js +5 -4
- package/dist/css/watch/moduleCssWatcher.js +2 -2
- package/dist/index.d.ts +4 -2
- package/dist/index.js +4 -1
- package/dist/types.d.ts +1 -3
- package/package.json +10 -12
package/README.md
CHANGED
|
@@ -76,7 +76,7 @@ export const config: AukletConfig = {
|
|
|
76
76
|
|
|
77
77
|
- `sourceDir`: source directory relative to the package root. Defaults to `src`.
|
|
78
78
|
- `outputDir`: build output directory relative to the package root. Defaults to `dist`.
|
|
79
|
-
- `themes`: package theme style entries.
|
|
79
|
+
- `themes`: package theme style entries. Defaults to no themes.
|
|
80
80
|
- `cssDependencies`: external package style dependencies.
|
|
81
81
|
|
|
82
82
|
Each `cssDependencies` entry may define:
|
package/dist/config.d.ts
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
1
|
import type { CssDependencyGroup } from '#auklet/types';
|
|
2
2
|
export declare const aukletConfigFile = 'auklet.config.ts';
|
|
3
|
+
export declare const aukletDefaultCssOptions: {
|
|
4
|
+
sourceDir: string;
|
|
5
|
+
outputDir: string;
|
|
6
|
+
themes: {};
|
|
7
|
+
};
|
|
3
8
|
export declare const aukletDefaultCssDependencyConfig: CssDependencyGroup;
|
package/dist/config.js
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
export const aukletConfigFile = 'auklet.config.ts';
|
|
2
|
+
export const aukletDefaultCssOptions = {
|
|
3
|
+
sourceDir: 'src',
|
|
4
|
+
outputDir: 'dist',
|
|
5
|
+
themes: {},
|
|
6
|
+
};
|
|
2
7
|
export const aukletDefaultCssDependencyConfig = {
|
|
3
8
|
global: '/style.css',
|
|
4
9
|
component: ['/pages/**.css', '/components/**.css'],
|
package/dist/css/core/config.js
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
const CSS_LANGUAGE = 'css';
|
|
2
|
-
const LESS_LANGUAGE = 'less';
|
|
3
1
|
const CSS_EXTENSION = '.css';
|
|
4
|
-
const LESS_EXTENSION = '.less';
|
|
5
2
|
export const moduleCssBuildConfig = {
|
|
6
3
|
output: {
|
|
7
4
|
styleDir: 'style',
|
|
@@ -10,9 +7,5 @@ export const moduleCssBuildConfig = {
|
|
|
10
7
|
externalCssFile: 'external.css',
|
|
11
8
|
outputFormats: ['es', 'lib'],
|
|
12
9
|
},
|
|
13
|
-
|
|
14
|
-
styleExtensions: {
|
|
15
|
-
[CSS_EXTENSION]: CSS_LANGUAGE,
|
|
16
|
-
[LESS_EXTENSION]: LESS_LANGUAGE,
|
|
17
|
-
},
|
|
10
|
+
styleExtensions: [CSS_EXTENSION],
|
|
18
11
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import fs from 'node:fs';
|
|
2
2
|
import path from 'node:path';
|
|
3
|
-
import { aukletConfigFile } from '#auklet/config';
|
|
3
|
+
import { aukletConfigFile, aukletDefaultCssOptions } from '#auklet/config';
|
|
4
4
|
import { loadAukletConfig } from '#auklet/configLoader';
|
|
5
5
|
import { moduleCssBuildConfig } from '#auklet/css/core/config';
|
|
6
6
|
import { ModuleStyleImportCollector } from '#auklet/css/core/moduleStyleImportCollector';
|
|
@@ -69,7 +69,7 @@ export class ModuleCssGraph {
|
|
|
69
69
|
if (normalizedFile.endsWith('.ts') || normalizedFile.endsWith('.tsx')) {
|
|
70
70
|
return true;
|
|
71
71
|
}
|
|
72
|
-
return
|
|
72
|
+
return this.config.styleExtensions.some((extension) =>
|
|
73
73
|
normalizedFile.endsWith(extension),
|
|
74
74
|
);
|
|
75
75
|
}
|
|
@@ -77,7 +77,7 @@ export class ModuleCssGraph {
|
|
|
77
77
|
return normalizeCssFileKey(file).endsWith(aukletConfigFile);
|
|
78
78
|
}
|
|
79
79
|
isStyleFile(file) {
|
|
80
|
-
return
|
|
80
|
+
return this.config.styleExtensions.includes(path.extname(file));
|
|
81
81
|
}
|
|
82
82
|
getWorkspacePackageNames() {
|
|
83
83
|
return this.getWorkspacePackages().map((item) => item.packageName);
|
|
@@ -125,9 +125,13 @@ export class ModuleCssGraph {
|
|
|
125
125
|
const context = {
|
|
126
126
|
packageRoot,
|
|
127
127
|
sourceDir:
|
|
128
|
-
(_a = cssOptions.sourceDir) !== null && _a !== void 0
|
|
128
|
+
(_a = cssOptions.sourceDir) !== null && _a !== void 0
|
|
129
|
+
? _a
|
|
130
|
+
: aukletDefaultCssOptions.sourceDir,
|
|
129
131
|
outputDir:
|
|
130
|
-
(_b = cssOptions.outputDir) !== null && _b !== void 0
|
|
132
|
+
(_b = cssOptions.outputDir) !== null && _b !== void 0
|
|
133
|
+
? _b
|
|
134
|
+
: aukletDefaultCssOptions.outputDir,
|
|
131
135
|
};
|
|
132
136
|
const sourceRoot = path.join(packageRoot, context.sourceDir);
|
|
133
137
|
const resolver = new WorkspaceStyleResolver(this.config, context);
|
|
@@ -277,7 +281,7 @@ export class ModuleCssGraph {
|
|
|
277
281
|
context.sourceRoot,
|
|
278
282
|
context.context.packageRoot,
|
|
279
283
|
context.resolver,
|
|
280
|
-
|
|
284
|
+
this.config.styleExtensions,
|
|
281
285
|
);
|
|
282
286
|
const sourceFiles = fileWalker(context.sourceRoot);
|
|
283
287
|
const moduleStyleImports = importCollector.collect(
|
|
@@ -339,7 +343,7 @@ export class ModuleCssGraph {
|
|
|
339
343
|
getStyleFiles(sourceRoot) {
|
|
340
344
|
if (!fs.existsSync(sourceRoot)) return [];
|
|
341
345
|
return fileWalker(sourceRoot).filter((file) =>
|
|
342
|
-
|
|
346
|
+
this.config.styleExtensions.includes(path.extname(file)),
|
|
343
347
|
);
|
|
344
348
|
}
|
|
345
349
|
toDevModuleImportSpecifier(context, sourceStyleDir, specifier) {
|
|
@@ -86,7 +86,7 @@ export class StyleProcessor {
|
|
|
86
86
|
!(specifier === null || specifier === void 0
|
|
87
87
|
? void 0
|
|
88
88
|
: specifier.startsWith(RELATIVE_IMPORT_PREFIX)) ||
|
|
89
|
-
!this.config.styleExtensions
|
|
89
|
+
!this.config.styleExtensions.includes(path.extname(specifier))
|
|
90
90
|
) {
|
|
91
91
|
return;
|
|
92
92
|
}
|
|
@@ -96,11 +96,8 @@ export class StyleProcessor {
|
|
|
96
96
|
return imported;
|
|
97
97
|
}
|
|
98
98
|
parse(code, from) {
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
// Less support will plug into this branch before parsing once enabled.
|
|
102
|
-
return postcss.parse(code, { from });
|
|
103
|
-
}
|
|
99
|
+
// Keep parsing behind one method so future style languages can transform
|
|
100
|
+
// to CSS before PostCSS reads the final stylesheet.
|
|
104
101
|
return postcss.parse(code, { from });
|
|
105
102
|
}
|
|
106
103
|
parseImportSpecifier(params) {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import fs from 'node:fs';
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
import { moduleCssBuildConfig } from '#auklet/css/core/config';
|
|
4
|
+
import { aukletDefaultCssOptions } from '#auklet/config';
|
|
4
5
|
import { StyleProcessor } from '#auklet/css/core/styleProcessor';
|
|
5
6
|
import { ModuleStyleImportCollector } from '#auklet/css/core/moduleStyleImportCollector';
|
|
6
7
|
import {
|
|
@@ -120,7 +121,7 @@ export class ModuleCssBuilder {
|
|
|
120
121
|
}
|
|
121
122
|
getStyleFiles(files) {
|
|
122
123
|
return files.filter((file) =>
|
|
123
|
-
|
|
124
|
+
this.config.styleExtensions.includes(path.extname(file)),
|
|
124
125
|
);
|
|
125
126
|
}
|
|
126
127
|
createBuildContext(cssOptions) {
|
|
@@ -133,14 +134,14 @@ export class ModuleCssBuilder {
|
|
|
133
134
|
? _a
|
|
134
135
|
: this.context.sourceDir) !== null && _b !== void 0
|
|
135
136
|
? _b
|
|
136
|
-
:
|
|
137
|
+
: aukletDefaultCssOptions.sourceDir,
|
|
137
138
|
outputDir:
|
|
138
139
|
(_d =
|
|
139
140
|
(_c = cssOptions.outputDir) !== null && _c !== void 0
|
|
140
141
|
? _c
|
|
141
142
|
: this.context.outputDir) !== null && _d !== void 0
|
|
142
143
|
? _d
|
|
143
|
-
:
|
|
144
|
+
: aukletDefaultCssOptions.outputDir,
|
|
144
145
|
};
|
|
145
146
|
}
|
|
146
147
|
applyContext(context) {
|
|
@@ -151,7 +152,7 @@ export class ModuleCssBuilder {
|
|
|
151
152
|
this.srcRoot,
|
|
152
153
|
context.packageRoot,
|
|
153
154
|
this.resolver,
|
|
154
|
-
|
|
155
|
+
this.config.styleExtensions,
|
|
155
156
|
);
|
|
156
157
|
}
|
|
157
158
|
copyStyleFiles(files, outRoot) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import fs from 'node:fs';
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
import chokidar from 'chokidar';
|
|
4
|
-
import { aukletConfigFile } from '#auklet/config';
|
|
4
|
+
import { aukletConfigFile, aukletDefaultCssOptions } from '#auklet/config';
|
|
5
5
|
import { moduleCssBuildConfig } from '#auklet/css/core/config';
|
|
6
6
|
import { ModuleCssBuilder } from '#auklet/css/production/moduleCssBuilder';
|
|
7
7
|
export class ModuleCssWatcher {
|
|
@@ -60,7 +60,7 @@ export class ModuleCssWatcher {
|
|
|
60
60
|
? _b
|
|
61
61
|
: this.context.sourceDir) !== null && _c !== void 0
|
|
62
62
|
? _c
|
|
63
|
-
:
|
|
63
|
+
: aukletDefaultCssOptions.sourceDir;
|
|
64
64
|
const sourceRoot = path.join(this.context.packageRoot, sourceDir);
|
|
65
65
|
const configPath = path.join(this.context.packageRoot, aukletConfigFile);
|
|
66
66
|
const watchPaths = [sourceRoot, configPath].filter((file) =>
|
package/dist/index.d.ts
CHANGED
|
@@ -9,11 +9,13 @@ export type {
|
|
|
9
9
|
PackageBuildFormat,
|
|
10
10
|
PackageBuildOptions,
|
|
11
11
|
ResolvedModuleCssBuildContext,
|
|
12
|
-
StyleLanguage,
|
|
13
12
|
} from '#auklet/types';
|
|
14
13
|
export type { RunTsdownOptions } from '#auklet/build/runTsdown';
|
|
15
14
|
export type { AukletCssPluginOptions } from '#auklet/css/vite/vitePlugin';
|
|
16
|
-
export {
|
|
15
|
+
export {
|
|
16
|
+
aukletDefaultCssDependencyConfig,
|
|
17
|
+
aukletDefaultCssOptions,
|
|
18
|
+
} from '#auklet/config';
|
|
17
19
|
export {
|
|
18
20
|
loadAukletConfig,
|
|
19
21
|
resolveAukletConfigModule,
|
package/dist/index.js
CHANGED
package/dist/types.d.ts
CHANGED
|
@@ -29,7 +29,6 @@ export type LoadAukletConfigOptions = {
|
|
|
29
29
|
configFile?: string;
|
|
30
30
|
cacheBust?: boolean;
|
|
31
31
|
};
|
|
32
|
-
export type StyleLanguage = 'css' | 'less';
|
|
33
32
|
export interface ModuleCssBuildContext {
|
|
34
33
|
packageRoot?: string;
|
|
35
34
|
aukletConfig?: AukletConfig;
|
|
@@ -55,6 +54,5 @@ export interface ModuleCssBuildOutputConfig {
|
|
|
55
54
|
}
|
|
56
55
|
export interface ModuleCssBuildConfig {
|
|
57
56
|
output: ModuleCssBuildOutputConfig;
|
|
58
|
-
styleExtensions:
|
|
59
|
-
lessLanguage: StyleLanguage;
|
|
57
|
+
styleExtensions: Array<string>;
|
|
60
58
|
}
|
package/package.json
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "auklet",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"author": "chentao.arthur",
|
|
6
|
-
"packageManager": "pnpm@10.27.0",
|
|
7
6
|
"description": "Build utilities for TypeScript packages and module CSS output.",
|
|
8
7
|
"engines": {
|
|
9
8
|
"node": ">=22",
|
|
@@ -13,15 +12,6 @@
|
|
|
13
12
|
"auk": "./bin/entry.cjs",
|
|
14
13
|
"auklet": "./bin/entry.cjs"
|
|
15
14
|
},
|
|
16
|
-
"scripts": {
|
|
17
|
-
"prepare": "husky",
|
|
18
|
-
"build": "rimraf dist && tsc -p tsconfig.json",
|
|
19
|
-
"test": "vitest run",
|
|
20
|
-
"test:coverage": "vitest run --coverage",
|
|
21
|
-
"typecheck": "tsc --noEmit --skipLibCheck",
|
|
22
|
-
"format:md": "prettier --write --parser markdown \"TESTING.md\"",
|
|
23
|
-
"format": "prettier --write \"(bin|src|dist)/**/*.{js,mjs,cjs,ts,tsx}\""
|
|
24
|
-
},
|
|
25
15
|
"exports": {
|
|
26
16
|
".": {
|
|
27
17
|
"types": "./dist/index.d.ts",
|
|
@@ -82,5 +72,13 @@
|
|
|
82
72
|
"*.{json,md}": [
|
|
83
73
|
"prettier --write"
|
|
84
74
|
]
|
|
75
|
+
},
|
|
76
|
+
"scripts": {
|
|
77
|
+
"build": "rimraf dist && tsc -p tsconfig.json",
|
|
78
|
+
"test": "vitest run",
|
|
79
|
+
"test:coverage": "vitest run --coverage",
|
|
80
|
+
"typecheck": "tsc --noEmit --skipLibCheck",
|
|
81
|
+
"format:md": "prettier --write --parser markdown \"TESTING.md\"",
|
|
82
|
+
"format": "prettier --write \"(bin|src|dist)/**/*.{js,mjs,cjs,ts,tsx}\""
|
|
85
83
|
}
|
|
86
|
-
}
|
|
84
|
+
}
|