esm-styles 0.3.2 → 0.3.4

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.
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};
package/dist/watch.js ADDED
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env node
2
+ import { spawn } from 'child_process';
3
+ import path from 'path';
4
+ import process from 'process';
5
+ import { fileURLToPath } from 'url';
6
+ const __filename = fileURLToPath(import.meta.url);
7
+ const __dirname = path.dirname(__filename);
8
+ const configPath = process.argv[2] || 'esm-styles.config.js';
9
+ const configModule = await import(path.isAbsolute(configPath)
10
+ ? configPath
11
+ : path.resolve(process.cwd(), configPath));
12
+ const config = configModule.default;
13
+ const basePath = path.resolve(process.cwd(), config.basePath || '.');
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');
17
+ const nodemonArgs = [
18
+ '--watch',
19
+ sourcePath,
20
+ '--ext',
21
+ 'mjs',
22
+ '--ignore',
23
+ path.join(sourcePath, '$*.mjs'),
24
+ '--exec',
25
+ `node ${buildJsPath} ${configPath}`,
26
+ ];
27
+ console.log('[esm-styles] Running:', 'nodemon', ...nodemonArgs);
28
+ const nodemon = spawn('nodemon', nodemonArgs, { stdio: 'inherit' });
29
+ nodemon.on('exit', (code) => process.exit(code));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "esm-styles",
3
- "version": "0.3.2",
3
+ "version": "0.3.4",
4
4
  "description": "A library for working with ESM styles",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",