shuvi 1.0.29 → 1.0.30
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/lib/shuvi.js +6 -13
- package/lib/tasks/build.js +2 -2
- package/lib/telemetry.d.ts +2 -0
- package/lib/telemetry.js +17 -0
- package/package.json +8 -8
package/lib/shuvi.js
CHANGED
|
@@ -24,31 +24,24 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.initShuvi = exports.getPlatform = void 0;
|
|
27
|
-
const telemetry_1 = require("@shuvi/telemetry");
|
|
28
27
|
const service_1 = require("@shuvi/service");
|
|
29
28
|
const platform_web_1 = __importDefault(require("@shuvi/platform-web"));
|
|
30
29
|
const config_1 = require("./config");
|
|
31
|
-
|
|
32
|
-
const
|
|
30
|
+
const telemetry_1 = require("./telemetry");
|
|
31
|
+
const trace_1 = require("@shuvi/service/lib/trace");
|
|
33
32
|
function getPlatform() {
|
|
34
33
|
return (0, platform_web_1.default)({ framework: 'react' });
|
|
35
34
|
}
|
|
36
35
|
exports.getPlatform = getPlatform;
|
|
37
|
-
const TELEMETRY_ENDPOINT = '';
|
|
38
36
|
function initShuvi(_a) {
|
|
39
37
|
var { config } = _a, options = __rest(_a, ["config"]);
|
|
40
38
|
return __awaiter(this, void 0, void 0, function* () {
|
|
41
39
|
const { plugins, presets } = config, restConfig = __rest(config, ["plugins", "presets"]);
|
|
42
|
-
const telemetry = TELEMETRY_ENDPOINT
|
|
43
|
-
? new telemetry_1.Telemetry({
|
|
44
|
-
name: 'Shuvi.js',
|
|
45
|
-
meta: { shuviVersion: package_json_1.default.version },
|
|
46
|
-
postEndpoint: TELEMETRY_ENDPOINT
|
|
47
|
-
})
|
|
48
|
-
: undefined;
|
|
49
40
|
const shuvi = yield (0, service_1.getApi)(Object.assign(Object.assign({}, options), { plugins,
|
|
50
|
-
presets, config: restConfig, platform: getPlatform(), normalizePlatformConfig: config_1.normalizePlatformConfig
|
|
51
|
-
|
|
41
|
+
presets, config: restConfig, platform: getPlatform(), normalizePlatformConfig: config_1.normalizePlatformConfig }));
|
|
42
|
+
if (telemetry_1.telemetry) {
|
|
43
|
+
(0, trace_1.setReporter)(telemetry_1.telemetry.report);
|
|
44
|
+
}
|
|
52
45
|
return shuvi;
|
|
53
46
|
});
|
|
54
47
|
}
|
package/lib/tasks/build.js
CHANGED
|
@@ -43,6 +43,7 @@ const service_1 = require("@shuvi/service");
|
|
|
43
43
|
const constants_1 = require("@shuvi/shared/constants");
|
|
44
44
|
const logger_1 = __importDefault(require("@shuvi/utils/logger"));
|
|
45
45
|
const shuvi_1 = require("../shuvi");
|
|
46
|
+
const telemetry_1 = require("../telemetry");
|
|
46
47
|
const defaultBuildOptions = {
|
|
47
48
|
target: 'ssr'
|
|
48
49
|
};
|
|
@@ -93,8 +94,7 @@ function build(options) {
|
|
|
93
94
|
// transpile the application
|
|
94
95
|
yield bundle(bundler);
|
|
95
96
|
yield pluginContext.pluginRunner.afterBuild();
|
|
96
|
-
yield (0, service_1.analysis)({ context: api.pluginContext, telemetry:
|
|
97
|
-
yield api.telemetry.flush();
|
|
97
|
+
yield (0, service_1.analysis)({ context: api.pluginContext, telemetry: telemetry_1.telemetry });
|
|
98
98
|
return api;
|
|
99
99
|
});
|
|
100
100
|
}
|
package/lib/telemetry.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.telemetry = void 0;
|
|
7
|
+
const reporters_1 = require("@shuvi/reporters");
|
|
8
|
+
//@ts-ignore
|
|
9
|
+
const package_json_1 = __importDefault(require("../package.json"));
|
|
10
|
+
const TELEMETRY_ENDPOINT = '';
|
|
11
|
+
exports.telemetry = TELEMETRY_ENDPOINT
|
|
12
|
+
? new reporters_1.Telemetry({
|
|
13
|
+
name: 'Shuvi.js',
|
|
14
|
+
meta: { shuviVersion: package_json_1.default.version },
|
|
15
|
+
postEndpoint: TELEMETRY_ENDPOINT
|
|
16
|
+
})
|
|
17
|
+
: undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "shuvi",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.30",
|
|
4
4
|
"description": "Full Stack Web development framework.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -30,13 +30,13 @@
|
|
|
30
30
|
"find-up": "4.1.0",
|
|
31
31
|
"semver": "7.3.2",
|
|
32
32
|
"cli-select": "1.1.2",
|
|
33
|
-
"@shuvi/platform-shared": "1.0.
|
|
34
|
-
"@shuvi/platform-web": "1.0.
|
|
35
|
-
"@shuvi/service": "1.0.
|
|
36
|
-
"@shuvi/shared": "1.0.
|
|
37
|
-
"@shuvi/toolpack": "1.0.
|
|
38
|
-
"@shuvi/utils": "1.0.
|
|
39
|
-
"@shuvi/
|
|
33
|
+
"@shuvi/platform-shared": "1.0.30",
|
|
34
|
+
"@shuvi/platform-web": "1.0.30",
|
|
35
|
+
"@shuvi/service": "1.0.30",
|
|
36
|
+
"@shuvi/shared": "1.0.30",
|
|
37
|
+
"@shuvi/toolpack": "1.0.30",
|
|
38
|
+
"@shuvi/utils": "1.0.30",
|
|
39
|
+
"@shuvi/reporters": "1.0.30",
|
|
40
40
|
"cli-highlight": "^2.1.9",
|
|
41
41
|
"commander": "10.0.0",
|
|
42
42
|
"cross-spawn": "7.0.3",
|