mirror of
https://github.com/arcodange-org/mediabunny.git
synced 2026-09-27 10:53:50 +02:00
Fix incorrectly fixed .js imports
This commit is contained in:
Generated
+2
-2
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "mediabunny",
|
"name": "mediabunny",
|
||||||
"version": "1.3.2",
|
"version": "1.3.3",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "mediabunny",
|
"name": "mediabunny",
|
||||||
"version": "1.3.2",
|
"version": "1.3.3",
|
||||||
"license": "MPL-2.0",
|
"license": "MPL-2.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@types/dom-mediacapture-transform": "^0.1.11",
|
"@types/dom-mediacapture-transform": "^0.1.11",
|
||||||
|
|||||||
+2
-2
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "mediabunny",
|
"name": "mediabunny",
|
||||||
"author": "Vanilagy",
|
"author": "Vanilagy",
|
||||||
"version": "1.3.2",
|
"version": "1.3.3",
|
||||||
"description": "Pure TypeScript media toolkit for reading, writing, and converting media files, directly in the browser.",
|
"description": "Pure TypeScript media toolkit for reading, writing, and converting media files, directly in the browser.",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"main": "./dist/bundles/mediabunny.cjs",
|
"main": "./dist/bundles/mediabunny.cjs",
|
||||||
@@ -31,7 +31,7 @@
|
|||||||
"docs:preview": "vitepress preview docs",
|
"docs:preview": "vitepress preview docs",
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
"examples:build": "vite build",
|
"examples:build": "vite build",
|
||||||
"fix-build-import-paths": "find dist -name \"*.js\" -type f -exec sed -i '' \"s/ from '\\([^']*\\)';/ from '\\1.js';/g\" {} \\;",
|
"fix-build-import-paths": "tsx scripts/add-import-extensions.ts",
|
||||||
"append-namespace": "echo 'export as namespace Mediabunny;' >> dist/mediabunny.d.ts"
|
"append-namespace": "echo 'export as namespace Mediabunny;' >> dist/mediabunny.d.ts"
|
||||||
},
|
},
|
||||||
"license": "MPL-2.0",
|
"license": "MPL-2.0",
|
||||||
|
|||||||
@@ -0,0 +1,37 @@
|
|||||||
|
import * as fs from 'fs';
|
||||||
|
import * as path from 'path';
|
||||||
|
|
||||||
|
// .js extensions are technically required in compliant ECMAScript, and Webpack needs them, so we add them here.
|
||||||
|
|
||||||
|
const walkDir = (dir: string) => {
|
||||||
|
const files: string[] = [];
|
||||||
|
const items = fs.readdirSync(dir);
|
||||||
|
|
||||||
|
for (const item of items) {
|
||||||
|
const fullPath = path.join(dir, item);
|
||||||
|
const stat = fs.statSync(fullPath);
|
||||||
|
|
||||||
|
if (stat.isDirectory()) {
|
||||||
|
files.push(...walkDir(fullPath));
|
||||||
|
} else if (item.endsWith('.js')) {
|
||||||
|
files.push(fullPath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return files;
|
||||||
|
};
|
||||||
|
|
||||||
|
const fixFile = (filePath: string) => {
|
||||||
|
const content = fs.readFileSync(filePath, 'utf8');
|
||||||
|
const fixed = content.replace(
|
||||||
|
/(\s+from\s+['"])([^'"]*)(['"])/g,
|
||||||
|
'$1$2.js$3',
|
||||||
|
);
|
||||||
|
|
||||||
|
if (content !== fixed) {
|
||||||
|
fs.writeFileSync(filePath, fixed);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const jsFiles = walkDir('dist');
|
||||||
|
jsFiles.forEach(fixFile);
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
import ts from 'typescript';
|
import ts from 'typescript';
|
||||||
import * as fs from 'node:fs';
|
import * as fs from 'fs';
|
||||||
|
|
||||||
const checkDocblocks = (filePath: string) => {
|
const checkDocblocks = (filePath: string) => {
|
||||||
const program = ts.createProgram([filePath], {});
|
const program = ts.createProgram([filePath], {});
|
||||||
|
|||||||
Reference in New Issue
Block a user