auklet 0.0.16 → 0.0.18
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 +37 -1
- 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 +7 -7
- package/dist/css/constants.js +1 -1
- 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 +22 -33
- 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 +41 -8
- package/dist/css/core/style/specifier.js +107 -18
- package/dist/css/core/styleImports/autoImportRules.d.ts +13 -0
- package/dist/css/core/styleImports/autoImportRules.js +68 -0
- package/dist/css/core/styleImports/collector.d.ts +12 -25
- package/dist/css/core/styleImports/collector.js +101 -206
- package/dist/css/core/styleImports/sourceImportExportAnalyzer.d.ts +11 -0
- package/dist/css/core/styleImports/sourceImportExportAnalyzer.js +173 -0
- package/dist/css/core/styleModuleEntryPlanner.d.ts +21 -24
- package/dist/css/core/styleModuleEntryPlanner.js +45 -62
- 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 +8 -15
- package/dist/css/core/workspaceStyleResolver.js +34 -76
- package/dist/css/production/builder.d.ts +9 -16
- package/dist/css/production/builder.js +51 -57
- package/dist/css/production/format/entryWriter.js +36 -49
- package/dist/css/production/format/externalWriter.js +21 -33
- package/dist/css/production/format/{componentWriter.d.ts → moduleEntryWriter.d.ts} +1 -1
- package/dist/css/production/format/moduleEntryWriter.js +48 -0
- 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 +4 -9
- 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 +58 -67
- 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 +51 -50
- 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 +16 -7
- package/dist/css/vite/moduleGraph/packageSource/monorepo.js +60 -68
- package/dist/css/vite/moduleGraph/packageSource/singlePackage.d.ts +21 -0
- package/dist/css/vite/moduleGraph/packageSource/singlePackage.js +63 -0
- 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 +173 -264
- 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 +117 -109
- package/dist/css/watch/watcher.d.ts +15 -21
- package/dist/css/watch/watcher.js +84 -81
- 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
- package/dist/css/core/styleImports/sourceReference.d.ts +0 -19
- package/dist/css/core/styleImports/sourceReference.js +0 -193
- package/dist/css/production/format/componentWriter.js +0 -71
|
@@ -3,27 +3,18 @@ import { normalizeAukletConfig } from '#auklet/config';
|
|
|
3
3
|
import { createBundleConfigs } from '#auklet/build/bundleConfig';
|
|
4
4
|
import { createModuleConfigs } from '#auklet/build/moduleConfig';
|
|
5
5
|
import { createBuildContext } from '#auklet/build/tsdown/context';
|
|
6
|
-
export function defineKernelPackageConfigFromOptions(
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
normalizedConfig.output,
|
|
17
|
-
);
|
|
18
|
-
const bundleConfigs = createBundleConfigs(context, formats);
|
|
19
|
-
const moduleConfigs = normalizedConfig.modules
|
|
20
|
-
? createModuleConfigs(context)
|
|
21
|
-
: [];
|
|
22
|
-
return [...bundleConfigs, ...moduleConfigs];
|
|
6
|
+
export function defineKernelPackageConfigFromOptions(packageRoot = process.cwd(), config = {}) {
|
|
7
|
+
const normalizedConfig = normalizeAukletConfig(config);
|
|
8
|
+
const buildOptions = normalizedConfig.build;
|
|
9
|
+
const formats = buildOptions.formats;
|
|
10
|
+
const context = createBuildContext(packageRoot, buildOptions, normalizedConfig.output);
|
|
11
|
+
const bundleConfigs = createBundleConfigs(context, formats);
|
|
12
|
+
const moduleConfigs = normalizedConfig.modules
|
|
13
|
+
? createModuleConfigs(context)
|
|
14
|
+
: [];
|
|
15
|
+
return [...bundleConfigs, ...moduleConfigs];
|
|
23
16
|
}
|
|
24
|
-
export async function defineKernelPackageConfigFromFile(
|
|
25
|
-
|
|
26
|
-
)
|
|
27
|
-
const config = await loadAukletConfig(packageRoot, { cacheBust: true });
|
|
28
|
-
return defineKernelPackageConfigFromOptions(packageRoot, config);
|
|
17
|
+
export async function defineKernelPackageConfigFromFile(packageRoot = process.cwd()) {
|
|
18
|
+
const config = await loadAukletConfig(packageRoot, { cacheBust: true });
|
|
19
|
+
return defineKernelPackageConfigFromOptions(packageRoot, config);
|
|
29
20
|
}
|
|
@@ -1,16 +1,8 @@
|
|
|
1
1
|
import type { PackageBuildOptions } from '#auklet/types';
|
|
2
2
|
import type { BuildContext, PackageJsonLike } from '#auklet/build/tsdown/types';
|
|
3
|
-
export declare function getPackageExternal(
|
|
4
|
-
|
|
5
|
-
options: PackageBuildOptions,
|
|
6
|
-
): string[];
|
|
7
|
-
export declare function getPeerExternal(
|
|
8
|
-
pkg: PackageJsonLike,
|
|
9
|
-
options: PackageBuildOptions,
|
|
10
|
-
): string[];
|
|
3
|
+
export declare function getPackageExternal(pkg: PackageJsonLike, options: PackageBuildOptions): string[];
|
|
4
|
+
export declare function getPeerExternal(pkg: PackageJsonLike, options: PackageBuildOptions): string[];
|
|
11
5
|
export declare function getIifeGlobals(context: BuildContext): {
|
|
12
|
-
|
|
6
|
+
[x: string]: string;
|
|
13
7
|
};
|
|
14
|
-
export declare function getIifeAlwaysBundle(
|
|
15
|
-
context: BuildContext,
|
|
16
|
-
): (id: string) => boolean;
|
|
8
|
+
export declare function getIifeAlwaysBundle(context: BuildContext): (id: string) => boolean;
|
|
@@ -1,65 +1,61 @@
|
|
|
1
1
|
import { parseModuleId } from '#auklet/build/tsdown/parseModuleId';
|
|
2
2
|
const getExternal = (names) => {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
const external = new Set();
|
|
4
|
+
for (const name of names) {
|
|
5
|
+
external.add(name);
|
|
6
|
+
external.add(`${name}/*`);
|
|
7
|
+
}
|
|
8
|
+
return [...external];
|
|
9
9
|
};
|
|
10
10
|
const getDependencyGlobalName = (name) => {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
11
|
+
return name
|
|
12
|
+
.replace(/^@/, '')
|
|
13
|
+
.split(/[/-]/g)
|
|
14
|
+
.filter(Boolean)
|
|
15
|
+
.map((label) => label[0].toUpperCase() + label.slice(1))
|
|
16
|
+
.join('');
|
|
17
17
|
};
|
|
18
18
|
export function getPackageExternal(pkg, options) {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
19
|
+
return getExternal([
|
|
20
|
+
...Object.keys(pkg.dependencies ?? {}),
|
|
21
|
+
...Object.keys(pkg.peerDependencies ?? {}),
|
|
22
|
+
...Object.keys(pkg.optionalDependencies ?? {}),
|
|
23
|
+
...Object.keys(pkg.devDependencies ?? {}),
|
|
24
|
+
...(options.externals ?? []),
|
|
25
|
+
]);
|
|
26
26
|
}
|
|
27
27
|
export function getPeerExternal(pkg, options) {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
28
|
+
return [
|
|
29
|
+
...new Set([
|
|
30
|
+
...Object.keys(pkg.peerDependencies ?? {}),
|
|
31
|
+
...(options.externals ?? []),
|
|
32
|
+
]),
|
|
33
|
+
];
|
|
34
34
|
}
|
|
35
35
|
export function getIifeGlobals(context) {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
...context.globals,
|
|
41
|
-
};
|
|
36
|
+
return {
|
|
37
|
+
...Object.fromEntries(context.peerExternal.map((name) => [name, getDependencyGlobalName(name)])),
|
|
38
|
+
...context.globals,
|
|
39
|
+
};
|
|
42
40
|
}
|
|
43
41
|
// React 本体 external,jsx-runtime 这层小入口 bundle 进产物。
|
|
44
42
|
export function getIifeAlwaysBundle(context) {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}
|
|
63
|
-
return peerDependencies.has(id) ? false : runtimeDependencies.has(id);
|
|
64
|
-
};
|
|
43
|
+
const warnedParseFailures = new Set();
|
|
44
|
+
const peerDependencies = new Set(context.peerExternal);
|
|
45
|
+
const runtimeDependencies = new Set(context.runtimeDependencyNames);
|
|
46
|
+
return (id) => {
|
|
47
|
+
if (id === 'react/jsx-runtime' || id === 'react/jsx-dev-runtime') {
|
|
48
|
+
return peerDependencies.has('react');
|
|
49
|
+
}
|
|
50
|
+
try {
|
|
51
|
+
id = parseModuleId(id).name;
|
|
52
|
+
}
|
|
53
|
+
catch (error) {
|
|
54
|
+
if (!warnedParseFailures.has(id)) {
|
|
55
|
+
warnedParseFailures.add(id);
|
|
56
|
+
console.warn(`[auklet:build] Unable to parse module id for IIFE bundle dependency classification: ${id}`, error);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return peerDependencies.has(id) ? false : runtimeDependencies.has(id);
|
|
60
|
+
};
|
|
65
61
|
}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
export declare function getBundleEntry(packageRoot: string): {
|
|
2
|
-
|
|
2
|
+
index: string;
|
|
3
|
+
};
|
|
4
|
+
export declare function getModuleEntries(packageRoot: string): Record<string, string> | {
|
|
5
|
+
index: string;
|
|
3
6
|
};
|
|
4
|
-
export declare function getModuleEntries(packageRoot: string):
|
|
5
|
-
| Record<string, string>
|
|
6
|
-
| {
|
|
7
|
-
index: string;
|
|
8
|
-
};
|
|
@@ -1,48 +1,49 @@
|
|
|
1
1
|
import fs from 'node:fs';
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
const toPosixPath = (value) => {
|
|
4
|
-
|
|
4
|
+
return value.split(path.sep).join('/');
|
|
5
5
|
};
|
|
6
6
|
export function getBundleEntry(packageRoot) {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
const tsEntry = 'src/index.ts';
|
|
8
|
+
const tsxEntry = 'src/index.tsx';
|
|
9
|
+
if (fs.existsSync(path.join(packageRoot, tsEntry))) {
|
|
10
|
+
return { index: tsEntry };
|
|
11
|
+
}
|
|
12
|
+
if (fs.existsSync(path.join(packageRoot, tsxEntry))) {
|
|
13
|
+
return { index: tsxEntry };
|
|
14
|
+
}
|
|
10
15
|
return { index: tsEntry };
|
|
11
|
-
}
|
|
12
|
-
if (fs.existsSync(path.join(packageRoot, tsxEntry))) {
|
|
13
|
-
return { index: tsxEntry };
|
|
14
|
-
}
|
|
15
|
-
return { index: tsEntry };
|
|
16
16
|
}
|
|
17
17
|
export function getModuleEntries(packageRoot) {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
23
|
-
const collect = (dir) => {
|
|
24
|
-
const dirEntries = fs
|
|
25
|
-
.readdirSync(dir, { withFileTypes: true })
|
|
26
|
-
.sort((a, b) => a.name.localeCompare(b.name));
|
|
27
|
-
for (const dirEntry of dirEntries) {
|
|
28
|
-
const file = path.join(dir, dirEntry.name);
|
|
29
|
-
if (dirEntry.isDirectory()) {
|
|
30
|
-
if (dirEntry.name !== '__tests__') collect(file);
|
|
31
|
-
continue;
|
|
32
|
-
}
|
|
33
|
-
if (!/\.(ts|tsx)$/.test(dirEntry.name)) continue;
|
|
34
|
-
if (/\.d\.ts$/.test(dirEntry.name)) continue;
|
|
35
|
-
if (/\.(spec|test)\.(ts|tsx)$/.test(dirEntry.name)) continue;
|
|
36
|
-
const sourceRelative = toPosixPath(path.relative(packageRoot, file));
|
|
37
|
-
const entryName = toPosixPath(path.relative(sourceRoot, file)).replace(
|
|
38
|
-
/\.(ts|tsx)$/,
|
|
39
|
-
'',
|
|
40
|
-
);
|
|
41
|
-
entries[entryName] ??= sourceRelative;
|
|
18
|
+
const sourceRoot = path.join(packageRoot, 'src');
|
|
19
|
+
const entries = {};
|
|
20
|
+
if (!fs.existsSync(sourceRoot)) {
|
|
21
|
+
return getBundleEntry(packageRoot);
|
|
42
22
|
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
23
|
+
const collect = (dir) => {
|
|
24
|
+
const dirEntries = fs
|
|
25
|
+
.readdirSync(dir, { withFileTypes: true })
|
|
26
|
+
.sort((a, b) => a.name.localeCompare(b.name));
|
|
27
|
+
for (const dirEntry of dirEntries) {
|
|
28
|
+
const file = path.join(dir, dirEntry.name);
|
|
29
|
+
if (dirEntry.isDirectory()) {
|
|
30
|
+
if (dirEntry.name !== '__tests__')
|
|
31
|
+
collect(file);
|
|
32
|
+
continue;
|
|
33
|
+
}
|
|
34
|
+
if (!/\.(ts|tsx)$/.test(dirEntry.name))
|
|
35
|
+
continue;
|
|
36
|
+
if (/\.d\.ts$/.test(dirEntry.name))
|
|
37
|
+
continue;
|
|
38
|
+
if (/\.(spec|test)\.(ts|tsx)$/.test(dirEntry.name))
|
|
39
|
+
continue;
|
|
40
|
+
const sourceRelative = toPosixPath(path.relative(packageRoot, file));
|
|
41
|
+
const entryName = toPosixPath(path.relative(sourceRoot, file)).replace(/\.(ts|tsx)$/, '');
|
|
42
|
+
entries[entryName] ??= sourceRelative;
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
collect(sourceRoot);
|
|
46
|
+
return Object.keys(entries).length > 0
|
|
47
|
+
? entries
|
|
48
|
+
: getBundleEntry(packageRoot);
|
|
48
49
|
}
|
|
@@ -1,85 +1,100 @@
|
|
|
1
1
|
export function parseModuleId(moduleId) {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
} else {
|
|
20
|
-
buf += char;
|
|
21
|
-
}
|
|
22
|
-
};
|
|
23
|
-
for (let i = 0, l = moduleId.length; i < l; i++) {
|
|
24
|
-
const char = moduleId[i];
|
|
25
|
-
if (char === '@') {
|
|
26
|
-
if (i === 0) {
|
|
27
|
-
buf += char;
|
|
28
|
-
isScope = true;
|
|
29
|
-
} else if (!name) {
|
|
30
|
-
if (isScope) {
|
|
31
|
-
if (slash === 1 && buf[buf.length - 1] !== '/') {
|
|
2
|
+
let name = '';
|
|
3
|
+
let path = '';
|
|
4
|
+
let version = '';
|
|
5
|
+
let buf = '';
|
|
6
|
+
let slash = 0;
|
|
7
|
+
let isScope = false;
|
|
8
|
+
const set = (type) => {
|
|
9
|
+
if (type === 'path')
|
|
10
|
+
path = buf;
|
|
11
|
+
if (type === 'name')
|
|
12
|
+
name = buf;
|
|
13
|
+
if (type === 'version')
|
|
14
|
+
version = buf;
|
|
15
|
+
buf = '';
|
|
16
|
+
};
|
|
17
|
+
const setValueBySlash = (char) => {
|
|
18
|
+
if (!name) {
|
|
32
19
|
set('name');
|
|
33
|
-
|
|
20
|
+
}
|
|
21
|
+
else if (!version) {
|
|
22
|
+
set('version');
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
34
25
|
buf += char;
|
|
35
|
-
}
|
|
36
|
-
} else {
|
|
37
|
-
set('name');
|
|
38
26
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
27
|
+
};
|
|
28
|
+
for (let i = 0, l = moduleId.length; i < l; i++) {
|
|
29
|
+
const char = moduleId[i];
|
|
30
|
+
if (char === '@') {
|
|
31
|
+
if (i === 0) {
|
|
32
|
+
buf += char;
|
|
33
|
+
isScope = true;
|
|
34
|
+
}
|
|
35
|
+
else if (!name) {
|
|
36
|
+
if (isScope) {
|
|
37
|
+
if (slash === 1 && buf[buf.length - 1] !== '/') {
|
|
38
|
+
set('name');
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
buf += char;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
set('name');
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
buf += char;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
else if (char === '/') {
|
|
53
|
+
if (slash === 0) {
|
|
54
|
+
if (!isScope) {
|
|
55
|
+
setValueBySlash(char);
|
|
56
|
+
}
|
|
57
|
+
buf += char;
|
|
58
|
+
}
|
|
59
|
+
else if (slash === 1) {
|
|
60
|
+
if (isScope) {
|
|
61
|
+
setValueBySlash(char);
|
|
62
|
+
}
|
|
63
|
+
buf += char;
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
buf += char;
|
|
67
|
+
}
|
|
68
|
+
slash++;
|
|
46
69
|
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
if (isScope) {
|
|
50
|
-
setValueBySlash(char);
|
|
70
|
+
else {
|
|
71
|
+
buf += char;
|
|
51
72
|
}
|
|
52
|
-
buf += char;
|
|
53
|
-
} else {
|
|
54
|
-
buf += char;
|
|
55
|
-
}
|
|
56
|
-
slash++;
|
|
57
|
-
} else {
|
|
58
|
-
buf += char;
|
|
59
73
|
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
path
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
name
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
74
|
+
if (!name) {
|
|
75
|
+
set('name');
|
|
76
|
+
}
|
|
77
|
+
else if (!version) {
|
|
78
|
+
moduleId[name.length] === '@' ? set('version') : set('path');
|
|
79
|
+
}
|
|
80
|
+
else if (!path) {
|
|
81
|
+
set('path');
|
|
82
|
+
}
|
|
83
|
+
if (path) {
|
|
84
|
+
path = `.${path}`;
|
|
85
|
+
}
|
|
86
|
+
// `@vue` -> ''
|
|
87
|
+
// `@vue/` -> ''
|
|
88
|
+
// `@vue//` -> ''
|
|
89
|
+
if (isScope && (slash === 0 || name[name.length - 1] === '/')) {
|
|
90
|
+
name = '';
|
|
91
|
+
path = '';
|
|
92
|
+
version = '';
|
|
93
|
+
}
|
|
94
|
+
return {
|
|
95
|
+
name,
|
|
96
|
+
path,
|
|
97
|
+
version,
|
|
98
|
+
raw: moduleId,
|
|
99
|
+
};
|
|
85
100
|
}
|
|
@@ -1,38 +1,31 @@
|
|
|
1
1
|
import type { UserConfig } from 'tsdown/config';
|
|
2
|
-
import type {
|
|
3
|
-
ConfigureTsdownContext,
|
|
4
|
-
PackageBuildFormat,
|
|
5
|
-
PackageBuildOptions,
|
|
6
|
-
} from '#auklet/types';
|
|
2
|
+
import type { ConfigureTsdownContext, PackageBuildFormat, PackageBuildOptions } from '#auklet/types';
|
|
7
3
|
export type TsdownFormat = PackageBuildFormat;
|
|
8
4
|
export type PackageJsonLike = {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
5
|
+
name?: string;
|
|
6
|
+
version?: string;
|
|
7
|
+
author?: string;
|
|
8
|
+
dependencies?: Record<string, string>;
|
|
9
|
+
peerDependencies?: Record<string, string>;
|
|
10
|
+
optionalDependencies?: Record<string, string>;
|
|
11
|
+
devDependencies?: Record<string, string>;
|
|
16
12
|
};
|
|
17
13
|
export type BuildContext = {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
14
|
+
packageRoot: string;
|
|
15
|
+
tsconfig: string;
|
|
16
|
+
output: string;
|
|
17
|
+
pkg: PackageJsonLike;
|
|
18
|
+
runtimeDependencyNames: Array<string>;
|
|
19
|
+
packageExternal: Array<string>;
|
|
20
|
+
peerExternal: Array<string>;
|
|
21
|
+
alias: Record<string, string>;
|
|
22
|
+
mainFields?: Array<string>;
|
|
23
|
+
globals: Record<string, string>;
|
|
24
|
+
banner: string;
|
|
25
|
+
globalName: string;
|
|
26
|
+
target: NonNullable<PackageBuildOptions['target']>;
|
|
27
|
+
platform: NonNullable<PackageBuildOptions['platform']>;
|
|
28
|
+
configureTsdown?: PackageBuildOptions['configureTsdown'];
|
|
33
29
|
};
|
|
34
30
|
export type TsdownDeps = NonNullable<UserConfig['deps']>;
|
|
35
|
-
export type ConfigureTsdownOptions = Pick<
|
|
36
|
-
ConfigureTsdownContext,
|
|
37
|
-
'kind' | 'format'
|
|
38
|
-
>;
|
|
31
|
+
export type ConfigureTsdownOptions = Pick<ConfigureTsdownContext, 'kind' | 'format'>;
|
|
@@ -1,6 +1,3 @@
|
|
|
1
1
|
import { defineKernelPackageConfigFromFile } from '#auklet/build/tsdown/define';
|
|
2
|
-
export {
|
|
3
|
-
defineKernelPackageConfigFromFile,
|
|
4
|
-
defineKernelPackageConfigFromOptions,
|
|
5
|
-
} from '#auklet/build/tsdown/define';
|
|
2
|
+
export { defineKernelPackageConfigFromFile, defineKernelPackageConfigFromOptions, } from '#auklet/build/tsdown/define';
|
|
6
3
|
export default defineKernelPackageConfigFromFile(process.cwd());
|
package/dist/config.d.ts
CHANGED
|
@@ -1,44 +1,44 @@
|
|
|
1
1
|
import type { AukletConfig, StyleDependencyGroup } from '#auklet/types';
|
|
2
|
-
export declare const aukletConfigFile =
|
|
2
|
+
export declare const aukletConfigFile = "auklet.config.ts";
|
|
3
3
|
export declare const aukletDefaultOptions: {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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
16
|
};
|
|
17
17
|
export declare const aukletDefaultStyleDependencyConfig: StyleDependencyGroup;
|
|
18
18
|
export declare function normalizeAukletConfig(config?: AukletConfig): {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
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
|
+
alias?: Record<string, string>;
|
|
29
|
+
mainFields?: Array<string>;
|
|
30
|
+
globals?: Record<string, string>;
|
|
31
|
+
configureTsdown?: import("#auklet/types").ConfigureTsdown;
|
|
32
|
+
tsconfig?: string;
|
|
33
|
+
};
|
|
34
|
+
styles: {
|
|
35
|
+
themes: {};
|
|
36
|
+
dependencies: {
|
|
37
|
+
[k: string]: {
|
|
38
|
+
entry: string | string[] | undefined;
|
|
39
|
+
themes: Record<string, string> | undefined;
|
|
40
|
+
components: string | string[] | undefined;
|
|
41
|
+
};
|
|
42
|
+
};
|
|
42
43
|
};
|
|
43
|
-
};
|
|
44
44
|
};
|