mist-tiny-cli
Advanced tools
| "use strict"; | ||
| exports.__esModule = true; | ||
| exports["default"] = { | ||
| "out": ".build", | ||
| "port": 15555 | ||
| }; |
+0
-10
@@ -81,11 +81,1 @@ "use strict"; | ||
| exports["default"] = default_1; | ||
| // const func = require('/Users/Sleen/dev/alipay/kbapp/appx-web-cli/node_modules/_@alipay_appx-compiler@0.35.4@@alipay/appx-compiler/lib/index.js') | ||
| // func({ | ||
| // templateExtname: '.axml', | ||
| // styleExtname: '.acss', | ||
| // // importScripts, | ||
| // // injectScript, | ||
| // // indexPage = 'index.html', | ||
| // src: '/Users/Sleen/dev/alipay/kbapp/test/src', | ||
| // out: '/Users/Sleen/dev/alipay/kbapp/test/mist-out' | ||
| // }); |
@@ -43,3 +43,3 @@ "use strict"; | ||
| return __awaiter(this, void 0, void 0, function () { | ||
| var appJsPath, appJs, resultFunctions, pages, ret, templates; | ||
| var appJsPath, appJs, resultFunctions, pages; | ||
| return __generator(this, function (_a) { | ||
@@ -55,5 +55,3 @@ switch (_a.label) { | ||
| pages = appConfig.pages; | ||
| ret = {}; | ||
| if (pages && pages.length > 0) { | ||
| templates = {}; | ||
| pages.forEach(function (p) { | ||
@@ -64,3 +62,2 @@ var pageJsPath = path.join(src, p + ".js"); | ||
| }); | ||
| ret.templates = templates; | ||
| } | ||
@@ -67,0 +64,0 @@ return [2 /*return*/, "registerApp(" + resultFunctions.join(',') + ")"]; |
@@ -331,3 +331,3 @@ "use strict"; | ||
| if (LENGTH_KEYS.indexOf(key) >= 0) { | ||
| // TODO | ||
| newValue = convertHtmlLengthUnit(newValue); | ||
| } | ||
@@ -338,2 +338,19 @@ newStyles[newKey] = newValue; | ||
| } | ||
| function convertHtmlLengthUnit(value) { | ||
| var convert = function (v) { | ||
| var match = v.match(/^([.0-9]+)(.*)$/); | ||
| if (match) { | ||
| var num = parseFloat(match[1]); | ||
| var suffix = match[2]; | ||
| if (suffix === 'px') { | ||
| return num; | ||
| } | ||
| } | ||
| return v; | ||
| }; | ||
| if (value.includes(' ')) { | ||
| return value.split(' ').map(convert).join(' '); | ||
| } | ||
| return convert(value); | ||
| } | ||
| function transformSelectorNames(stylesMap) { | ||
@@ -340,0 +357,0 @@ var result = {}; |
| #!/usr/bin/env node | ||
| "use strict"; | ||
| exports.__esModule = true; | ||
| var path = require("path"); | ||
| var program = require("commander"); | ||
| var generate_1 = require("./generate"); | ||
| var program = require("commander"); | ||
| var config_1 = require("./config"); | ||
| var cwd = process.cwd(); | ||
| program.option('--out [path]', 'specify the output path') | ||
| .parse(process.argv); | ||
| var out = program['out'] || 'out'; | ||
| var out = path.resolve(cwd, program['out'] || config_1["default"].out); | ||
| generate_1["default"]({ | ||
| src: cwd, | ||
| out: out | ||
| }).then(function () { | ||
| console.log("compiled success! output path: " + out); | ||
| }); |
@@ -47,2 +47,3 @@ #!/usr/bin/env node | ||
| var opn = require("opn"); | ||
| var config_1 = require("./config"); | ||
| var util_1 = require("./util"); | ||
@@ -52,6 +53,8 @@ var cwd = process.cwd(); | ||
| .option('--engine [file]', 'specify the tinyjs engine file') | ||
| .option('--port [port]', 'specify the server port') | ||
| .option('--noqr', 'do not show qrcode in browser') | ||
| .parse(process.argv); | ||
| var out = program['out'] || path.join(cwd, 'out'); | ||
| var out = path.resolve(cwd, program['out'] || config_1["default"].out); | ||
| var enginePath = program['engine']; | ||
| var defaultPort = program['port'] || config_1["default"].port; | ||
| var noqr = program['noqr']; | ||
@@ -103,3 +106,3 @@ function bundle() { | ||
| var _this = this; | ||
| var html, httpServer, defaultPort, maxRetryCount, ip, listen, port, url, scheme, _a; | ||
| var html, httpServer, maxRetryCount, ip, listen, port, url, scheme, _a; | ||
| return __generator(this, function (_b) { | ||
@@ -119,6 +122,6 @@ switch (_b.label) { | ||
| if (request.url === '/tiny.js') { | ||
| file = enginePath; | ||
| file = path.resolve(cwd, enginePath); | ||
| } | ||
| else { | ||
| file = path.join(out, (request.url || '').replace(/^\//, '')); | ||
| file = path.join(out, request.url || ''); | ||
| } | ||
@@ -139,3 +142,2 @@ try { | ||
| }); }); | ||
| defaultPort = 15555; | ||
| maxRetryCount = 10; | ||
@@ -142,0 +144,0 @@ ip = util_1.getLocalIp() || 'localhost'; |
+1
-1
| { | ||
| "name": "mist-tiny-cli", | ||
| "version": "0.1.1", | ||
| "version": "0.1.2", | ||
| "description": "A CLI tool for Mist Tiny Apps", | ||
@@ -5,0 +5,0 @@ "bin": { |
39284
0.86%12
9.09%901
1.81%