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.
Files changed (105) hide show
  1. package/README.md +37 -1
  2. package/dist/build/bundleConfig.d.ts +1 -4
  3. package/dist/build/bundleConfig.js +59 -71
  4. package/dist/build/cleanOutput.d.ts +2 -8
  5. package/dist/build/cleanOutput.js +7 -7
  6. package/dist/build/moduleConfig.d.ts +1 -3
  7. package/dist/build/moduleConfig.js +21 -40
  8. package/dist/build/runTsdown.d.ts +2 -5
  9. package/dist/build/runTsdown.js +18 -23
  10. package/dist/build/tsdown/common.d.ts +17 -28
  11. package/dist/build/tsdown/common.js +22 -25
  12. package/dist/build/tsdown/context.d.ts +16 -20
  13. package/dist/build/tsdown/context.js +41 -45
  14. package/dist/build/tsdown/define.d.ts +2 -7
  15. package/dist/build/tsdown/define.js +13 -22
  16. package/dist/build/tsdown/dependencies.d.ts +4 -12
  17. package/dist/build/tsdown/dependencies.js +47 -51
  18. package/dist/build/tsdown/entries.d.ts +4 -6
  19. package/dist/build/tsdown/entries.js +39 -38
  20. package/dist/build/tsdown/parseModuleId.d.ts +4 -4
  21. package/dist/build/tsdown/parseModuleId.js +92 -77
  22. package/dist/build/tsdown/types.d.ts +24 -31
  23. package/dist/build/tsdownConfig.js +1 -4
  24. package/dist/config.d.ts +37 -37
  25. package/dist/config.js +38 -41
  26. package/dist/configLoader.d.ts +2 -7
  27. package/dist/configLoader.js +59 -64
  28. package/dist/css/config.js +8 -8
  29. package/dist/css/constants.d.ts +7 -7
  30. package/dist/css/constants.js +1 -1
  31. package/dist/css/core/resolvers/packageImports.d.ts +1 -5
  32. package/dist/css/core/resolvers/packageImports.js +35 -40
  33. package/dist/css/core/resolvers/relative.d.ts +1 -4
  34. package/dist/css/core/resolvers/relative.js +3 -2
  35. package/dist/css/core/resolvers/tsconfigPaths.d.ts +1 -5
  36. package/dist/css/core/resolvers/tsconfigPaths.js +59 -66
  37. package/dist/css/core/style/dependencies.d.ts +6 -16
  38. package/dist/css/core/style/dependencies.js +35 -38
  39. package/dist/css/core/style/entries.d.ts +35 -58
  40. package/dist/css/core/style/entries.js +22 -33
  41. package/dist/css/core/style/files.d.ts +2 -7
  42. package/dist/css/core/style/files.js +11 -11
  43. package/dist/css/core/style/specifier.d.ts +41 -8
  44. package/dist/css/core/style/specifier.js +107 -18
  45. package/dist/css/core/styleImports/autoImportRules.d.ts +13 -0
  46. package/dist/css/core/styleImports/autoImportRules.js +68 -0
  47. package/dist/css/core/styleImports/collector.d.ts +12 -25
  48. package/dist/css/core/styleImports/collector.js +101 -206
  49. package/dist/css/core/styleImports/sourceImportExportAnalyzer.d.ts +11 -0
  50. package/dist/css/core/styleImports/sourceImportExportAnalyzer.js +173 -0
  51. package/dist/css/core/styleModuleEntryPlanner.d.ts +21 -24
  52. package/dist/css/core/styleModuleEntryPlanner.js +45 -62
  53. package/dist/css/core/stylePackageContext.d.ts +16 -20
  54. package/dist/css/core/stylePackageContext.js +33 -49
  55. package/dist/css/core/styleProcessor.js +105 -104
  56. package/dist/css/core/workspaceStyleResolver.d.ts +8 -15
  57. package/dist/css/core/workspaceStyleResolver.js +34 -76
  58. package/dist/css/production/builder.d.ts +9 -16
  59. package/dist/css/production/builder.js +51 -57
  60. package/dist/css/production/format/entryWriter.js +36 -49
  61. package/dist/css/production/format/externalWriter.js +21 -33
  62. package/dist/css/production/format/{componentWriter.d.ts → moduleEntryWriter.d.ts} +1 -1
  63. package/dist/css/production/format/moduleEntryWriter.js +48 -0
  64. package/dist/css/production/format/moduleWriter.js +23 -26
  65. package/dist/css/production/format/shared.d.ts +8 -15
  66. package/dist/css/production/format/shared.js +4 -9
  67. package/dist/css/production/format/sourceWriter.js +11 -11
  68. package/dist/css/production/format/themeWriter.js +56 -71
  69. package/dist/css/production/moduleOutputWriter.d.ts +18 -21
  70. package/dist/css/production/moduleOutputWriter.js +58 -67
  71. package/dist/css/production/packageEntryWriter.d.ts +12 -15
  72. package/dist/css/production/packageEntryWriter.js +42 -45
  73. package/dist/css/vite/hmr.d.ts +11 -11
  74. package/dist/css/vite/hmr.js +93 -109
  75. package/dist/css/vite/moduleGraph/devDependency.d.ts +7 -12
  76. package/dist/css/vite/moduleGraph/devDependency.js +8 -8
  77. package/dist/css/vite/moduleGraph/graph.d.ts +20 -23
  78. package/dist/css/vite/moduleGraph/graph.js +51 -50
  79. package/dist/css/vite/moduleGraph/loadResult.d.ts +3 -5
  80. package/dist/css/vite/moduleGraph/loadResult.js +7 -9
  81. package/dist/css/vite/moduleGraph/packageSource/monorepo.d.ts +16 -7
  82. package/dist/css/vite/moduleGraph/packageSource/monorepo.js +60 -68
  83. package/dist/css/vite/moduleGraph/packageSource/singlePackage.d.ts +21 -0
  84. package/dist/css/vite/moduleGraph/packageSource/singlePackage.js +63 -0
  85. package/dist/css/vite/moduleGraph/packageSource/types.d.ts +7 -7
  86. package/dist/css/vite/moduleGraph/requestCache.d.ts +46 -57
  87. package/dist/css/vite/moduleGraph/requestCache.js +53 -51
  88. package/dist/css/vite/moduleGraph/styleCodeFactory.d.ts +15 -18
  89. package/dist/css/vite/moduleGraph/styleCodeFactory.js +173 -264
  90. package/dist/css/vite/moduleGraph/styleId.d.ts +3 -6
  91. package/dist/css/vite/moduleGraph/styleId.js +12 -11
  92. package/dist/css/vite/moduleGraph/types.d.ts +11 -14
  93. package/dist/css/vite/vitePlugin.d.ts +16 -20
  94. package/dist/css/vite/vitePlugin.js +117 -109
  95. package/dist/css/watch/watcher.d.ts +15 -21
  96. package/dist/css/watch/watcher.js +84 -81
  97. package/dist/index.d.ts +3 -25
  98. package/dist/index.js +2 -9
  99. package/dist/types.d.ts +59 -62
  100. package/dist/utils.d.ts +3 -7
  101. package/dist/utils.js +50 -47
  102. package/package.json +31 -33
  103. package/dist/css/core/styleImports/sourceReference.d.ts +0 -19
  104. package/dist/css/core/styleImports/sourceReference.js +0 -193
  105. package/dist/css/production/format/componentWriter.js +0 -71
@@ -8,124 +8,132 @@ 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 mode = options.mode ?? 'package';
33
+ const root = options.root ?? resolveGraphRoot(mode, viteRoot);
34
+ return new ModuleStyleGraph({
35
+ ...options,
36
+ mode,
37
+ root,
38
+ });
39
+ };
40
+ const resolveGraphRoot = (mode, viteRoot) => {
41
+ if (mode === 'monorepo')
42
+ return findWorkspaceRoot(viteRoot) ?? process.cwd();
43
+ return viteRoot;
39
44
  };
40
45
  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);
46
+ const modules = [];
47
+ for (const packageName of graph.getPackageNames()) {
48
+ for (const entry of ['style.css', 'external.css', 'module.css']) {
49
+ const module = server.moduleGraph.getModuleById(`${RESOLVED_VIRTUAL_ID_PREFIX}${packageName}/${entry}`);
50
+ if (!module)
51
+ continue;
52
+ server.moduleGraph.invalidateModule(module);
53
+ modules.push(module);
54
+ }
50
55
  }
51
- }
52
- return modules;
56
+ return modules;
53
57
  };
54
58
  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);
59
+ let graph = null;
60
+ const getGraph = () => {
61
+ if (!graph) {
62
+ graph = createModuleStyleGraph(options, process.cwd());
121
63
  }
122
- });
123
- },
124
- hotUpdate: {
125
- order: 'pre',
126
- handler(context) {
127
- return hmr.handleStyleHotUpdate(context);
128
- },
129
- },
130
- };
64
+ return graph;
65
+ };
66
+ const hmr = new AukletStyleHmr(getGraph);
67
+ return {
68
+ name: 'auklet-css',
69
+ apply: 'serve',
70
+ enforce: 'pre',
71
+ configResolved(config) {
72
+ graph = createModuleStyleGraph(options, config.root);
73
+ },
74
+ resolveId(id) {
75
+ const graph = getGraph();
76
+ const cleanId = stripQuery(id);
77
+ const resolvedVirtualId = toResolvedVirtualId(cleanId);
78
+ if (resolvedVirtualId)
79
+ return resolvedVirtualId;
80
+ if (cleanId.startsWith(VIRTUAL_ID_PREFIX)) {
81
+ return `${RESOLVED_VIRTUAL_ID_PREFIX}${cleanId.slice(VIRTUAL_ID_PREFIX.length)}`;
82
+ }
83
+ if (!graph.parsePackageStyleId(cleanId))
84
+ return null;
85
+ return `${RESOLVED_VIRTUAL_ID_PREFIX}${cleanId}`;
86
+ },
87
+ async load(id) {
88
+ if (!id.startsWith(RESOLVED_VIRTUAL_ID_PREFIX))
89
+ return null;
90
+ const originalId = id.slice(RESOLVED_VIRTUAL_ID_PREFIX.length);
91
+ const graph = getGraph();
92
+ const parsed = graph.parsePackageStyleId(originalId);
93
+ if (!parsed)
94
+ return null;
95
+ const result = await graph.createPackageStyleCode(parsed);
96
+ for (const file of result.watchFiles) {
97
+ hmr.trackVirtualStyleDependency(file, id);
98
+ this.addWatchFile?.(file);
99
+ }
100
+ return result.code;
101
+ },
102
+ async configureServer(server) {
103
+ const graph = getGraph();
104
+ hmr.installFullReloadGuard(server);
105
+ server.watcher.add(await graph.getWatchRoots());
106
+ const invalidateStyleGraph = (file) => {
107
+ if (!graph.isSourceGraphFile(file))
108
+ return false;
109
+ invalidateVirtualModules(server, graph);
110
+ return true;
111
+ };
112
+ const reloadStyleGraph = (file) => {
113
+ if (!invalidateStyleGraph(file))
114
+ return;
115
+ server.ws.send({ type: 'full-reload' });
116
+ };
117
+ const handleSourceAddOrUnlink = (file) => {
118
+ if (graph.isStyleFile(file)) {
119
+ invalidateStyleGraph(file);
120
+ return;
121
+ }
122
+ reloadStyleGraph(file);
123
+ };
124
+ server.watcher.on('add', handleSourceAddOrUnlink);
125
+ server.watcher.on('unlink', handleSourceAddOrUnlink);
126
+ server.watcher.on('change', (file) => {
127
+ if (graph.isStyleConfigFile(file)) {
128
+ reloadStyleGraph(file);
129
+ }
130
+ });
131
+ },
132
+ hotUpdate: {
133
+ order: 'pre',
134
+ handler(context) {
135
+ return hmr.handleStyleHotUpdate(context);
136
+ },
137
+ },
138
+ };
131
139
  }
@@ -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
  }
@@ -3,89 +3,92 @@ import path from 'node:path';
3
3
  import chokidar from 'chokidar';
4
4
  import { aukletConfigFile, aukletDefaultOptions } from '#auklet/config';
5
5
  import { moduleStyleBuildConfig } from '#auklet/css/config';
6
- import { SOURCE_COMPONENT_MODULE_RE } from '#auklet/css/constants';
6
+ import { SOURCE_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_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;