@rife/cli 0.0.6-beta.11 → 0.0.6-beta.12
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/cjs/cli.cjs +25 -0
- package/dist/cjs/index.cjs +110 -0
- package/dist/cjs/logger.cjs +46 -0
- package/dist/cjs/plugin/commander.cjs +66 -0
- package/dist/cjs/plugin/compiler/compiler.cjs +207 -0
- package/dist/cjs/plugin/compiler/index.cjs +126 -0
- package/dist/cjs/plugin/compiler/swc.cjs +107 -0
- package/dist/cjs/plugin/compiler/tsc.cjs +115 -0
- package/dist/cjs/plugin/config.cjs +107 -0
- package/dist/cjs/plugin/index.cjs +96 -0
- package/dist/cjs/plugin/package.cjs +71 -0
- package/dist/cjs/plugin/release.cjs +129 -0
- package/dist/cjs/runner.cjs +137 -0
- package/dist/{sync.js → cjs/sync.cjs} +12 -23
- package/dist/cjs/util.cjs +57 -0
- package/dist/{1.mjs → esm/cli.mjs} +4 -3
- package/dist/esm/index.mjs +8 -0
- package/dist/esm/logger.mjs +14 -0
- package/dist/esm/plugin/commander.mjs +34 -0
- package/dist/esm/plugin/compiler/compiler.mjs +160 -0
- package/dist/esm/plugin/compiler/index.mjs +94 -0
- package/dist/esm/plugin/compiler/swc.mjs +75 -0
- package/dist/esm/plugin/compiler/tsc.mjs +73 -0
- package/dist/esm/plugin/config.mjs +65 -0
- package/dist/esm/plugin/index.mjs +7 -0
- package/dist/{plugin/package.js → esm/plugin/package.mjs} +11 -14
- package/dist/{plugin/release.js → esm/plugin/release.mjs} +33 -38
- package/dist/esm/runner.mjs +92 -0
- package/dist/esm/sync.mjs +46 -0
- package/dist/esm/util.mjs +9 -0
- package/package.json +12 -6
- package/dist/1.js +0 -24
- package/dist/cjs/1.js +0 -24
- package/dist/cli.js +0 -22
- package/dist/cli.js.map +0 -1
- package/dist/esm/1.mjs +0 -20
- package/dist/index.js +0 -11
- package/dist/index.js.map +0 -1
- package/dist/logger.js +0 -18
- package/dist/logger.js.map +0 -1
- package/dist/plugin/commander.js +0 -47
- package/dist/plugin/commander.js.map +0 -1
- package/dist/plugin/compiler/compiler.js +0 -166
- package/dist/plugin/compiler/compiler.js.map +0 -1
- package/dist/plugin/compiler/index.js +0 -88
- package/dist/plugin/compiler/index.js.map +0 -1
- package/dist/plugin/compiler/swc.js +0 -48
- package/dist/plugin/compiler/swc.js.map +0 -1
- package/dist/plugin/compiler/swc2.js +0 -65
- package/dist/plugin/compiler/swc2.js.map +0 -1
- package/dist/plugin/compiler/tsc.js +0 -75
- package/dist/plugin/compiler/tsc.js.map +0 -1
- package/dist/plugin/config.js +0 -77
- package/dist/plugin/config.js.map +0 -1
- package/dist/plugin/index.js +0 -9
- package/dist/plugin/index.js.map +0 -1
- package/dist/plugin/package copy.js +0 -32
- package/dist/plugin/package copy.js.map +0 -1
- package/dist/plugin/package.js.map +0 -1
- package/dist/plugin/release.js.map +0 -1
- package/dist/runner.js +0 -81
- package/dist/runner.js.map +0 -1
- package/dist/sync.js.map +0 -1
- package/dist/tsconfig.tsbuildinfo +0 -1
- package/dist/util.js +0 -14
- package/dist/util.js.map +0 -1
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_modules__ = {
|
|
3
|
+
"@swc/cli": function(module) {
|
|
4
|
+
module.exports = require("@swc/cli");
|
|
5
|
+
}
|
|
6
|
+
};
|
|
7
|
+
var __webpack_module_cache__ = {};
|
|
8
|
+
function __webpack_require__(moduleId) {
|
|
9
|
+
var cachedModule = __webpack_module_cache__[moduleId];
|
|
10
|
+
if (void 0 !== cachedModule) return cachedModule.exports;
|
|
11
|
+
var module = __webpack_module_cache__[moduleId] = {
|
|
12
|
+
exports: {}
|
|
13
|
+
};
|
|
14
|
+
__webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
|
15
|
+
return module.exports;
|
|
16
|
+
}
|
|
17
|
+
(()=>{
|
|
18
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
19
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
20
|
+
enumerable: true,
|
|
21
|
+
get: definition[key]
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
})();
|
|
25
|
+
(()=>{
|
|
26
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
27
|
+
})();
|
|
28
|
+
(()=>{
|
|
29
|
+
__webpack_require__.r = (exports1)=>{
|
|
30
|
+
if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
31
|
+
value: 'Module'
|
|
32
|
+
});
|
|
33
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
34
|
+
value: true
|
|
35
|
+
});
|
|
36
|
+
};
|
|
37
|
+
})();
|
|
38
|
+
var __webpack_exports__ = {};
|
|
39
|
+
(()=>{
|
|
40
|
+
__webpack_require__.r(__webpack_exports__);
|
|
41
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
42
|
+
swc: ()=>swc
|
|
43
|
+
});
|
|
44
|
+
async function swc(options) {
|
|
45
|
+
const { watch = false, outDir } = options;
|
|
46
|
+
const { swcDir } = __webpack_require__("@swc/cli");
|
|
47
|
+
const swcOptions = {
|
|
48
|
+
jsc: {
|
|
49
|
+
parser: {
|
|
50
|
+
syntax: "typescript"
|
|
51
|
+
},
|
|
52
|
+
target: 'esnext',
|
|
53
|
+
externalHelpers: true
|
|
54
|
+
},
|
|
55
|
+
module: {
|
|
56
|
+
type: 'commonjs',
|
|
57
|
+
ignoreDynamic: true
|
|
58
|
+
},
|
|
59
|
+
sourceMaps: true
|
|
60
|
+
};
|
|
61
|
+
let first = true;
|
|
62
|
+
await swcDir({
|
|
63
|
+
cliOptions: {
|
|
64
|
+
outDir,
|
|
65
|
+
watch,
|
|
66
|
+
filenames: [
|
|
67
|
+
'./src'
|
|
68
|
+
],
|
|
69
|
+
extensions: [
|
|
70
|
+
'.ts',
|
|
71
|
+
'.tsx',
|
|
72
|
+
'.js',
|
|
73
|
+
'.jsx'
|
|
74
|
+
],
|
|
75
|
+
stripLeadingPaths: true,
|
|
76
|
+
copyFiles: true
|
|
77
|
+
},
|
|
78
|
+
swcOptions,
|
|
79
|
+
callbacks: {
|
|
80
|
+
onSuccess: ({ duration })=>{
|
|
81
|
+
options?.onSuccess?.({
|
|
82
|
+
watch,
|
|
83
|
+
first,
|
|
84
|
+
duration
|
|
85
|
+
});
|
|
86
|
+
first = false;
|
|
87
|
+
},
|
|
88
|
+
onFail: (e)=>{
|
|
89
|
+
options?.onFail?.({
|
|
90
|
+
...e,
|
|
91
|
+
watch,
|
|
92
|
+
first
|
|
93
|
+
});
|
|
94
|
+
first = false;
|
|
95
|
+
},
|
|
96
|
+
onWatchReady: ()=>{}
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
})();
|
|
101
|
+
exports.swc = __webpack_exports__.swc;
|
|
102
|
+
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
103
|
+
"swc"
|
|
104
|
+
].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
105
|
+
Object.defineProperty(exports, '__esModule', {
|
|
106
|
+
value: true
|
|
107
|
+
});
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_modules__ = {
|
|
3
|
+
typescript: function(module) {
|
|
4
|
+
module.exports = require("typescript");
|
|
5
|
+
}
|
|
6
|
+
};
|
|
7
|
+
var __webpack_module_cache__ = {};
|
|
8
|
+
function __webpack_require__(moduleId) {
|
|
9
|
+
var cachedModule = __webpack_module_cache__[moduleId];
|
|
10
|
+
if (void 0 !== cachedModule) return cachedModule.exports;
|
|
11
|
+
var module = __webpack_module_cache__[moduleId] = {
|
|
12
|
+
exports: {}
|
|
13
|
+
};
|
|
14
|
+
__webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
|
15
|
+
return module.exports;
|
|
16
|
+
}
|
|
17
|
+
(()=>{
|
|
18
|
+
__webpack_require__.n = (module)=>{
|
|
19
|
+
var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
|
|
20
|
+
__webpack_require__.d(getter, {
|
|
21
|
+
a: getter
|
|
22
|
+
});
|
|
23
|
+
return getter;
|
|
24
|
+
};
|
|
25
|
+
})();
|
|
26
|
+
(()=>{
|
|
27
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
28
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
29
|
+
enumerable: true,
|
|
30
|
+
get: definition[key]
|
|
31
|
+
});
|
|
32
|
+
};
|
|
33
|
+
})();
|
|
34
|
+
(()=>{
|
|
35
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
36
|
+
})();
|
|
37
|
+
(()=>{
|
|
38
|
+
__webpack_require__.r = (exports1)=>{
|
|
39
|
+
if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
40
|
+
value: 'Module'
|
|
41
|
+
});
|
|
42
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
43
|
+
value: true
|
|
44
|
+
});
|
|
45
|
+
};
|
|
46
|
+
})();
|
|
47
|
+
var __webpack_exports__ = {};
|
|
48
|
+
(()=>{
|
|
49
|
+
__webpack_require__.r(__webpack_exports__);
|
|
50
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
51
|
+
tsc: ()=>tsc
|
|
52
|
+
});
|
|
53
|
+
const external_path_namespaceObject = require("path");
|
|
54
|
+
var external_path_default = /*#__PURE__*/ __webpack_require__.n(external_path_namespaceObject);
|
|
55
|
+
function tsc(config) {
|
|
56
|
+
const ts = __webpack_require__("typescript");
|
|
57
|
+
const rootDir = config.rootDir || '.';
|
|
58
|
+
const formatHost = {
|
|
59
|
+
getCanonicalFileName: (path)=>path,
|
|
60
|
+
getCurrentDirectory: ts.sys.getCurrentDirectory,
|
|
61
|
+
getNewLine: ()=>ts.sys.newLine
|
|
62
|
+
};
|
|
63
|
+
function reportDiagnostic(diagnostic) {
|
|
64
|
+
config.onReportDiagnostic?.({
|
|
65
|
+
diagnostic
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
function reportWatchStatusChanged(diagnostic) {
|
|
69
|
+
const message = `${ts.formatDiagnostic(diagnostic, formatHost)}`.trimEnd();
|
|
70
|
+
let status = '';
|
|
71
|
+
if (message.includes('message TS6031: Starting compilation in watch mode')) status = 'startWatch';
|
|
72
|
+
else if (message.includes('message TS6032: File change detected')) status = 'reCompile';
|
|
73
|
+
else if (message.includes('Found 0 errors')) status = 'success';
|
|
74
|
+
else if (/Found \d+ error/.test(message)) status = 'error';
|
|
75
|
+
config.onWatchStatusChanged?.({
|
|
76
|
+
status,
|
|
77
|
+
message
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
const configPath = ts.findConfigFile(rootDir, ts.sys.fileExists, 'tsconfig.json');
|
|
81
|
+
if (!configPath) throw new Error("\u627E\u4E0D\u5230tsconfig.json");
|
|
82
|
+
const createProgram = ts.createSemanticDiagnosticsBuilderProgram;
|
|
83
|
+
if (config.watch) {
|
|
84
|
+
const host = ts.createWatchCompilerHost(configPath, {
|
|
85
|
+
...config.options,
|
|
86
|
+
outDir: config.outDir,
|
|
87
|
+
noEmit: false,
|
|
88
|
+
incremental: true
|
|
89
|
+
}, ts.sys, createProgram, reportDiagnostic, reportWatchStatusChanged);
|
|
90
|
+
ts.createWatchProgram(host);
|
|
91
|
+
} else {
|
|
92
|
+
const configFile = ts.readConfigFile(configPath, ts.sys.readFile);
|
|
93
|
+
const compilerOptions = ts.parseJsonConfigFileContent(configFile.config, ts.sys, external_path_default().dirname(configPath), {
|
|
94
|
+
...config.options,
|
|
95
|
+
outDir: config.outDir,
|
|
96
|
+
noEmit: false,
|
|
97
|
+
incremental: false
|
|
98
|
+
});
|
|
99
|
+
const host = ts.createCompilerHost(compilerOptions.options);
|
|
100
|
+
const program = ts.createProgram(compilerOptions.fileNames, compilerOptions.options, host);
|
|
101
|
+
const emitResult = program.emit();
|
|
102
|
+
const diagnostics = ts.getPreEmitDiagnostics(program).concat(emitResult.diagnostics);
|
|
103
|
+
config.onEmitDiagnostics?.({
|
|
104
|
+
diagnostics
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
})();
|
|
109
|
+
exports.tsc = __webpack_exports__.tsc;
|
|
110
|
+
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
111
|
+
"tsc"
|
|
112
|
+
].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
113
|
+
Object.defineProperty(exports, '__esModule', {
|
|
114
|
+
value: true
|
|
115
|
+
});
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.n = (module)=>{
|
|
5
|
+
var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
|
|
6
|
+
__webpack_require__.d(getter, {
|
|
7
|
+
a: getter
|
|
8
|
+
});
|
|
9
|
+
return getter;
|
|
10
|
+
};
|
|
11
|
+
})();
|
|
12
|
+
(()=>{
|
|
13
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
14
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
15
|
+
enumerable: true,
|
|
16
|
+
get: definition[key]
|
|
17
|
+
});
|
|
18
|
+
};
|
|
19
|
+
})();
|
|
20
|
+
(()=>{
|
|
21
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
22
|
+
})();
|
|
23
|
+
(()=>{
|
|
24
|
+
__webpack_require__.r = (exports1)=>{
|
|
25
|
+
if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
26
|
+
value: 'Module'
|
|
27
|
+
});
|
|
28
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
29
|
+
value: true
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
})();
|
|
33
|
+
var __webpack_exports__ = {};
|
|
34
|
+
__webpack_require__.r(__webpack_exports__);
|
|
35
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
36
|
+
pluginConfig: ()=>pluginConfig
|
|
37
|
+
});
|
|
38
|
+
const external_path_namespaceObject = require("path");
|
|
39
|
+
var external_path_default = /*#__PURE__*/ __webpack_require__.n(external_path_namespaceObject);
|
|
40
|
+
function pluginConfig() {
|
|
41
|
+
const plugin = {
|
|
42
|
+
name: pluginConfig.name,
|
|
43
|
+
apply: (runner)=>{
|
|
44
|
+
const { logger, hook, config, command, fs, z } = runner;
|
|
45
|
+
const log = logger.withTag(pluginConfig.name);
|
|
46
|
+
hook.loadConfig.tapPromise(pluginConfig.name, async ()=>{
|
|
47
|
+
let filePath = '';
|
|
48
|
+
const mjs = 'app.mjs';
|
|
49
|
+
const fileNames = [
|
|
50
|
+
'app.js',
|
|
51
|
+
'app.cjs',
|
|
52
|
+
mjs
|
|
53
|
+
];
|
|
54
|
+
let isEsm = false;
|
|
55
|
+
for (const fileName of fileNames)if (await fs.exists(fileName)) {
|
|
56
|
+
filePath = external_path_default().posix.resolve(fileName);
|
|
57
|
+
isEsm = fileName === mjs;
|
|
58
|
+
break;
|
|
59
|
+
}
|
|
60
|
+
log.debug("filePath %s", filePath);
|
|
61
|
+
if (!filePath) {
|
|
62
|
+
log.error(`\u{627E}\u{4E0D}\u{5230}\u{914D}\u{7F6E}\u{6587}\u{4EF6} app.(c|m)?js`);
|
|
63
|
+
process.exit(1);
|
|
64
|
+
}
|
|
65
|
+
let all = [];
|
|
66
|
+
all = isEsm ? (await import(filePath)).default : require(filePath);
|
|
67
|
+
runner.config.all = all;
|
|
68
|
+
});
|
|
69
|
+
hook.validateConfig.tapPromise(pluginConfig.name, async ()=>{
|
|
70
|
+
const validation = z.array(z.object({
|
|
71
|
+
name: z.string().trim().min(1)
|
|
72
|
+
})).min(1).safeParse(config.all);
|
|
73
|
+
if (!validation.success) {
|
|
74
|
+
log.error(validation.error.message);
|
|
75
|
+
process.exit(1);
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
hook.applyConfig.tapPromise(pluginConfig.name, async ()=>{
|
|
79
|
+
const result = z.object({
|
|
80
|
+
name: z.string().trim().default('')
|
|
81
|
+
}).default({}).safeParse(command.opts());
|
|
82
|
+
const name = result.data?.name;
|
|
83
|
+
if (name) {
|
|
84
|
+
log.debug(`\u{6307}\u{5B9A} --name ${name}`);
|
|
85
|
+
const find = config.all.find((t)=>t.name === name);
|
|
86
|
+
if (!find) {
|
|
87
|
+
log.error(`\u{672A}\u{627E}\u{5230} name '%s'`, name);
|
|
88
|
+
process.exit(1);
|
|
89
|
+
}
|
|
90
|
+
config.current = find;
|
|
91
|
+
} else {
|
|
92
|
+
log.debug("\u6CA1\u6709\u6307\u5B9A --name\uFF0C\u9ED8\u8BA4\u4F7F\u7528\u5217\u8868\u7B2C\u4E00\u4E2A");
|
|
93
|
+
config.current = config.all[0];
|
|
94
|
+
}
|
|
95
|
+
config.current.plugins.forEach((plugin)=>plugin.apply(runner));
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
return plugin;
|
|
100
|
+
}
|
|
101
|
+
exports.pluginConfig = __webpack_exports__.pluginConfig;
|
|
102
|
+
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
103
|
+
"pluginConfig"
|
|
104
|
+
].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
105
|
+
Object.defineProperty(exports, '__esModule', {
|
|
106
|
+
value: true
|
|
107
|
+
});
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_modules__ = {
|
|
3
|
+
"./commander": function(module) {
|
|
4
|
+
module.exports = require("./commander.cjs");
|
|
5
|
+
},
|
|
6
|
+
"./compiler": function(module) {
|
|
7
|
+
module.exports = require("./compiler/index.cjs");
|
|
8
|
+
},
|
|
9
|
+
"./config": function(module) {
|
|
10
|
+
module.exports = require("./config.cjs");
|
|
11
|
+
},
|
|
12
|
+
"./package": function(module) {
|
|
13
|
+
module.exports = require("./package.cjs");
|
|
14
|
+
},
|
|
15
|
+
"./release": function(module) {
|
|
16
|
+
module.exports = require("./release.cjs");
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
var __webpack_module_cache__ = {};
|
|
20
|
+
function __webpack_require__(moduleId) {
|
|
21
|
+
var cachedModule = __webpack_module_cache__[moduleId];
|
|
22
|
+
if (void 0 !== cachedModule) return cachedModule.exports;
|
|
23
|
+
var module = __webpack_module_cache__[moduleId] = {
|
|
24
|
+
exports: {}
|
|
25
|
+
};
|
|
26
|
+
__webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
|
27
|
+
return module.exports;
|
|
28
|
+
}
|
|
29
|
+
(()=>{
|
|
30
|
+
__webpack_require__.n = (module)=>{
|
|
31
|
+
var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
|
|
32
|
+
__webpack_require__.d(getter, {
|
|
33
|
+
a: getter
|
|
34
|
+
});
|
|
35
|
+
return getter;
|
|
36
|
+
};
|
|
37
|
+
})();
|
|
38
|
+
(()=>{
|
|
39
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
40
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
41
|
+
enumerable: true,
|
|
42
|
+
get: definition[key]
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
})();
|
|
46
|
+
(()=>{
|
|
47
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
48
|
+
})();
|
|
49
|
+
(()=>{
|
|
50
|
+
__webpack_require__.r = (exports1)=>{
|
|
51
|
+
if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
52
|
+
value: 'Module'
|
|
53
|
+
});
|
|
54
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
55
|
+
value: true
|
|
56
|
+
});
|
|
57
|
+
};
|
|
58
|
+
})();
|
|
59
|
+
var __webpack_exports__ = {};
|
|
60
|
+
(()=>{
|
|
61
|
+
__webpack_require__.r(__webpack_exports__);
|
|
62
|
+
var _config__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("./config");
|
|
63
|
+
var __WEBPACK_REEXPORT_OBJECT__ = {};
|
|
64
|
+
for(var __WEBPACK_IMPORT_KEY__ in _config__WEBPACK_IMPORTED_MODULE_0__)if ("default" !== __WEBPACK_IMPORT_KEY__) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = (function(key) {
|
|
65
|
+
return _config__WEBPACK_IMPORTED_MODULE_0__[key];
|
|
66
|
+
}).bind(0, __WEBPACK_IMPORT_KEY__);
|
|
67
|
+
__webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__);
|
|
68
|
+
var _package__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("./package");
|
|
69
|
+
var __WEBPACK_REEXPORT_OBJECT__ = {};
|
|
70
|
+
for(var __WEBPACK_IMPORT_KEY__ in _package__WEBPACK_IMPORTED_MODULE_1__)if ("default" !== __WEBPACK_IMPORT_KEY__) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = (function(key) {
|
|
71
|
+
return _package__WEBPACK_IMPORTED_MODULE_1__[key];
|
|
72
|
+
}).bind(0, __WEBPACK_IMPORT_KEY__);
|
|
73
|
+
__webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__);
|
|
74
|
+
var _commander__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("./commander");
|
|
75
|
+
var __WEBPACK_REEXPORT_OBJECT__ = {};
|
|
76
|
+
for(var __WEBPACK_IMPORT_KEY__ in _commander__WEBPACK_IMPORTED_MODULE_2__)if ("default" !== __WEBPACK_IMPORT_KEY__) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = (function(key) {
|
|
77
|
+
return _commander__WEBPACK_IMPORTED_MODULE_2__[key];
|
|
78
|
+
}).bind(0, __WEBPACK_IMPORT_KEY__);
|
|
79
|
+
__webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__);
|
|
80
|
+
var _compiler__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("./compiler");
|
|
81
|
+
var __WEBPACK_REEXPORT_OBJECT__ = {};
|
|
82
|
+
for(var __WEBPACK_IMPORT_KEY__ in _compiler__WEBPACK_IMPORTED_MODULE_3__)if ("default" !== __WEBPACK_IMPORT_KEY__) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = (function(key) {
|
|
83
|
+
return _compiler__WEBPACK_IMPORTED_MODULE_3__[key];
|
|
84
|
+
}).bind(0, __WEBPACK_IMPORT_KEY__);
|
|
85
|
+
__webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__);
|
|
86
|
+
var _release__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__("./release");
|
|
87
|
+
var __WEBPACK_REEXPORT_OBJECT__ = {};
|
|
88
|
+
for(var __WEBPACK_IMPORT_KEY__ in _release__WEBPACK_IMPORTED_MODULE_4__)if ("default" !== __WEBPACK_IMPORT_KEY__) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = (function(key) {
|
|
89
|
+
return _release__WEBPACK_IMPORTED_MODULE_4__[key];
|
|
90
|
+
}).bind(0, __WEBPACK_IMPORT_KEY__);
|
|
91
|
+
__webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__);
|
|
92
|
+
})();
|
|
93
|
+
for(var __webpack_i__ in __webpack_exports__)exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
94
|
+
Object.defineProperty(exports, '__esModule', {
|
|
95
|
+
value: true
|
|
96
|
+
});
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.n = (module)=>{
|
|
5
|
+
var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
|
|
6
|
+
__webpack_require__.d(getter, {
|
|
7
|
+
a: getter
|
|
8
|
+
});
|
|
9
|
+
return getter;
|
|
10
|
+
};
|
|
11
|
+
})();
|
|
12
|
+
(()=>{
|
|
13
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
14
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
15
|
+
enumerable: true,
|
|
16
|
+
get: definition[key]
|
|
17
|
+
});
|
|
18
|
+
};
|
|
19
|
+
})();
|
|
20
|
+
(()=>{
|
|
21
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
22
|
+
})();
|
|
23
|
+
(()=>{
|
|
24
|
+
__webpack_require__.r = (exports1)=>{
|
|
25
|
+
if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
26
|
+
value: 'Module'
|
|
27
|
+
});
|
|
28
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
29
|
+
value: true
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
})();
|
|
33
|
+
var __webpack_exports__ = {};
|
|
34
|
+
__webpack_require__.r(__webpack_exports__);
|
|
35
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
36
|
+
pluginPackage: ()=>pluginPackage
|
|
37
|
+
});
|
|
38
|
+
const external_path_namespaceObject = require("path");
|
|
39
|
+
var external_path_default = /*#__PURE__*/ __webpack_require__.n(external_path_namespaceObject);
|
|
40
|
+
function pluginPackage() {
|
|
41
|
+
const plugin = {
|
|
42
|
+
name: pluginPackage.name,
|
|
43
|
+
apply: (runner)=>{
|
|
44
|
+
const { logger, hook, fs } = runner;
|
|
45
|
+
const log = logger.withTag(pluginPackage.name);
|
|
46
|
+
hook.loadPackage.tapPromise(pluginPackage.name, async ()=>{
|
|
47
|
+
const fileName = 'package.json';
|
|
48
|
+
const filePath = external_path_default().resolve(fileName);
|
|
49
|
+
if (!fs.existsSync(filePath)) {
|
|
50
|
+
log.error(`\u{627E}\u{4E0D}\u{5230}\u{6587}\u{4EF6} ${fileName}`);
|
|
51
|
+
process.exit(1);
|
|
52
|
+
}
|
|
53
|
+
try {
|
|
54
|
+
const data = require(filePath);
|
|
55
|
+
runner.package = data;
|
|
56
|
+
} catch (e) {
|
|
57
|
+
log.error(`\u{8BFB}\u{53D6}\u{6587}\u{4EF6}\u{5931}\u{8D25}`, e.message);
|
|
58
|
+
process.exit(1);
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
return plugin;
|
|
64
|
+
}
|
|
65
|
+
exports.pluginPackage = __webpack_exports__.pluginPackage;
|
|
66
|
+
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
67
|
+
"pluginPackage"
|
|
68
|
+
].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
69
|
+
Object.defineProperty(exports, '__esModule', {
|
|
70
|
+
value: true
|
|
71
|
+
});
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
5
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: definition[key]
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
})();
|
|
11
|
+
(()=>{
|
|
12
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
+
})();
|
|
14
|
+
(()=>{
|
|
15
|
+
__webpack_require__.r = (exports1)=>{
|
|
16
|
+
if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
+
value: 'Module'
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
+
value: true
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
var __webpack_exports__ = {};
|
|
25
|
+
__webpack_require__.r(__webpack_exports__);
|
|
26
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
pluginRelease: ()=>pluginRelease
|
|
28
|
+
});
|
|
29
|
+
const external_child_process_namespaceObject = require("child_process");
|
|
30
|
+
function pluginRelease() {
|
|
31
|
+
const plugin = {
|
|
32
|
+
name: pluginRelease.name,
|
|
33
|
+
apply: (runner)=>{
|
|
34
|
+
const { logger, hook, fs } = runner;
|
|
35
|
+
const log = logger.withTag(pluginRelease.name);
|
|
36
|
+
hook.release.tapPromise(pluginRelease.name, async ()=>{
|
|
37
|
+
runner.clear();
|
|
38
|
+
await hook.build.promise();
|
|
39
|
+
log.start("\u5F00\u59CB\u53D1\u5E03");
|
|
40
|
+
const packageVersion = runner.package.version;
|
|
41
|
+
const packageName = runner.package.name;
|
|
42
|
+
const url = `https://registry.npmjs.org/${packageName}`;
|
|
43
|
+
let nextVersion = packageVersion;
|
|
44
|
+
log.debug(`\u{67E5}\u{8BE2}\u{7248}\u{672C}\u{53F7} ${packageVersion} \u{662F}\u{5426}\u{5B58}\u{5728}`);
|
|
45
|
+
const res = await (await fetch(url)).json();
|
|
46
|
+
const exist = res?.versions?.[packageVersion];
|
|
47
|
+
if (exist) {
|
|
48
|
+
const split = packageVersion.split('.');
|
|
49
|
+
split[split.length - 1] = Number(split[split.length - 1]) + 1;
|
|
50
|
+
nextVersion = split.join('.');
|
|
51
|
+
log.debug(`\u{7248}\u{672C}\u{53F7} ${packageVersion} \u{5B58}\u{5728}\u{FF0C}\u{66F4}\u{65B0}\u{7248}\u{672C}\u{53F7}\u{4E3A} ${nextVersion}`);
|
|
52
|
+
const text = fs.readFileSync('./package.json').toString();
|
|
53
|
+
const nextText = text.replace(new RegExp(`"version":\\s*"${packageVersion}"`), `"version": "${nextVersion}"`);
|
|
54
|
+
fs.writeFileSync('./package.json', nextText);
|
|
55
|
+
}
|
|
56
|
+
log.debug(`\u{7248}\u{672C}\u{53F7} ${packageVersion} \u{4E0D}\u{5B58}\u{5728}`);
|
|
57
|
+
log.info(`\u{7248}\u{672C}\u{53F7}\u{4E3A} ${nextVersion}`);
|
|
58
|
+
const tempDir = "./node_modules/.rife/release/";
|
|
59
|
+
log.info(`\u{6E05}\u{7A7A}\u{76EE}\u{5F55} ${tempDir}`);
|
|
60
|
+
fs.emptyDirSync(tempDir);
|
|
61
|
+
const pack = `pnpm pack --pack-destination ${tempDir} --json`;
|
|
62
|
+
log.info(`\u{6253}\u{5305}\u{6587}\u{4EF6} ${pack}`);
|
|
63
|
+
const packOutput = JSON.parse((0, external_child_process_namespaceObject.execSync)(pack).toString());
|
|
64
|
+
const filename = packOutput.filename;
|
|
65
|
+
for (const item of packOutput.files)log.debug(item.path);
|
|
66
|
+
const debug = false;
|
|
67
|
+
const publish = `pnpm publish ${filename} --registry https://registry.npmjs.org --no-git-checks ${debug ? '--dry-run' : ''}`;
|
|
68
|
+
log.info(`\u{53D1}\u{5E03}\u{6587}\u{4EF6} ${publish}`);
|
|
69
|
+
(0, external_child_process_namespaceObject.execSync)(publish, {
|
|
70
|
+
stdio: 'inherit'
|
|
71
|
+
});
|
|
72
|
+
log.success(`\u{53D1}\u{5E03}\u{6210}\u{529F}\u{FF0C}${runner.duration}`);
|
|
73
|
+
log.info("\u540C\u6B65\u7248\u672C");
|
|
74
|
+
let hasSync = false;
|
|
75
|
+
while(true){
|
|
76
|
+
const res = await queryVersion(packageName);
|
|
77
|
+
const nextManifest = res?.versions?.[nextVersion];
|
|
78
|
+
const exist = Boolean(nextManifest);
|
|
79
|
+
const latest = res?.['dist-tags']?.latest;
|
|
80
|
+
if (exist) {
|
|
81
|
+
log.debug(`\u{540C}\u{6B65}\u{7248}\u{672C}\u{5B58}\u{5728}`);
|
|
82
|
+
break;
|
|
83
|
+
}
|
|
84
|
+
log.info(`\u{68C0}\u{67E5}\u{7248}\u{672C} ${nextVersion} \u{4E0D}\u{5B58}\u{5728}\u{FF0C}\u{6700}\u{65B0}\u{7248}\u{672C}\u{4E3A} ${latest}`);
|
|
85
|
+
if (!hasSync) {
|
|
86
|
+
hasSync = true;
|
|
87
|
+
log.start(`\u{5F00}\u{59CB}\u{540C}\u{6B65}`);
|
|
88
|
+
const sync = await syncVersion(packageName);
|
|
89
|
+
if (true === sync.ok) log.info(`\u{8C03}\u{7528}\u{540C}\u{6B65}\u{63A5}\u{53E3}\u{6210}\u{529F}\u{FF0C}\u{65E5}\u{5FD7} https://registry.npmmirror.com/-/package/${packageName}/syncs/${sync.id}/log`);
|
|
90
|
+
else log.debug(`\u{8C03}\u{7528}\u{540C}\u{6B65}\u{63A5}\u{53E3}\u{5931}\u{8D25}\u{FF0C}%j`, sync);
|
|
91
|
+
}
|
|
92
|
+
await new Promise((resolve)=>setTimeout(resolve, 2000));
|
|
93
|
+
}
|
|
94
|
+
log.success(`\u{540C}\u{6B65}\u{6210}\u{529F}\u{FF0C}${runner.duration}`);
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
return plugin;
|
|
99
|
+
}
|
|
100
|
+
async function queryVersion(packageName) {
|
|
101
|
+
const res = await (await fetch(`https://registry.npmmirror.com/${packageName}?t=${Math.random()}`)).json();
|
|
102
|
+
return res;
|
|
103
|
+
}
|
|
104
|
+
async function syncVersion(packageName) {
|
|
105
|
+
const sync = await (await fetch(`https://registry-direct.npmmirror.com/-/package/${packageName}/syncs`, {
|
|
106
|
+
headers: {
|
|
107
|
+
accept: '*/*',
|
|
108
|
+
'accept-language': 'zh-CN,zh;q=0.9,en;q=0.8',
|
|
109
|
+
'sec-ch-ua': '"Not_A Brand";v="8", "Chromium";v="120", "Google Chrome";v="120"',
|
|
110
|
+
'sec-ch-ua-mobile': '?0',
|
|
111
|
+
'sec-ch-ua-platform': '"Windows"',
|
|
112
|
+
'sec-fetch-dest': 'empty',
|
|
113
|
+
'sec-fetch-mode': 'cors',
|
|
114
|
+
'sec-fetch-site': 'same-site',
|
|
115
|
+
Referer: 'https://npmmirror.com/',
|
|
116
|
+
'Referrer-Policy': 'strict-origin-when-cross-origin'
|
|
117
|
+
},
|
|
118
|
+
body: null,
|
|
119
|
+
method: 'PUT'
|
|
120
|
+
})).json();
|
|
121
|
+
return sync;
|
|
122
|
+
}
|
|
123
|
+
exports.pluginRelease = __webpack_exports__.pluginRelease;
|
|
124
|
+
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
125
|
+
"pluginRelease"
|
|
126
|
+
].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
127
|
+
Object.defineProperty(exports, '__esModule', {
|
|
128
|
+
value: true
|
|
129
|
+
});
|