@multiplatform.one/utils 0.1.0 → 0.1.6
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.
|
@@ -6,5 +6,6 @@ interface LookupTamaguiModulesOptions {
|
|
|
6
6
|
}
|
|
7
7
|
declare function lookupTranspileModules(packageDirs?: string[], { log }?: LookupTranspileModulesOptions): any[];
|
|
8
8
|
declare function lookupTamaguiModules(packageDirs?: string[], { log }?: LookupTamaguiModulesOptions): any[];
|
|
9
|
+
declare function resolveConfig(keys?: Record<string, any>): any;
|
|
9
10
|
|
|
10
|
-
export { type LookupTamaguiModulesOptions, type LookupTranspileModulesOptions, lookupTamaguiModules, lookupTranspileModules };
|
|
11
|
+
export { type LookupTamaguiModulesOptions, type LookupTranspileModulesOptions, lookupTamaguiModules, lookupTranspileModules, resolveConfig };
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
6
6
|
});
|
|
7
7
|
|
|
8
|
-
// src/
|
|
8
|
+
// src/build.ts
|
|
9
9
|
var _path = require('path'); var _path2 = _interopRequireDefault(_path);
|
|
10
10
|
var logger = console;
|
|
11
11
|
var projectRoot = __require.resolve("react/package.json").slice(0, -32);
|
|
@@ -19,7 +19,9 @@ function lookupTranspileModules(packageDirs, { log = true } = {}) {
|
|
|
19
19
|
_path2.default.resolve(projectRoot, "packages", "ui"),
|
|
20
20
|
...packageDirs || []
|
|
21
21
|
])
|
|
22
|
-
].map(
|
|
22
|
+
].map(
|
|
23
|
+
(packageDir) => __require(`${packageDir}/package.json`).transpileModules || []
|
|
24
|
+
)
|
|
23
25
|
)
|
|
24
26
|
].flat();
|
|
25
27
|
if (log) logger.debug("transpileModules:", transpileModules.join(", "));
|
|
@@ -36,13 +38,25 @@ function lookupTamaguiModules(packageDirs, { log = true } = {}) {
|
|
|
36
38
|
_path2.default.resolve(projectRoot, "packages", "ui"),
|
|
37
39
|
...packageDirs || []
|
|
38
40
|
])
|
|
39
|
-
].map(
|
|
41
|
+
].map(
|
|
42
|
+
(packageDir) => __require(`${packageDir}/package.json`).tamaguiModules || []
|
|
43
|
+
)
|
|
40
44
|
])
|
|
41
45
|
].flat();
|
|
42
46
|
if (log) logger.debug("tamaguiModules:", tamaguiModules.join(", "));
|
|
43
47
|
return tamaguiModules;
|
|
44
48
|
}
|
|
49
|
+
function resolveConfig(keys = {}) {
|
|
50
|
+
return keys.reduce(
|
|
51
|
+
(acc, key) => {
|
|
52
|
+
if (process.env[key]) acc[key] = process.env[key];
|
|
53
|
+
return acc;
|
|
54
|
+
},
|
|
55
|
+
{}
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
|
|
45
59
|
|
|
46
60
|
|
|
47
61
|
|
|
48
|
-
exports.lookupTamaguiModules = lookupTamaguiModules; exports.lookupTranspileModules = lookupTranspileModules;
|
|
62
|
+
exports.lookupTamaguiModules = lookupTamaguiModules; exports.lookupTranspileModules = lookupTranspileModules; exports.resolveConfig = resolveConfig;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@multiplatform.one/utils",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.6",
|
|
4
4
|
"description": "utilities for multiplatform.one",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"keywords": [
|
|
@@ -21,14 +21,12 @@
|
|
|
21
21
|
"types": "lib/index.d.ts",
|
|
22
22
|
"exports": {
|
|
23
23
|
".": {
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"import": "./lib/index.js"
|
|
24
|
+
"import": "./lib/index.js",
|
|
25
|
+
"require": "./lib/index.js"
|
|
27
26
|
},
|
|
28
|
-
"./
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"import": "./lib/transpileModules.js"
|
|
27
|
+
"./build": {
|
|
28
|
+
"import": "./lib/build.js",
|
|
29
|
+
"require": "./lib/build.js"
|
|
32
30
|
},
|
|
33
31
|
"./package.json": "./package.json"
|
|
34
32
|
},
|
|
@@ -44,15 +42,15 @@
|
|
|
44
42
|
},
|
|
45
43
|
"devDependencies": {
|
|
46
44
|
"@types/node": "~20.12.13",
|
|
47
|
-
"tsup": "^8.
|
|
48
|
-
"typescript": "
|
|
45
|
+
"tsup": "^8.3.0",
|
|
46
|
+
"typescript": "^5.6.2"
|
|
49
47
|
},
|
|
50
48
|
"engines": {
|
|
51
49
|
"node": ">=6.0.0"
|
|
52
50
|
},
|
|
53
|
-
"
|
|
54
|
-
"
|
|
55
|
-
|
|
51
|
+
"dependencies": {
|
|
52
|
+
"yaml": "^2.6.0"
|
|
53
|
+
},
|
|
56
54
|
"scripts": {
|
|
57
55
|
"build": "tsup"
|
|
58
56
|
}
|
|
@@ -19,10 +19,10 @@
|
|
|
19
19
|
* limitations under the License.
|
|
20
20
|
*/
|
|
21
21
|
|
|
22
|
-
import path from
|
|
22
|
+
import path from "node:path";
|
|
23
23
|
|
|
24
24
|
const logger = console;
|
|
25
|
-
const projectRoot = require.resolve(
|
|
25
|
+
const projectRoot = require.resolve("react/package.json").slice(0, -32);
|
|
26
26
|
|
|
27
27
|
export interface LookupTranspileModulesOptions {
|
|
28
28
|
log?: boolean;
|
|
@@ -32,37 +32,59 @@ export interface LookupTamaguiModulesOptions {
|
|
|
32
32
|
log?: boolean;
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
export function lookupTranspileModules(
|
|
35
|
+
export function lookupTranspileModules(
|
|
36
|
+
packageDirs?: string[],
|
|
37
|
+
{ log = true }: LookupTranspileModulesOptions = {},
|
|
38
|
+
) {
|
|
36
39
|
const transpileModules = [
|
|
37
40
|
...new Set(
|
|
38
41
|
[
|
|
39
42
|
...new Set([
|
|
40
43
|
projectRoot,
|
|
41
|
-
path.resolve(projectRoot,
|
|
42
|
-
path.resolve(projectRoot,
|
|
44
|
+
path.resolve(projectRoot, "app"),
|
|
45
|
+
path.resolve(projectRoot, "packages", "ui"),
|
|
43
46
|
...(packageDirs || []),
|
|
44
47
|
]),
|
|
45
|
-
].map(
|
|
48
|
+
].map(
|
|
49
|
+
(packageDir) =>
|
|
50
|
+
require(`${packageDir}/package.json`).transpileModules || [],
|
|
51
|
+
),
|
|
46
52
|
),
|
|
47
53
|
].flat();
|
|
48
|
-
if (log) logger.debug(
|
|
54
|
+
if (log) logger.debug("transpileModules:", transpileModules.join(", "));
|
|
49
55
|
return transpileModules;
|
|
50
56
|
}
|
|
51
57
|
|
|
52
|
-
export function lookupTamaguiModules(
|
|
58
|
+
export function lookupTamaguiModules(
|
|
59
|
+
packageDirs?: string[],
|
|
60
|
+
{ log = true }: LookupTamaguiModulesOptions = {},
|
|
61
|
+
) {
|
|
53
62
|
const tamaguiModules = [
|
|
54
63
|
...new Set([
|
|
55
|
-
|
|
64
|
+
"tamagui",
|
|
56
65
|
...[
|
|
57
66
|
...new Set([
|
|
58
67
|
projectRoot,
|
|
59
|
-
path.resolve(projectRoot,
|
|
60
|
-
path.resolve(projectRoot,
|
|
68
|
+
path.resolve(projectRoot, "app"),
|
|
69
|
+
path.resolve(projectRoot, "packages", "ui"),
|
|
61
70
|
...(packageDirs || []),
|
|
62
71
|
]),
|
|
63
|
-
].map(
|
|
72
|
+
].map(
|
|
73
|
+
(packageDir) =>
|
|
74
|
+
require(`${packageDir}/package.json`).tamaguiModules || [],
|
|
75
|
+
),
|
|
64
76
|
]),
|
|
65
77
|
].flat();
|
|
66
|
-
if (log) logger.debug(
|
|
78
|
+
if (log) logger.debug("tamaguiModules:", tamaguiModules.join(", "));
|
|
67
79
|
return tamaguiModules;
|
|
68
80
|
}
|
|
81
|
+
|
|
82
|
+
export function resolveConfig(keys: Record<string, any> = {}) {
|
|
83
|
+
return keys.reduce(
|
|
84
|
+
(acc: Record<string, any>, key: string) => {
|
|
85
|
+
if (process.env[key]) acc[key] = process.env[key];
|
|
86
|
+
return acc;
|
|
87
|
+
},
|
|
88
|
+
{} as Record<string, any>,
|
|
89
|
+
);
|
|
90
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* File: /transpileModules/index.d.ts
|
|
3
|
-
* Project: @multiplatform.one/utils
|
|
4
|
-
* File Created: 16-06-2024 14:28:33
|
|
5
|
-
* Author: Clay Risser
|
|
6
|
-
* -----
|
|
7
|
-
* BitSpur (c) Copyright 2021 - 2024
|
|
8
|
-
*
|
|
9
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
10
|
-
* you may not use this file except in compliance with the License.
|
|
11
|
-
* You may obtain a copy of the License at
|
|
12
|
-
*
|
|
13
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
14
|
-
*
|
|
15
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
16
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
17
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
18
|
-
* See the License for the specific language governing permissions and
|
|
19
|
-
* limitations under the License.
|
|
20
|
-
*/
|
|
21
|
-
|
|
22
|
-
export * from '../lib/transpileModules';
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* File: /transpileModules/index.js
|
|
3
|
-
* Project: @multiplatform.one/utils
|
|
4
|
-
* File Created: 16-06-2024 14:28:33
|
|
5
|
-
* Author: Clay Risser
|
|
6
|
-
* -----
|
|
7
|
-
* BitSpur (c) Copyright 2021 - 2024
|
|
8
|
-
*
|
|
9
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
10
|
-
* you may not use this file except in compliance with the License.
|
|
11
|
-
* You may obtain a copy of the License at
|
|
12
|
-
*
|
|
13
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
14
|
-
*
|
|
15
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
16
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
17
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
18
|
-
* See the License for the specific language governing permissions and
|
|
19
|
-
* limitations under the License.
|
|
20
|
-
*/
|
|
21
|
-
|
|
22
|
-
export * from '../lib/transpileModules.js';
|