tiny-essentials 1.27.0 → 1.27.1

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/TinyFork.mjs CHANGED
@@ -1,10 +1,10 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import fs from 'fs/promises';
3
+ import { copyFile, readFile, mkdir, writeFile } from 'fs/promises';
4
4
  import { existsSync } from 'fs';
5
5
  import path from 'path';
6
6
  import { fileURLToPath } from 'url';
7
- import parser from '@babel/parser';
7
+ import { parse } from '@babel/parser';
8
8
  import _traverse from '@babel/traverse';
9
9
  import _generate from '@babel/generator';
10
10
  import * as t from '@babel/types';
@@ -178,7 +178,7 @@ async function copyLicense(destDir) {
178
178
 
179
179
  try {
180
180
  if (existsSync(licenseSrc)) {
181
- await fs.copyFile(licenseSrc, licenseDest);
181
+ await copyFile(licenseSrc, licenseDest);
182
182
  console.log('> Copied: LICENSE');
183
183
  } else {
184
184
  console.warn('> Warning: LICENSE file not found in the root directory.');
@@ -270,8 +270,8 @@ class MultiFileExtractor {
270
270
  * @returns {Promise<string>} The minified and formatted generated source code.
271
271
  */
272
272
  async parseAndPrune(filePath, req) {
273
- const sourceCode = await fs.readFile(filePath, 'utf-8');
274
- const ast = parser.parse(sourceCode, { sourceType: 'module', plugins: ['classProperties'] });
273
+ const sourceCode = await readFile(filePath, 'utf-8');
274
+ const ast = parse(sourceCode, { sourceType: 'module', plugins: ['classProperties'] });
275
275
 
276
276
  const localKeepNames = new Set();
277
277
  const requiredImports = new Map();
@@ -627,8 +627,8 @@ class MultiFileExtractor {
627
627
  const relativeToVersion = path.relative(data.versionDir, filePath);
628
628
  const destPath = path.join(this.outDir, relativeToVersion);
629
629
 
630
- await fs.mkdir(path.dirname(destPath), { recursive: true });
631
- await fs.writeFile(destPath, data.code, 'utf-8');
630
+ await mkdir(path.dirname(destPath), { recursive: true });
631
+ await writeFile(destPath, data.code, 'utf-8');
632
632
  console.log(`> Created: ${relativeToVersion}`);
633
633
  filesSaved++;
634
634
  }
@@ -0,0 +1,2 @@
1
+ ### 🐛 Bug Fixes
2
+ - Corrected `@babel/parser` default import to resolve module loading errors in ESM (TinyFork issue).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tiny-essentials",
3
- "version": "1.27.0",
3
+ "version": "1.27.1",
4
4
  "description": "Collection of small, essential scripts designed to be used across various projects. These simple utilities are crafted for speed, ease of use, and versatility.",
5
5
  "bin": {
6
6
  "tiny-essentials-fork": "./TinyFork.mjs"