esm-styles 0.3.3 → 0.3.5

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/dist/lib/build.js CHANGED
@@ -251,6 +251,9 @@ export async function build(configPath = 'esm-styles.config.js') {
251
251
  .join('\n') +
252
252
  '\n';
253
253
  await fs.writeFile(mainCssPath, mainCss, 'utf8');
254
+ // 6. Create timestamp file
255
+ const timestampPath = path.join(normalizedBasePath, config.timestampOutputPath || '', 'timestamp.mjs');
256
+ await fs.writeFile(timestampPath, `export default ${Date.now()}`, 'utf8');
254
257
  }
255
258
  // Helper for file URL import
256
259
  import { pathToFileURL as pathToFileUrl } from 'node:url';
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,3 @@
1
+ export {};
2
+ // create file timestamp.mjs with single line:
3
+ // export default Date.now()
package/dist/watch.js CHANGED
@@ -2,6 +2,9 @@
2
2
  import { spawn } from 'child_process';
3
3
  import path from 'path';
4
4
  import process from 'process';
5
+ import { fileURLToPath } from 'url';
6
+ const __filename = fileURLToPath(import.meta.url);
7
+ const __dirname = path.dirname(__filename);
5
8
  const configPath = process.argv[2] || 'esm-styles.config.js';
6
9
  const configModule = await import(path.isAbsolute(configPath)
7
10
  ? configPath
@@ -9,6 +12,8 @@ const configModule = await import(path.isAbsolute(configPath)
9
12
  const config = configModule.default;
10
13
  const basePath = path.resolve(process.cwd(), config.basePath || '.');
11
14
  const sourcePath = path.join(basePath, config.sourcePath || '');
15
+ // Use absolute path to build.js from the esm-styles package
16
+ const buildJsPath = path.join(__dirname, 'build.js');
12
17
  const nodemonArgs = [
13
18
  '--watch',
14
19
  sourcePath,
@@ -17,7 +22,7 @@ const nodemonArgs = [
17
22
  '--ignore',
18
23
  path.join(sourcePath, '$*.mjs'),
19
24
  '--exec',
20
- `node dist/build.js ${configPath}`,
25
+ `node ${buildJsPath} ${configPath}`,
21
26
  ];
22
27
  console.log('[esm-styles] Running:', 'nodemon', ...nodemonArgs);
23
28
  const nodemon = spawn('nodemon', nodemonArgs, { stdio: 'inherit' });
@@ -144,20 +144,21 @@ export default {
144
144
 
145
145
  ### Configuration Properties
146
146
 
147
- | Property | Description |
148
- | -------------------- | ------------------------------------------------------------------------- |
149
- | `basePath` | Base directory for all styles, relative to where the build command is run |
150
- | `sourcePath` | Directory inside `basePath` containing source style files |
151
- | `outputPath` | Directory inside `basePath` where output CSS files will be written |
152
- | `sourceFilesSuffix` | Suffix for source style files (default: `.styles.mjs`) |
153
- | `floors` | Array of floor configurations, defining sources, layers, and output paths |
154
- | `importFloors` | Array of floor names to include in the main CSS file |
155
- | `mainCssFile` | Name of the output CSS file that imports all layer and variable files |
156
- | `globalVariables` | Name of the file containing global CSS variables |
157
- | `globalRootSelector` | Root selector for CSS variables (default: `:root`) |
158
- | `media` | Object defining media types and their variable sets |
159
- | `mediaSelectors` | Configuration for applying media types with selectors/queries |
160
- | `mediaQueries` | Object defining shorthand names for media queries |
147
+ | Property | Description |
148
+ | --------------------- | ------------------------------------------------------------------------- |
149
+ | `basePath` | Base directory for all styles, relative to where the build command is run |
150
+ | `sourcePath` | Directory inside `basePath` containing source style files |
151
+ | `outputPath` | Directory inside `basePath` where output CSS files will be written |
152
+ | `sourceFilesSuffix` | Suffix for source style files (default: `.styles.mjs`) |
153
+ | `floors` | Array of floor configurations, defining sources, layers, and output paths |
154
+ | `importFloors` | Array of floor names to include in the main CSS file |
155
+ | `mainCssFile` | Name of the output CSS file that imports all layer and variable files |
156
+ | `globalVariables` | Name of the file containing global CSS variables |
157
+ | `globalRootSelector` | Root selector for CSS variables (default: `:root`) |
158
+ | `media` | Object defining media types and their variable sets |
159
+ | `mediaSelectors` | Configuration for applying media types with selectors/queries |
160
+ | `mediaQueries` | Object defining shorthand names for media queries |
161
+ | `timestampOutputPath` | Path where timestamp.mjs file will be written (default: `basePath`) |
161
162
 
162
163
  ## JS to CSS Translation Rules
163
164
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "esm-styles",
3
- "version": "0.3.3",
3
+ "version": "0.3.5",
4
4
  "description": "A library for working with ESM styles",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",