@nativescript/types-swiftui 0.0.1 → 0.0.3
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/index.js +15 -4
- package/nativescript.webpack.js +15 -0
- package/package.json +2 -1
package/index.js
CHANGED
|
@@ -1,7 +1,15 @@
|
|
|
1
|
+
function getRuntimeRequire() {
|
|
2
|
+
if (typeof __non_webpack_require__ === "function") {
|
|
3
|
+
return __non_webpack_require__;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
return require;
|
|
7
|
+
}
|
|
8
|
+
|
|
1
9
|
function loadSwift() {
|
|
2
10
|
if (globalThis.SwiftLoaded) return;
|
|
3
11
|
|
|
4
|
-
|
|
12
|
+
const runtimeRequire = getRuntimeRequire();
|
|
5
13
|
|
|
6
14
|
if (
|
|
7
15
|
typeof NSBundle !== "undefined" &&
|
|
@@ -11,11 +19,14 @@ function loadSwift() {
|
|
|
11
19
|
const resourcePath = mainBundle.resourcePath;
|
|
12
20
|
if (resourcePath) {
|
|
13
21
|
const nodeFilePath = resourcePath + "/libSwiftBridge.node";
|
|
14
|
-
module.exports =
|
|
22
|
+
module.exports = runtimeRequire(nodeFilePath);
|
|
23
|
+
globalThis.SwiftLoaded = true;
|
|
24
|
+
return;
|
|
15
25
|
}
|
|
16
|
-
} else {
|
|
17
|
-
module.exports = require(__dirname + "/dist/libSwiftBridge.node");
|
|
18
26
|
}
|
|
27
|
+
|
|
28
|
+
module.exports = runtimeRequire(__dirname + "/dist/libSwiftBridge.node");
|
|
29
|
+
globalThis.SwiftLoaded = true;
|
|
19
30
|
}
|
|
20
31
|
|
|
21
32
|
loadSwift();
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
const { resolve } = require("path");
|
|
2
|
+
|
|
3
|
+
module.exports = function (webpack) {
|
|
4
|
+
webpack.Utils.addCopyRule({
|
|
5
|
+
from: resolve(__dirname, "dist/libSwiftBridge.node"),
|
|
6
|
+
to: "../libSwiftBridge.node",
|
|
7
|
+
noErrorOnMissing: true,
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
webpack.Utils.addCopyRule({
|
|
11
|
+
from: resolve(__dirname, "dist/libNodeAPI.dylib"),
|
|
12
|
+
to: "../libNodeAPI.dylib",
|
|
13
|
+
noErrorOnMissing: true,
|
|
14
|
+
});
|
|
15
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nativescript/types-swiftui",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"description": "",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "dj",
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
"types": "./types/index.d.ts",
|
|
10
10
|
"files": [
|
|
11
11
|
"./index.js",
|
|
12
|
+
"./nativescript.webpack.js",
|
|
12
13
|
"./types/*",
|
|
13
14
|
"./dist/*"
|
|
14
15
|
]
|