cpp.js 1.0.0-beta.30 → 1.0.0-beta.32
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/README.md +2 -0
- package/package.json +1 -2
- package/src/actions/getAllBridges.js +2 -2
- package/src/actions/getDependLibs.js +3 -3
- package/src/bin.js +4 -4
- package/src/state/loadConfig.js +1 -1
- package/src/utils/findFiles.js +5 -0
- package/src/utils/getAbsolutePath.js +1 -1
- package/src/utils/getCMakeListsFilePath.js +3 -3
package/README.md
CHANGED
|
@@ -15,8 +15,10 @@
|
|
|
15
15
|
<a href="https://github.com/bugra9/cpp.js/discussions"><img alt="Discussions" src="https://img.shields.io/github/discussions/bugra9/cpp.js?style=for-the-badge" /></a>
|
|
16
16
|
<a href="https://github.com/bugra9/cpp.js/issues"><img alt="Issues" src="https://img.shields.io/github/issues/bugra9/cpp.js?style=for-the-badge" /></a>
|
|
17
17
|
<br />
|
|
18
|
+
<img alt="CodeQL" src="https://img.shields.io/github/actions/workflow/status/bugra9/cpp.js/github-code-scanning/codeql?branch=main&style=for-the-badge&label=CodeQL">
|
|
18
19
|
<img alt="Linux Build" src="https://img.shields.io/github/actions/workflow/status/bugra9/cpp.js/build-linux.yml?branch=main&style=for-the-badge&label=Linux%20Build">
|
|
19
20
|
<img alt="Macos Build" src="https://img.shields.io/github/actions/workflow/status/bugra9/cpp.js/build-macos.yml?branch=main&style=for-the-badge&label=Macos%20Build">
|
|
21
|
+
<img alt="Windows Build" src="https://img.shields.io/github/actions/workflow/status/bugra9/cpp.js/build-windows.yml?branch=main&style=for-the-badge&label=Windows%20Build">
|
|
20
22
|
</div>
|
|
21
23
|
|
|
22
24
|
<h3 align="center">
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cpp.js",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.32",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"homepage": "https://cpp.js.org",
|
|
6
6
|
"repository": "https://github.com/bugra9/cpp.js.git",
|
|
@@ -19,7 +19,6 @@
|
|
|
19
19
|
"commander": "^12.1.0",
|
|
20
20
|
"glob": "^11.0.0",
|
|
21
21
|
"rollup": "^4.29.1",
|
|
22
|
-
"rollup-plugin-uglify": "^6.0.4",
|
|
23
22
|
"upath": "^2.0.1",
|
|
24
23
|
"decompress": "^4.2.1",
|
|
25
24
|
"follow-redirects": "^1.15.9",
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import findFiles from '../utils/findFiles.js';
|
|
2
2
|
import state from '../state/index.js';
|
|
3
3
|
|
|
4
4
|
export default function getAllBridges() {
|
|
5
5
|
return [
|
|
6
|
-
...
|
|
6
|
+
...findFiles(`${state.config.paths.build}/bridge/*.i.cpp`),
|
|
7
7
|
];
|
|
8
8
|
}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import
|
|
1
|
+
import findFiles from '../utils/findFiles.js';
|
|
2
2
|
import state from '../state/index.js';
|
|
3
3
|
|
|
4
4
|
export default function getDependLibs() {
|
|
5
5
|
let dependLibs = [
|
|
6
|
-
...
|
|
6
|
+
...findFiles(`${state.config.paths.build}/Source-Release/Emscripten-x86_64/dependencies/**/*.a`, { cwd: state.config.paths.project }),
|
|
7
7
|
];
|
|
8
8
|
state.config.dependencyParameters.cmakeDepends.forEach((d) => {
|
|
9
9
|
if (d.export.libName) {
|
|
10
10
|
d.export.libName.forEach((fileName) => {
|
|
11
11
|
if (d.platform['Emscripten-x86_64'].ignoreLibName?.includes(fileName)) return;
|
|
12
|
-
dependLibs.push(...
|
|
12
|
+
dependLibs.push(...findFiles(`${d.paths.output}/prebuilt/Emscripten-x86_64/lib/lib${fileName}.a`, { cwd: d.paths.project }));
|
|
13
13
|
});
|
|
14
14
|
}
|
|
15
15
|
});
|
package/src/bin.js
CHANGED
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
import fs from 'node:fs';
|
|
4
4
|
import { execFileSync } from 'node:child_process';
|
|
5
5
|
import { Command, Option } from 'commander';
|
|
6
|
-
import { glob } from 'glob';
|
|
7
6
|
import replace from 'replace';
|
|
8
7
|
|
|
9
8
|
import { state } from './index.js';
|
|
@@ -18,6 +17,7 @@ import systemKeys from './utils/systemKeys.js';
|
|
|
18
17
|
|
|
19
18
|
import { getDockerImage } from './utils/pullDockerImage.js';
|
|
20
19
|
import { getContentHash } from './utils/hash.js';
|
|
20
|
+
import findFiles from './utils/findFiles.js';
|
|
21
21
|
|
|
22
22
|
const packageJSON = JSON.parse(fs.readFileSync(new URL('../package.json', import.meta.url)));
|
|
23
23
|
|
|
@@ -262,8 +262,8 @@ function buildLib(platform) {
|
|
|
262
262
|
|
|
263
263
|
const modules = [];
|
|
264
264
|
state.config.paths.module.forEach((modulePath) => {
|
|
265
|
-
modules.push(...
|
|
266
|
-
modules.push(...
|
|
265
|
+
modules.push(...findFiles('**/*.i', { cwd: modulePath }));
|
|
266
|
+
modules.push(...findFiles('*.i', { cwd: modulePath }));
|
|
267
267
|
});
|
|
268
268
|
if (modules.length > 0) {
|
|
269
269
|
fs.mkdirSync(`${state.config.paths.output}/prebuilt/${p}/swig`, { recursive: true });
|
|
@@ -289,7 +289,7 @@ function buildLib(platform) {
|
|
|
289
289
|
async function createWasmJs() {
|
|
290
290
|
let headers = [];
|
|
291
291
|
state.config.paths.header.forEach((headerPath) => {
|
|
292
|
-
headers.push(
|
|
292
|
+
headers.push(findFiles('**/*.h', { cwd: headerPath }));
|
|
293
293
|
});
|
|
294
294
|
headers = headers.filter((path) => !!path.toString()).flat();
|
|
295
295
|
|
package/src/state/loadConfig.js
CHANGED
|
@@ -64,7 +64,7 @@ function getFilledConfig(config, options = { isDepend: false }) {
|
|
|
64
64
|
newConfig.paths.bridge = (newConfig.paths.bridge || [...newConfig.paths.native, newConfig.paths.build])
|
|
65
65
|
.map((p) => getPath(p));
|
|
66
66
|
newConfig.paths.output = getPath(newConfig.paths.output) || newConfig.paths.build;
|
|
67
|
-
newConfig.paths.cmake = options.isDepend ? getCMakeListsFilePath(newConfig.paths.output) : (
|
|
67
|
+
newConfig.paths.cmake = options.isDepend ? getPath(getCMakeListsFilePath(newConfig.paths.output)) : (
|
|
68
68
|
getPath(newConfig.paths.cmake || getCMakeListsFilePath(newConfig.paths.project))
|
|
69
69
|
);
|
|
70
70
|
newConfig.paths.cmakeDir = getParentPath(newConfig.paths.cmake);
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { glob } from 'glob';
|
|
2
1
|
import getParentPath from './getParentPath.js';
|
|
2
|
+
import findFiles from './findFiles.js';
|
|
3
3
|
|
|
4
4
|
export default function getCMakeListsFilePath(basePath = process.cwd()) {
|
|
5
|
-
let temp =
|
|
5
|
+
let temp = findFiles('CMakeLists.txt', { cwd: basePath });
|
|
6
6
|
if (temp.length === 0) {
|
|
7
|
-
temp =
|
|
7
|
+
temp = findFiles('*/CMakeLists.txt', { cwd: basePath, ignore: ['node_modules/*', 'dist/*', 'build/*'] });
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
if (temp.length > 0) return temp[0];
|