@tarojs/rn-runner 3.5.7-alpha.5 → 3.5.7-alpha.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.
- package/dist/index.js +9 -4
- package/dist/index.js.map +1 -1
- package/package.json +7 -6
- package/src/index.ts +12 -8
package/dist/index.js
CHANGED
|
@@ -12,6 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
const rn_supporter_1 = require("@tarojs/rn-supporter");
|
|
13
13
|
const child_process_1 = require("child_process");
|
|
14
14
|
const fs_1 = require("fs");
|
|
15
|
+
const fse = require("fs-extra");
|
|
15
16
|
const path_1 = require("path");
|
|
16
17
|
const build_component_1 = require("./config/build-component");
|
|
17
18
|
// 确认根目录下 metro.config.js index.js 是否存在
|
|
@@ -64,7 +65,7 @@ function build(_appPath, config) {
|
|
|
64
65
|
cliParams.push('--port', config.port);
|
|
65
66
|
}
|
|
66
67
|
try {
|
|
67
|
-
(0, child_process_1.spawn)('react-native',
|
|
68
|
+
(0, child_process_1.spawn)('npx', ['react-native', 'start'].concat(cliParams), {
|
|
68
69
|
stdio: 'inherit'
|
|
69
70
|
});
|
|
70
71
|
if (config.qr) {
|
|
@@ -79,8 +80,11 @@ function build(_appPath, config) {
|
|
|
79
80
|
}
|
|
80
81
|
}
|
|
81
82
|
else {
|
|
83
|
+
const defaultOutputDir = (0, path_1.join)(process.cwd(), config.outputRoot || 'dist');
|
|
84
|
+
const defaultBundleOutput = (0, path_1.join)(defaultOutputDir, 'index.bundle');
|
|
82
85
|
const bundleOutput = config.bundleOutput ? config.bundleOutput : (isIos ? config.output.ios : config.output.android);
|
|
83
|
-
|
|
86
|
+
fse.ensureDirSync((0, path_1.dirname)(bundleOutput));
|
|
87
|
+
cliParams.push('--bundle-output', bundleOutput || defaultBundleOutput);
|
|
84
88
|
const sourcemapOutput = config.sourcemapOutput ? config.sourcemapOutput : (isIos ? config.output.iosSourcemapOutput : config.output.androidSourcemapOutput);
|
|
85
89
|
if (sourcemapOutput) {
|
|
86
90
|
cliParams.push('--sourcemap-output', sourcemapOutput);
|
|
@@ -94,9 +98,10 @@ function build(_appPath, config) {
|
|
|
94
98
|
cliParams.push('--sourcemap-sources-root', sourcemapSourcesRoot);
|
|
95
99
|
}
|
|
96
100
|
const assetsDest = config.assetsDest ? config.assetsDest : (isIos ? config.output.iosAssetsDest : config.output.androidAssetsDest);
|
|
97
|
-
cliParams.push('--assets-dest', assetsDest);
|
|
101
|
+
cliParams.push('--assets-dest', assetsDest || defaultOutputDir);
|
|
98
102
|
try {
|
|
99
|
-
(0, child_process_1.spawn)('
|
|
103
|
+
(0, child_process_1.spawn)('npx', [
|
|
104
|
+
'react-native',
|
|
100
105
|
'bundle',
|
|
101
106
|
'--platform',
|
|
102
107
|
config.deviceType,
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,uDAA8D;AAC9D,iDAAqC;AACrC,2BAAwC;AACxC,gCAA+B;AAC/B,+BAAoC;AAEpC,8DAAqD;AAErD,uCAAuC;AACvC,MAAM,KAAK,GAAG,CAAC,iBAAiB,EAAE,UAAU,CAAC,CAAA;AAC7C,SAAS,YAAY;IACnB,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;QACnB,MAAM,QAAQ,GAAG,IAAA,WAAI,EAAC,OAAO,CAAC,GAAG,EAAE,EAAE,IAAI,CAAC,CAAA;QAC1C,IAAA,aAAQ,EAAC,IAAA,WAAI,EAAC,SAAS,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,CAAC,EAAE,QAAQ,EAAE,cAAS,CAAC,aAAa,EAAE,GAAG,CAAC,EAAE;YAC1F,IAAI,GAAG,EAAE;gBACP,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,MAAM,CAAC,SAAS,CAAC,EAAE;oBACnB,KAAK,EAAE,SAAS;iBACjB,CAAC,CAAA;gBACF,IAAG,MAAM,CAAC,EAAE,EAAE;oBACZ,OAAO,CAAC,EAAE,CAAC,YAAY,EAAE,GAAG,EAAE;wBAC5B,IAAA,0BAAW,EAAC;4BACV,GAAG,EAAE,YAAY;4BACjB,QAAQ,EAAE,MAAM,CAAC,UAAU;4BAC3B,UAAU,EAAE,UAAU;yBACvB,CAAC,CAAA;oBACJ,CAAC,CAAC,CAAA;iBACH;gBACD,QAAQ,CAAC,IAAI,CAAC,CAAA;aACf;YAAC,OAAM,CAAC,EAAE;gBACT,QAAQ,CAAC,CAAC,CAAC,CAAA;aACZ;SACF;IACH,CAAC;CAAA;AAhGD,wBAgGC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tarojs/rn-runner",
|
|
3
|
-
"version": "3.5.7-alpha.
|
|
3
|
+
"version": "3.5.7-alpha.6",
|
|
4
4
|
"description": "ReactNative build tool for taro",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"repository": {
|
|
@@ -26,11 +26,12 @@
|
|
|
26
26
|
"@rollup/plugin-json": "^4.1.0",
|
|
27
27
|
"@rollup/plugin-node-resolve": "^13.3.0",
|
|
28
28
|
"@rollup/plugin-replace": "^4.0.0",
|
|
29
|
-
"@tarojs/helper": "3.5.7-alpha.
|
|
30
|
-
"@tarojs/rn-style-transformer": "3.5.7-alpha.
|
|
31
|
-
"@tarojs/rn-supporter": "3.5.7-alpha.
|
|
32
|
-
"@tarojs/rn-transformer": "3.5.7-alpha.
|
|
29
|
+
"@tarojs/helper": "3.5.7-alpha.6",
|
|
30
|
+
"@tarojs/rn-style-transformer": "3.5.7-alpha.6",
|
|
31
|
+
"@tarojs/rn-supporter": "3.5.7-alpha.6",
|
|
32
|
+
"@tarojs/rn-transformer": "3.5.7-alpha.6",
|
|
33
33
|
"acorn-jsx": "^5.3.2",
|
|
34
|
+
"fs-extra": "^8.0.1",
|
|
34
35
|
"lodash": "^4.17.21",
|
|
35
36
|
"rollup-plugin-image-file": "^1.0.2"
|
|
36
37
|
},
|
|
@@ -38,7 +39,7 @@
|
|
|
38
39
|
"@babel/core": "^7.14.5",
|
|
39
40
|
"@babel/preset-env": "^7.14.5",
|
|
40
41
|
"acorn": "^8.0.4",
|
|
41
|
-
"expo": "~47.0.0-beta.
|
|
42
|
+
"expo": "~47.0.0-beta.8",
|
|
42
43
|
"expo-file-system": "~15.1.1",
|
|
43
44
|
"react": "18.1.0",
|
|
44
45
|
"react-is": "^16.13.0",
|
package/src/index.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { previewDev,previewProd } from '@tarojs/rn-supporter'
|
|
1
|
+
import { previewDev, previewProd } from '@tarojs/rn-supporter'
|
|
2
2
|
import { spawn } from 'child_process'
|
|
3
|
-
import { constants,copyFile } from 'fs'
|
|
4
|
-
import
|
|
3
|
+
import { constants, copyFile } from 'fs'
|
|
4
|
+
import * as fse from 'fs-extra'
|
|
5
|
+
import { dirname, join } from 'path'
|
|
5
6
|
|
|
6
7
|
import buildComponent from './config/build-component'
|
|
7
8
|
|
|
@@ -56,7 +57,7 @@ export default async function build (_appPath: string, config: any): Promise<any
|
|
|
56
57
|
cliParams.push('--port', config.port)
|
|
57
58
|
}
|
|
58
59
|
try {
|
|
59
|
-
spawn('react-native',
|
|
60
|
+
spawn('npx', ['react-native', 'start'].concat(cliParams), {
|
|
60
61
|
stdio: 'inherit'
|
|
61
62
|
})
|
|
62
63
|
if(config.qr) {
|
|
@@ -69,14 +70,16 @@ export default async function build (_appPath: string, config: any): Promise<any
|
|
|
69
70
|
onFinish(e)
|
|
70
71
|
}
|
|
71
72
|
} else {
|
|
73
|
+
const defaultOutputDir = join(process.cwd(), config.outputRoot || 'dist')
|
|
74
|
+
const defaultBundleOutput = join(defaultOutputDir, 'index.bundle')
|
|
72
75
|
const bundleOutput = config.bundleOutput ? config.bundleOutput : (isIos ? config.output.ios : config.output.android)
|
|
73
|
-
|
|
76
|
+
fse.ensureDirSync(dirname(bundleOutput))
|
|
77
|
+
cliParams.push('--bundle-output', bundleOutput || defaultBundleOutput)
|
|
74
78
|
|
|
75
79
|
const sourcemapOutput = config.sourcemapOutput ? config.sourcemapOutput : (isIos ? config.output.iosSourcemapOutput : config.output.androidSourcemapOutput)
|
|
76
80
|
if (sourcemapOutput) {
|
|
77
81
|
cliParams.push('--sourcemap-output', sourcemapOutput)
|
|
78
82
|
}
|
|
79
|
-
|
|
80
83
|
const sourceMapUrl = config.sourceMapUrl ? config.sourceMapUrl : (isIos ? config.output.iosSourceMapUrl : config.output.androidSourceMapUrl)
|
|
81
84
|
if (sourceMapUrl) {
|
|
82
85
|
cliParams.push('--sourcemap-use-absolute-path', sourceMapUrl)
|
|
@@ -88,10 +91,11 @@ export default async function build (_appPath: string, config: any): Promise<any
|
|
|
88
91
|
}
|
|
89
92
|
|
|
90
93
|
const assetsDest = config.assetsDest ? config.assetsDest : (isIos ? config.output.iosAssetsDest : config.output.androidAssetsDest)
|
|
91
|
-
cliParams.push('--assets-dest', assetsDest)
|
|
94
|
+
cliParams.push('--assets-dest', assetsDest || defaultOutputDir)
|
|
92
95
|
|
|
93
96
|
try {
|
|
94
|
-
spawn('
|
|
97
|
+
spawn('npx', [
|
|
98
|
+
'react-native',
|
|
95
99
|
'bundle',
|
|
96
100
|
'--platform',
|
|
97
101
|
config.deviceType,
|