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.
Files changed (95) hide show
  1. package/dist/build/bundleConfig.d.ts +1 -4
  2. package/dist/build/bundleConfig.js +59 -71
  3. package/dist/build/cleanOutput.d.ts +2 -8
  4. package/dist/build/cleanOutput.js +7 -7
  5. package/dist/build/moduleConfig.d.ts +1 -3
  6. package/dist/build/moduleConfig.js +21 -40
  7. package/dist/build/runTsdown.d.ts +2 -5
  8. package/dist/build/runTsdown.js +18 -23
  9. package/dist/build/tsdown/common.d.ts +17 -28
  10. package/dist/build/tsdown/common.js +22 -25
  11. package/dist/build/tsdown/context.d.ts +16 -20
  12. package/dist/build/tsdown/context.js +41 -45
  13. package/dist/build/tsdown/define.d.ts +2 -7
  14. package/dist/build/tsdown/define.js +13 -22
  15. package/dist/build/tsdown/dependencies.d.ts +4 -12
  16. package/dist/build/tsdown/dependencies.js +47 -51
  17. package/dist/build/tsdown/entries.d.ts +4 -6
  18. package/dist/build/tsdown/entries.js +39 -38
  19. package/dist/build/tsdown/parseModuleId.d.ts +4 -4
  20. package/dist/build/tsdown/parseModuleId.js +92 -77
  21. package/dist/build/tsdown/types.d.ts +24 -31
  22. package/dist/build/tsdownConfig.js +1 -4
  23. package/dist/config.d.ts +37 -37
  24. package/dist/config.js +38 -41
  25. package/dist/configLoader.d.ts +2 -7
  26. package/dist/configLoader.js +59 -64
  27. package/dist/css/config.js +8 -8
  28. package/dist/css/constants.d.ts +6 -6
  29. package/dist/css/core/resolvers/packageImports.d.ts +1 -5
  30. package/dist/css/core/resolvers/packageImports.js +35 -40
  31. package/dist/css/core/resolvers/relative.d.ts +1 -4
  32. package/dist/css/core/resolvers/relative.js +3 -2
  33. package/dist/css/core/resolvers/tsconfigPaths.d.ts +1 -5
  34. package/dist/css/core/resolvers/tsconfigPaths.js +59 -66
  35. package/dist/css/core/style/dependencies.d.ts +6 -16
  36. package/dist/css/core/style/dependencies.js +35 -38
  37. package/dist/css/core/style/entries.d.ts +35 -58
  38. package/dist/css/core/style/entries.js +20 -31
  39. package/dist/css/core/style/files.d.ts +2 -7
  40. package/dist/css/core/style/files.js +11 -11
  41. package/dist/css/core/style/specifier.d.ts +5 -8
  42. package/dist/css/core/style/specifier.js +21 -18
  43. package/dist/css/core/styleImports/collector.d.ts +17 -25
  44. package/dist/css/core/styleImports/collector.js +162 -201
  45. package/dist/css/core/styleImports/sourceReference.d.ts +8 -16
  46. package/dist/css/core/styleImports/sourceReference.js +153 -173
  47. package/dist/css/core/styleModuleEntryPlanner.d.ts +21 -24
  48. package/dist/css/core/styleModuleEntryPlanner.js +44 -61
  49. package/dist/css/core/stylePackageContext.d.ts +16 -20
  50. package/dist/css/core/stylePackageContext.js +33 -49
  51. package/dist/css/core/styleProcessor.js +105 -104
  52. package/dist/css/core/workspaceStyleResolver.d.ts +9 -15
  53. package/dist/css/core/workspaceStyleResolver.js +62 -72
  54. package/dist/css/production/builder.d.ts +9 -16
  55. package/dist/css/production/builder.js +51 -57
  56. package/dist/css/production/format/componentWriter.js +45 -66
  57. package/dist/css/production/format/entryWriter.js +36 -49
  58. package/dist/css/production/format/externalWriter.js +21 -33
  59. package/dist/css/production/format/moduleWriter.js +23 -26
  60. package/dist/css/production/format/shared.d.ts +8 -15
  61. package/dist/css/production/format/shared.js +5 -6
  62. package/dist/css/production/format/sourceWriter.js +11 -11
  63. package/dist/css/production/format/themeWriter.js +56 -71
  64. package/dist/css/production/moduleOutputWriter.d.ts +18 -21
  65. package/dist/css/production/moduleOutputWriter.js +56 -65
  66. package/dist/css/production/packageEntryWriter.d.ts +12 -15
  67. package/dist/css/production/packageEntryWriter.js +42 -45
  68. package/dist/css/vite/hmr.d.ts +11 -11
  69. package/dist/css/vite/hmr.js +93 -109
  70. package/dist/css/vite/moduleGraph/devDependency.d.ts +7 -12
  71. package/dist/css/vite/moduleGraph/devDependency.js +8 -8
  72. package/dist/css/vite/moduleGraph/graph.d.ts +20 -23
  73. package/dist/css/vite/moduleGraph/graph.js +46 -49
  74. package/dist/css/vite/moduleGraph/loadResult.d.ts +3 -5
  75. package/dist/css/vite/moduleGraph/loadResult.js +7 -9
  76. package/dist/css/vite/moduleGraph/packageSource/monorepo.d.ts +4 -6
  77. package/dist/css/vite/moduleGraph/packageSource/monorepo.js +59 -64
  78. package/dist/css/vite/moduleGraph/packageSource/types.d.ts +7 -7
  79. package/dist/css/vite/moduleGraph/requestCache.d.ts +46 -57
  80. package/dist/css/vite/moduleGraph/requestCache.js +53 -51
  81. package/dist/css/vite/moduleGraph/styleCodeFactory.d.ts +15 -18
  82. package/dist/css/vite/moduleGraph/styleCodeFactory.js +182 -263
  83. package/dist/css/vite/moduleGraph/styleId.d.ts +3 -6
  84. package/dist/css/vite/moduleGraph/styleId.js +12 -11
  85. package/dist/css/vite/moduleGraph/types.d.ts +11 -14
  86. package/dist/css/vite/vitePlugin.d.ts +16 -20
  87. package/dist/css/vite/vitePlugin.js +110 -109
  88. package/dist/css/watch/watcher.d.ts +15 -21
  89. package/dist/css/watch/watcher.js +83 -80
  90. package/dist/index.d.ts +3 -25
  91. package/dist/index.js +2 -9
  92. package/dist/types.d.ts +59 -62
  93. package/dist/utils.d.ts +3 -7
  94. package/dist/utils.js +50 -47
  95. package/package.json +31 -33
@@ -8,124 +8,125 @@ const RESOLVED_VIRTUAL_ID_PREFIX = '\0auklet-css:';
8
8
  const BROWSER_VIRTUAL_ID_PREFIX = 'auklet-css:';
9
9
  const stripQuery = (id) => id.split('?')[0];
10
10
  const toResolvedVirtualId = (id) => {
11
- if (id.startsWith(RESOLVED_VIRTUAL_ID_PREFIX)) {
12
- return id;
13
- }
14
- if (id.startsWith(BROWSER_VIRTUAL_ID_PREFIX)) {
15
- return `${RESOLVED_VIRTUAL_ID_PREFIX}${id.slice(
16
- BROWSER_VIRTUAL_ID_PREFIX.length,
17
- )}`;
18
- }
19
- return null;
11
+ if (id.startsWith(RESOLVED_VIRTUAL_ID_PREFIX)) {
12
+ return id;
13
+ }
14
+ if (id.startsWith(BROWSER_VIRTUAL_ID_PREFIX)) {
15
+ return `${RESOLVED_VIRTUAL_ID_PREFIX}${id.slice(BROWSER_VIRTUAL_ID_PREFIX.length)}`;
16
+ }
17
+ return null;
20
18
  };
21
19
  const findWorkspaceRoot = (startDir) => {
22
- let current = path.resolve(startDir);
23
- while (true) {
24
- if (fs.existsSync(path.join(current, WORKSPACE_FILE))) {
25
- return current;
20
+ let current = path.resolve(startDir);
21
+ while (true) {
22
+ if (fs.existsSync(path.join(current, WORKSPACE_FILE))) {
23
+ return current;
24
+ }
25
+ const parent = path.dirname(current);
26
+ if (parent === current)
27
+ return null;
28
+ current = parent;
26
29
  }
27
- const parent = path.dirname(current);
28
- if (parent === current) return null;
29
- current = parent;
30
- }
31
30
  };
32
31
  const createModuleStyleGraph = (options, viteRoot) => {
33
- const workspaceRoot =
34
- options.workspaceRoot ?? findWorkspaceRoot(viteRoot) ?? process.cwd();
35
- return new ModuleStyleGraph({
36
- ...options,
37
- workspaceRoot,
38
- });
32
+ const workspaceRoot = options.workspaceRoot ?? findWorkspaceRoot(viteRoot) ?? process.cwd();
33
+ return new ModuleStyleGraph({
34
+ ...options,
35
+ workspaceRoot,
36
+ });
39
37
  };
40
38
  const invalidateVirtualModules = (server, graph) => {
41
- const modules = [];
42
- for (const packageName of graph.getPackageNames()) {
43
- for (const entry of ['style.css', 'external.css', 'module.css']) {
44
- const module = server.moduleGraph.getModuleById(
45
- `${RESOLVED_VIRTUAL_ID_PREFIX}${packageName}/${entry}`,
46
- );
47
- if (!module) continue;
48
- server.moduleGraph.invalidateModule(module);
49
- modules.push(module);
39
+ const modules = [];
40
+ for (const packageName of graph.getPackageNames()) {
41
+ for (const entry of ['style.css', 'external.css', 'module.css']) {
42
+ const module = server.moduleGraph.getModuleById(`${RESOLVED_VIRTUAL_ID_PREFIX}${packageName}/${entry}`);
43
+ if (!module)
44
+ continue;
45
+ server.moduleGraph.invalidateModule(module);
46
+ modules.push(module);
47
+ }
50
48
  }
51
- }
52
- return modules;
49
+ return modules;
53
50
  };
54
51
  export function aukletStylePlugin(options = {}) {
55
- let graph = null;
56
- const getGraph = () => {
57
- if (!graph) {
58
- graph = createModuleStyleGraph(options, process.cwd());
59
- }
60
- return graph;
61
- };
62
- const hmr = new AukletStyleHmr(getGraph);
63
- return {
64
- name: 'auklet-css',
65
- apply: 'serve',
66
- enforce: 'pre',
67
- configResolved(config) {
68
- graph = createModuleStyleGraph(options, config.root);
69
- },
70
- resolveId(id) {
71
- const graph = getGraph();
72
- const cleanId = stripQuery(id);
73
- const resolvedVirtualId = toResolvedVirtualId(cleanId);
74
- if (resolvedVirtualId) return resolvedVirtualId;
75
- if (cleanId.startsWith(VIRTUAL_ID_PREFIX)) {
76
- return `${RESOLVED_VIRTUAL_ID_PREFIX}${cleanId.slice(
77
- VIRTUAL_ID_PREFIX.length,
78
- )}`;
79
- }
80
- if (!graph.parsePackageStyleId(cleanId)) return null;
81
- return `${RESOLVED_VIRTUAL_ID_PREFIX}${cleanId}`;
82
- },
83
- async load(id) {
84
- if (!id.startsWith(RESOLVED_VIRTUAL_ID_PREFIX)) return null;
85
- const originalId = id.slice(RESOLVED_VIRTUAL_ID_PREFIX.length);
86
- const graph = getGraph();
87
- const parsed = graph.parsePackageStyleId(originalId);
88
- if (!parsed) return null;
89
- const result = await graph.createPackageStyleCode(parsed);
90
- for (const file of result.watchFiles) {
91
- hmr.trackVirtualStyleDependency(file, id);
92
- this.addWatchFile?.(file);
93
- }
94
- return result.code;
95
- },
96
- configureServer(server) {
97
- const graph = getGraph();
98
- hmr.installFullReloadGuard(server);
99
- server.watcher.add(graph.getWatchRoots());
100
- const invalidateStyleGraph = (file) => {
101
- if (!graph.isSourceGraphFile(file)) return false;
102
- invalidateVirtualModules(server, graph);
103
- return true;
104
- };
105
- const reloadStyleGraph = (file) => {
106
- if (!invalidateStyleGraph(file)) return;
107
- server.ws.send({ type: 'full-reload' });
108
- };
109
- const handleSourceAddOrUnlink = (file) => {
110
- if (graph.isStyleFile(file)) {
111
- invalidateStyleGraph(file);
112
- return;
113
- }
114
- reloadStyleGraph(file);
115
- };
116
- server.watcher.on('add', handleSourceAddOrUnlink);
117
- server.watcher.on('unlink', handleSourceAddOrUnlink);
118
- server.watcher.on('change', (file) => {
119
- if (graph.isStyleConfigFile(file)) {
120
- reloadStyleGraph(file);
52
+ let graph = null;
53
+ const getGraph = () => {
54
+ if (!graph) {
55
+ graph = createModuleStyleGraph(options, process.cwd());
121
56
  }
122
- });
123
- },
124
- hotUpdate: {
125
- order: 'pre',
126
- handler(context) {
127
- return hmr.handleStyleHotUpdate(context);
128
- },
129
- },
130
- };
57
+ return graph;
58
+ };
59
+ const hmr = new AukletStyleHmr(getGraph);
60
+ return {
61
+ name: 'auklet-css',
62
+ apply: 'serve',
63
+ enforce: 'pre',
64
+ configResolved(config) {
65
+ graph = createModuleStyleGraph(options, config.root);
66
+ },
67
+ resolveId(id) {
68
+ const graph = getGraph();
69
+ const cleanId = stripQuery(id);
70
+ const resolvedVirtualId = toResolvedVirtualId(cleanId);
71
+ if (resolvedVirtualId)
72
+ return resolvedVirtualId;
73
+ if (cleanId.startsWith(VIRTUAL_ID_PREFIX)) {
74
+ return `${RESOLVED_VIRTUAL_ID_PREFIX}${cleanId.slice(VIRTUAL_ID_PREFIX.length)}`;
75
+ }
76
+ if (!graph.parsePackageStyleId(cleanId))
77
+ return null;
78
+ return `${RESOLVED_VIRTUAL_ID_PREFIX}${cleanId}`;
79
+ },
80
+ async load(id) {
81
+ if (!id.startsWith(RESOLVED_VIRTUAL_ID_PREFIX))
82
+ return null;
83
+ const originalId = id.slice(RESOLVED_VIRTUAL_ID_PREFIX.length);
84
+ const graph = getGraph();
85
+ const parsed = graph.parsePackageStyleId(originalId);
86
+ if (!parsed)
87
+ return null;
88
+ const result = await graph.createPackageStyleCode(parsed);
89
+ for (const file of result.watchFiles) {
90
+ hmr.trackVirtualStyleDependency(file, id);
91
+ this.addWatchFile?.(file);
92
+ }
93
+ return result.code;
94
+ },
95
+ configureServer(server) {
96
+ const graph = getGraph();
97
+ hmr.installFullReloadGuard(server);
98
+ server.watcher.add(graph.getWatchRoots());
99
+ const invalidateStyleGraph = (file) => {
100
+ if (!graph.isSourceGraphFile(file))
101
+ return false;
102
+ invalidateVirtualModules(server, graph);
103
+ return true;
104
+ };
105
+ const reloadStyleGraph = (file) => {
106
+ if (!invalidateStyleGraph(file))
107
+ return;
108
+ server.ws.send({ type: 'full-reload' });
109
+ };
110
+ const handleSourceAddOrUnlink = (file) => {
111
+ if (graph.isStyleFile(file)) {
112
+ invalidateStyleGraph(file);
113
+ return;
114
+ }
115
+ reloadStyleGraph(file);
116
+ };
117
+ server.watcher.on('add', handleSourceAddOrUnlink);
118
+ server.watcher.on('unlink', handleSourceAddOrUnlink);
119
+ server.watcher.on('change', (file) => {
120
+ if (graph.isStyleConfigFile(file)) {
121
+ reloadStyleGraph(file);
122
+ }
123
+ });
124
+ },
125
+ hotUpdate: {
126
+ order: 'pre',
127
+ handler(context) {
128
+ return hmr.handleStyleHotUpdate(context);
129
+ },
130
+ },
131
+ };
131
132
  }
@@ -1,23 +1,17 @@
1
- import type {
2
- ModuleStyleBuildConfig,
3
- ModuleStyleBuildContext,
4
- } from '#auklet/types';
1
+ import type { ModuleStyleBuildConfig, ModuleStyleBuildContext } from '#auklet/types';
5
2
  export declare class ModuleStyleWatcher {
6
- private readonly config;
7
- private readonly context;
8
- private readonly logger?;
9
- private timer;
10
- private isBuilding;
11
- private shouldRebuild;
12
- private watcher;
13
- constructor(
14
- context?: ModuleStyleBuildContext,
15
- config?: ModuleStyleBuildConfig,
16
- );
17
- watch(): Promise<void>;
18
- private rebuild;
19
- private refreshWatcher;
20
- private scheduleBuild;
21
- private shouldRebuildForFile;
22
- close(): Promise<void>;
3
+ private readonly config;
4
+ private readonly context;
5
+ private readonly logger?;
6
+ private timer;
7
+ private isBuilding;
8
+ private shouldRebuild;
9
+ private watcher;
10
+ constructor(context?: ModuleStyleBuildContext, config?: ModuleStyleBuildConfig);
11
+ watch(): Promise<void>;
12
+ private rebuild;
13
+ private refreshWatcher;
14
+ private scheduleBuild;
15
+ private shouldRebuildForFile;
16
+ close(): Promise<void>;
23
17
  }
@@ -6,86 +6,89 @@ import { moduleStyleBuildConfig } from '#auklet/css/config';
6
6
  import { SOURCE_COMPONENT_MODULE_RE } from '#auklet/css/constants';
7
7
  import { ModuleStyleBuilder } from '#auklet/css/production/builder';
8
8
  export class ModuleStyleWatcher {
9
- config;
10
- context;
11
- logger;
12
- timer = null;
13
- isBuilding = false;
14
- shouldRebuild = false;
15
- watcher = null;
16
- constructor(context = {}, config = moduleStyleBuildConfig) {
17
- this.config = config;
18
- this.context = {
19
- packageRoot: process.cwd(),
20
- ...context,
21
- };
22
- this.logger = context.logger;
23
- }
24
- async watch() {
25
- await this.rebuild();
26
- this.logger?.log?.('[auklet:css] watch mode ready');
27
- }
28
- async rebuild() {
29
- if (this.isBuilding) {
30
- this.shouldRebuild = true;
31
- return;
9
+ config;
10
+ context;
11
+ logger;
12
+ timer = null;
13
+ isBuilding = false;
14
+ shouldRebuild = false;
15
+ watcher = null;
16
+ constructor(context = {}, config = moduleStyleBuildConfig) {
17
+ this.config = config;
18
+ this.context = {
19
+ packageRoot: process.cwd(),
20
+ ...context,
21
+ };
22
+ this.logger = context.logger;
32
23
  }
33
- this.isBuilding = true;
34
- try {
35
- const builder = new ModuleStyleBuilder(this.context, this.config);
36
- await builder.build();
37
- await this.refreshWatcher();
38
- } catch (error) {
39
- this.logger?.error?.(error);
40
- } finally {
41
- this.isBuilding = false;
42
- if (this.shouldRebuild) {
43
- this.shouldRebuild = false;
44
- this.scheduleBuild();
45
- }
24
+ async watch() {
25
+ await this.rebuild();
26
+ this.logger?.log?.('[auklet:css] watch mode ready');
27
+ }
28
+ async rebuild() {
29
+ if (this.isBuilding) {
30
+ this.shouldRebuild = true;
31
+ return;
32
+ }
33
+ this.isBuilding = true;
34
+ try {
35
+ const builder = new ModuleStyleBuilder(this.context, this.config);
36
+ await builder.build();
37
+ await this.refreshWatcher();
38
+ }
39
+ catch (error) {
40
+ this.logger?.error?.(error);
41
+ }
42
+ finally {
43
+ this.isBuilding = false;
44
+ if (this.shouldRebuild) {
45
+ this.shouldRebuild = false;
46
+ this.scheduleBuild();
47
+ }
48
+ }
49
+ }
50
+ async refreshWatcher() {
51
+ const aukletConfig = this.context.aukletConfig ?? {};
52
+ const sourceDir = this.context.source ?? aukletConfig.source ?? aukletDefaultOptions.source;
53
+ const sourceRoot = path.join(this.context.packageRoot, sourceDir);
54
+ const configPath = path.join(this.context.packageRoot, aukletConfigFile);
55
+ const watchPaths = [sourceRoot, configPath].filter((file) => fs.existsSync(file));
56
+ await this.watcher?.close();
57
+ this.watcher = chokidar.watch(watchPaths, {
58
+ ignoreInitial: true,
59
+ interval: 300,
60
+ usePolling: true,
61
+ });
62
+ this.watcher.on('all', (_event, file) => {
63
+ if (typeof file === 'string' && !this.shouldRebuildForFile(file)) {
64
+ return;
65
+ }
66
+ this.scheduleBuild();
67
+ });
68
+ this.watcher.on('error', (error) => {
69
+ this.logger?.error?.(error);
70
+ });
71
+ }
72
+ scheduleBuild() {
73
+ if (this.timer)
74
+ clearTimeout(this.timer);
75
+ this.timer = setTimeout(() => {
76
+ this.timer = null;
77
+ this.rebuild().catch((error) => {
78
+ this.logger?.error?.(error);
79
+ });
80
+ }, 80);
81
+ }
82
+ shouldRebuildForFile(file) {
83
+ if (path.basename(file) === aukletConfigFile)
84
+ return true;
85
+ if (SOURCE_COMPONENT_MODULE_RE.test(file))
86
+ return true;
87
+ return this.config.styleExtensions.includes(path.extname(file));
88
+ }
89
+ async close() {
90
+ if (this.timer)
91
+ clearTimeout(this.timer);
92
+ await this.watcher?.close();
46
93
  }
47
- }
48
- async refreshWatcher() {
49
- const aukletConfig = this.context.aukletConfig ?? {};
50
- const sourceDir =
51
- this.context.source ?? aukletConfig.source ?? aukletDefaultOptions.source;
52
- const sourceRoot = path.join(this.context.packageRoot, sourceDir);
53
- const configPath = path.join(this.context.packageRoot, aukletConfigFile);
54
- const watchPaths = [sourceRoot, configPath].filter((file) =>
55
- fs.existsSync(file),
56
- );
57
- await this.watcher?.close();
58
- this.watcher = chokidar.watch(watchPaths, {
59
- ignoreInitial: true,
60
- interval: 300,
61
- usePolling: true,
62
- });
63
- this.watcher.on('all', (_event, file) => {
64
- if (typeof file === 'string' && !this.shouldRebuildForFile(file)) {
65
- return;
66
- }
67
- this.scheduleBuild();
68
- });
69
- this.watcher.on('error', (error) => {
70
- this.logger?.error?.(error);
71
- });
72
- }
73
- scheduleBuild() {
74
- if (this.timer) clearTimeout(this.timer);
75
- this.timer = setTimeout(() => {
76
- this.timer = null;
77
- this.rebuild().catch((error) => {
78
- this.logger?.error?.(error);
79
- });
80
- }, 80);
81
- }
82
- shouldRebuildForFile(file) {
83
- if (path.basename(file) === aukletConfigFile) return true;
84
- if (SOURCE_COMPONENT_MODULE_RE.test(file)) return true;
85
- return this.config.styleExtensions.includes(path.extname(file));
86
- }
87
- async close() {
88
- if (this.timer) clearTimeout(this.timer);
89
- await this.watcher?.close();
90
- }
91
94
  }
package/dist/index.d.ts CHANGED
@@ -1,30 +1,8 @@
1
- export type {
2
- AukletConfig,
3
- ConfigureTsdown,
4
- ConfigureTsdownContext,
5
- LoadAukletConfigOptions,
6
- ModuleStyleBuildConfig,
7
- ModuleStyleBuildContext,
8
- ModuleStyleBuildOptions,
9
- NormalizedAukletConfig,
10
- NormalizedStyleDependencyGroup,
11
- PackageBuildFormat,
12
- PackageBuildOptions,
13
- ResolvedModuleStyleBuildContext,
14
- StyleDependencyGroup,
15
- StyleOptions,
16
- } from '#auklet/types';
1
+ export type { AukletConfig, ConfigureTsdown, ConfigureTsdownContext, LoadAukletConfigOptions, ModuleStyleBuildConfig, ModuleStyleBuildContext, ModuleStyleBuildOptions, NormalizedAukletConfig, NormalizedStyleDependencyGroup, PackageBuildFormat, PackageBuildOptions, ResolvedModuleStyleBuildContext, StyleDependencyGroup, StyleOptions, } from '#auklet/types';
17
2
  export type { RunTsdownOptions } from '#auklet/build/runTsdown';
18
3
  export type { AukletStylePluginOptions } from '#auklet/css/vite/vitePlugin';
19
- export {
20
- aukletDefaultOptions,
21
- aukletDefaultStyleDependencyConfig,
22
- normalizeAukletConfig,
23
- } from '#auklet/config';
24
- export {
25
- loadAukletConfig,
26
- resolveAukletConfigModule,
27
- } from '#auklet/configLoader';
4
+ export { aukletDefaultOptions, aukletDefaultStyleDependencyConfig, normalizeAukletConfig, } from '#auklet/config';
5
+ export { loadAukletConfig, resolveAukletConfigModule, } from '#auklet/configLoader';
28
6
  export { aukletStylePlugin } from '#auklet/css/vite/vitePlugin';
29
7
  export { createTsdownArgs, runTsdown } from '#auklet/build/runTsdown';
30
8
  export { ModuleStyleWatcher } from '#auklet/css/watch/watcher';
package/dist/index.js CHANGED
@@ -1,12 +1,5 @@
1
- export {
2
- aukletDefaultOptions,
3
- aukletDefaultStyleDependencyConfig,
4
- normalizeAukletConfig,
5
- } from '#auklet/config';
6
- export {
7
- loadAukletConfig,
8
- resolveAukletConfigModule,
9
- } from '#auklet/configLoader';
1
+ export { aukletDefaultOptions, aukletDefaultStyleDependencyConfig, normalizeAukletConfig, } from '#auklet/config';
2
+ export { loadAukletConfig, resolveAukletConfigModule, } from '#auklet/configLoader';
10
3
  export { aukletStylePlugin } from '#auklet/css/vite/vitePlugin';
11
4
  export { createTsdownArgs, runTsdown } from '#auklet/build/runTsdown';
12
5
  export { ModuleStyleWatcher } from '#auklet/css/watch/watcher';
package/dist/types.d.ts CHANGED
@@ -1,94 +1,91 @@
1
1
  import type { UserConfig } from 'tsdown/config';
2
2
  export type StyleDependencyGroup = {
3
- entry?: string | Array<string>;
4
- themes?: Record<string, string>;
5
- components?: string | Array<string>;
3
+ entry?: string | Array<string>;
4
+ themes?: Record<string, string>;
5
+ components?: string | Array<string>;
6
6
  };
7
7
  export type StyleOptions = {
8
- themes?: Record<string, string>;
9
- dependencies?: Record<string, StyleDependencyGroup>;
8
+ themes?: Record<string, string>;
9
+ dependencies?: Record<string, StyleDependencyGroup>;
10
10
  };
11
11
  export type NormalizedStyleDependencyGroup = {
12
- entry?: string | Array<string>;
13
- themes?: Record<string, string>;
14
- components?: string | Array<string>;
12
+ entry?: string | Array<string>;
13
+ themes?: Record<string, string>;
14
+ components?: string | Array<string>;
15
15
  };
16
16
  export interface NormalizedAukletConfig {
17
- source: string;
18
- output: string;
19
- modules: boolean;
20
- styles: {
21
- themes: Record<string, string>;
22
- dependencies: Record<string, NormalizedStyleDependencyGroup>;
23
- };
24
- build: Required<Pick<PackageBuildOptions, 'formats' | 'target' | 'platform'>>;
17
+ source: string;
18
+ output: string;
19
+ modules: boolean;
20
+ styles: {
21
+ themes: Record<string, string>;
22
+ dependencies: Record<string, NormalizedStyleDependencyGroup>;
23
+ };
24
+ build: Required<Pick<PackageBuildOptions, 'formats' | 'target' | 'platform'>>;
25
25
  }
26
26
  export type PackageBuildFormat = 'cjs' | 'esm' | 'iife';
27
27
  export type PackageBuildPlatform = 'node' | 'neutral' | 'browser';
28
28
  export type PackageBuildTarget = string | Array<string> | false;
29
29
  export type ConfigureTsdownContext = {
30
- kind: 'bundle' | 'module';
31
- format: PackageBuildFormat;
32
- packageRoot: string;
33
- output: string;
34
- packageName?: string;
30
+ kind: 'bundle' | 'module';
31
+ format: PackageBuildFormat;
32
+ packageRoot: string;
33
+ output: string;
34
+ packageName?: string;
35
35
  };
36
- export type ConfigureTsdown = (
37
- config: UserConfig,
38
- context: ConfigureTsdownContext,
39
- ) => UserConfig;
36
+ export type ConfigureTsdown = (config: UserConfig, context: ConfigureTsdownContext) => UserConfig;
40
37
  export type PackageBuildOptions = {
41
- formats?: Array<PackageBuildFormat>;
42
- target?: PackageBuildTarget;
43
- platform?: PackageBuildPlatform;
44
- banner?: string;
45
- externals?: Array<string>;
46
- alias?: Record<string, string>;
47
- mainFields?: Array<string>;
48
- globals?: Record<string, string>;
49
- configureTsdown?: ConfigureTsdown;
50
- tsconfig?: string;
38
+ formats?: Array<PackageBuildFormat>;
39
+ target?: PackageBuildTarget;
40
+ platform?: PackageBuildPlatform;
41
+ banner?: string;
42
+ externals?: Array<string>;
43
+ alias?: Record<string, string>;
44
+ mainFields?: Array<string>;
45
+ globals?: Record<string, string>;
46
+ configureTsdown?: ConfigureTsdown;
47
+ tsconfig?: string;
51
48
  };
52
49
  export interface AukletConfig {
53
- source?: string;
54
- output?: string;
55
- modules?: boolean;
56
- styles?: StyleOptions;
57
- build?: PackageBuildOptions;
50
+ source?: string;
51
+ output?: string;
52
+ modules?: boolean;
53
+ styles?: StyleOptions;
54
+ build?: PackageBuildOptions;
58
55
  }
59
56
  export type AukletLogger = {
60
- log?: (...args: Array<unknown>) => void;
61
- info?: (...args: Array<unknown>) => void;
62
- error?: (...args: Array<unknown>) => void;
57
+ log?: (...args: Array<unknown>) => void;
58
+ info?: (...args: Array<unknown>) => void;
59
+ error?: (...args: Array<unknown>) => void;
63
60
  };
64
61
  export type LoadAukletConfigOptions = {
65
- configFile?: string;
66
- cacheBust?: boolean;
62
+ configFile?: string;
63
+ cacheBust?: boolean;
67
64
  };
68
65
  export interface ModuleStyleBuildContext {
69
- packageRoot?: string;
70
- aukletConfig?: AukletConfig;
71
- logger?: AukletLogger;
72
- source?: string;
73
- output?: string;
66
+ packageRoot?: string;
67
+ aukletConfig?: AukletConfig;
68
+ logger?: AukletLogger;
69
+ source?: string;
70
+ output?: string;
74
71
  }
75
72
  export interface ResolvedModuleStyleBuildContext {
76
- packageRoot: string;
77
- sourceDir: string;
78
- outputDir: string;
73
+ packageRoot: string;
74
+ sourceDir: string;
75
+ outputDir: string;
79
76
  }
80
77
  export type ModuleStyleBuildOptions = {
81
- aukletConfig?: AukletConfig;
82
- logger?: AukletLogger;
78
+ aukletConfig?: AukletConfig;
79
+ logger?: AukletLogger;
83
80
  };
84
81
  export interface ModuleStyleBuildOutputConfig {
85
- outputFormats: Array<string>;
86
- styleDir: string;
87
- indexStyleFile: string;
88
- externalStyleFile: string;
89
- moduleStyleFile: string;
82
+ outputFormats: Array<string>;
83
+ styleDir: string;
84
+ indexStyleFile: string;
85
+ externalStyleFile: string;
86
+ moduleStyleFile: string;
90
87
  }
91
88
  export interface ModuleStyleBuildConfig {
92
- output: ModuleStyleBuildOutputConfig;
93
- styleExtensions: Array<string>;
89
+ output: ModuleStyleBuildOutputConfig;
90
+ styleExtensions: Array<string>;
94
91
  }
package/dist/utils.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- export declare const POSIX_SEPARATOR = '/';
2
- export declare const IMPORT_LIST_SEPARATOR = ',';
1
+ export declare const POSIX_SEPARATOR = "/";
2
+ export declare const IMPORT_LIST_SEPARATOR = ",";
3
3
  export declare const TEST_DIR_NAMES: Set<string>;
4
4
  export declare const SOURCE_TEST_RE: RegExp;
5
5
  export declare const SOURCE_MODULE_RE: RegExp;
@@ -17,8 +17,4 @@ export declare function toWatchPath(...parts: Array<string>): string;
17
17
  export declare function removeExtension(file: string): string;
18
18
  export declare function getSourceModuleDir(file: string): string;
19
19
  export declare function escapeRegExp(value: string): string;
20
- export declare function appendUniqueMapValue<K, V>(
21
- map: Map<K, Array<V>>,
22
- key: K,
23
- value: V,
24
- ): void;
20
+ export declare function appendUniqueMapValue<K, V>(map: Map<K, Array<V>>, key: K, value: V): void;