js-draw 0.18.0 → 0.18.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/CHANGELOG.md +7 -0
- package/dist/bundle.js +1 -1
- package/dist/cjs/src/rendering/lib.d.ts +1 -1
- package/dist/cjs/src/rendering/lib.js +2 -1
- package/dist/mjs/src/rendering/lib.d.ts +1 -1
- package/dist/mjs/src/rendering/lib.mjs +1 -1
- package/package.json +3 -2
- package/src/rendering/lib.ts +1 -1
- package/.github/ISSUE_TEMPLATE/bug_report.md +0 -34
- package/.github/ISSUE_TEMPLATE/feature_request.md +0 -20
- package/.github/ISSUE_TEMPLATE/translation.yml +0 -902
- package/.github/pull_request_template.md +0 -15
- package/.github/workflows/firebase-hosting-merge.yml +0 -34
- package/.github/workflows/firebase-hosting-pull-request.yml +0 -34
- package/.github/workflows/github-pages.yml +0 -58
- package/.husky/pre-commit +0 -4
- package/build_tools/BundledFile.ts +0 -167
- package/build_tools/buildTranslationTemplate.ts +0 -121
- package/build_tools/bundle.ts +0 -11
- package/build_tools/postDist.ts +0 -71
- package/dist/cjs/build_tools/BundledFile.d.ts +0 -13
- package/dist/cjs/build_tools/BundledFile.js +0 -163
- package/dist/cjs/build_tools/buildTranslationTemplate.d.ts +0 -1
- package/dist/cjs/build_tools/buildTranslationTemplate.js +0 -119
- package/dist/cjs/build_tools/bundle.d.ts +0 -1
- package/dist/cjs/build_tools/bundle.js +0 -10
- package/dist/cjs/build_tools/postDist.d.ts +0 -1
- package/dist/cjs/build_tools/postDist.js +0 -72
- package/dist/mjs/build_tools/BundledFile.d.ts +0 -13
- package/dist/mjs/build_tools/BundledFile.mjs +0 -157
- package/dist/mjs/build_tools/buildTranslationTemplate.d.ts +0 -1
- package/dist/mjs/build_tools/buildTranslationTemplate.mjs +0 -94
- package/dist/mjs/build_tools/bundle.d.ts +0 -1
- package/dist/mjs/build_tools/bundle.mjs +0 -5
- package/dist/mjs/build_tools/postDist.d.ts +0 -1
- package/dist/mjs/build_tools/postDist.mjs +0 -67
@@ -1,67 +0,0 @@
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
8
|
-
});
|
9
|
-
};
|
10
|
-
import { readdir, stat, rename, readFile, writeFile, unlink } from 'fs/promises';
|
11
|
-
import path from 'path';
|
12
|
-
// Script to be run after building JavaScript files from TypeScript.
|
13
|
-
// TODO: This is very hacky.
|
14
|
-
// TODO: [Use the TypeScript Compiler API instead.](https://github.com/microsoft/TypeScript/wiki/Using-the-Compiler-API)
|
15
|
-
// Iterates over every JavaScript file in [directory].
|
16
|
-
const forEachFile = (directory, processFile) => __awaiter(void 0, void 0, void 0, function* () {
|
17
|
-
const files = yield readdir(directory);
|
18
|
-
yield Promise.all(files.map((file) => __awaiter(void 0, void 0, void 0, function* () {
|
19
|
-
const filePath = path.join(directory, file);
|
20
|
-
const stats = yield stat(filePath);
|
21
|
-
if (stats.isDirectory()) {
|
22
|
-
yield forEachFile(filePath, processFile);
|
23
|
-
}
|
24
|
-
else if (stats.isFile()) {
|
25
|
-
yield processFile(filePath);
|
26
|
-
}
|
27
|
-
else {
|
28
|
-
throw new Error('Unknown file type!');
|
29
|
-
}
|
30
|
-
})));
|
31
|
-
});
|
32
|
-
const removeFiles = (directory, filePattern) => __awaiter(void 0, void 0, void 0, function* () {
|
33
|
-
yield forEachFile(directory, (filePath) => __awaiter(void 0, void 0, void 0, function* () {
|
34
|
-
if (!filePath.match(filePattern)) {
|
35
|
-
return;
|
36
|
-
}
|
37
|
-
yield unlink(filePath);
|
38
|
-
}));
|
39
|
-
});
|
40
|
-
const main = () => __awaiter(void 0, void 0, void 0, function* () {
|
41
|
-
const rootDir = path.dirname(__dirname);
|
42
|
-
const cjsPath = `${rootDir}/dist/cjs`;
|
43
|
-
const mjsPath = `${rootDir}/dist/mjs`;
|
44
|
-
const testPattern = /\.test\.js$/;
|
45
|
-
yield removeFiles(cjsPath, testPattern);
|
46
|
-
yield removeFiles(mjsPath, testPattern);
|
47
|
-
// We need to replace imports in ESM files.
|
48
|
-
yield forEachFile(mjsPath, (filePath) => __awaiter(void 0, void 0, void 0, function* () {
|
49
|
-
if (!filePath.endsWith('.js')) {
|
50
|
-
return;
|
51
|
-
}
|
52
|
-
// Rename
|
53
|
-
const newPath = filePath.replace(/\.js$/, '.mjs');
|
54
|
-
yield rename(filePath, newPath);
|
55
|
-
// Change imports from
|
56
|
-
// import foo from './bar'
|
57
|
-
// to
|
58
|
-
// import foo from './bar.mjs'
|
59
|
-
// and exports similarly.
|
60
|
-
let contents = yield readFile(newPath, { encoding: 'utf-8' });
|
61
|
-
// TODO: Switch to using the TypeScript compiler API. This has the danger of changing imports
|
62
|
-
// in multi-line strings.
|
63
|
-
contents = contents.replace(/([\n]|^)(import|export)(.*)from\s+(['"])(\.*\/[^\n]+)(['"])/g, '$1$2 $3 from $4$5.mjs$6');
|
64
|
-
yield writeFile(newPath, contents);
|
65
|
-
}));
|
66
|
-
});
|
67
|
-
main();
|