esm-styles 0.4.1 → 0.4.2

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
@@ -323,7 +323,13 @@ export async function build(configPath = 'esm-styles.config.js') {
323
323
  // 6. Create timestamp file
324
324
  const { outputPath: timestampOutputPath, extension: timestampExtension } = config.timestamp || { outputPath: '', extension: 'mjs' };
325
325
  const timestampPath = path.join(config.basePath || '.', timestampOutputPath, 'timestamp.' + timestampExtension);
326
- await fs.writeFile(timestampPath, `export default ${Date.now()}`, 'utf8');
326
+ // Write atomically: write to a temp file in the same directory, then rename
327
+ // over the target. rename() is atomic on the same filesystem and swaps the
328
+ // inode, so file watchers (Vite, Cursor) reliably pick up the change instead
329
+ // of observing a truncate-then-write mid-flight.
330
+ const timestampTmpPath = `${timestampPath}.tmp`;
331
+ await fs.writeFile(timestampTmpPath, `export default ${Date.now()}`, 'utf8');
332
+ await fs.rename(timestampTmpPath, timestampPath);
327
333
  }
328
334
  // Helper for file URL import
329
335
  import { pathToFileURL as pathToFileUrl } from 'node:url';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "esm-styles",
3
- "version": "0.4.1",
3
+ "version": "0.4.2",
4
4
  "description": "A library for working with ESM styles",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -50,7 +50,7 @@
50
50
  },
51
51
  "dependencies": {
52
52
  "csstype": "^3.2.3",
53
- "esbuild": "^0.27.2",
53
+ "esbuild": "^0.28.1",
54
54
  "js-beautify": "^1.15.4"
55
55
  },
56
56
  "repository": {