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 +7 -7
- package/changelog/1/27/1.md +2 -0
- package/package.json +1 -1
package/TinyFork.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
import
|
|
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
|
|
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
|
|
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
|
|
274
|
-
const ast =
|
|
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
|
|
631
|
-
await
|
|
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
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tiny-essentials",
|
|
3
|
-
"version": "1.27.
|
|
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"
|