miniprogram-ci 2.1.14 → 2.1.16
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/CHANGELOG.md +7 -2
- package/README.md +4 -0
- package/dist/@types/ci/cloud/cloudapi.d.ts +1 -1
- package/dist/@types/ci/cloud/utils.d.ts +0 -1
- package/dist/@types/ci/cos-upload.d.ts +1 -0
- package/dist/@types/ci/gamepkg/apkplug.d.ts +19 -0
- package/dist/@types/ci/gamepkg/index.d.ts +19 -0
- package/dist/@types/ci/getCompiledResult.d.ts +0 -1
- package/dist/@types/ci/index.d.ts +3 -0
- package/dist/@types/ci/jsserver.d.ts +0 -1
- package/dist/@types/ci/miniapp/upload.d.ts +0 -1
- package/dist/@types/ci/upload.d.ts +0 -1
- package/dist/@types/ci/utils/unpack.d.ts +0 -1
- package/dist/@types/ci/utils/wxvpkg/utils.d.ts +0 -1
- package/dist/@types/config/config.d.ts +1 -1
- package/dist/@types/config/url.config.d.ts +7 -0
- package/dist/@types/index.d.ts +15 -12
- package/dist/@types/modules/corecompiler/original/compile/game.d.ts +0 -1
- package/dist/@types/modules/corecompiler/original/compile/index.d.ts +0 -1
- package/dist/@types/modules/corecompiler/original/index.d.ts +0 -1
- package/dist/@types/modules/corecompiler/original/utils/env.d.ts +1 -1
- package/dist/@types/modules/corecompiler/original/webWorker/WebWorkerInstance.d.ts +1 -0
- package/dist/@types/modules/corecompiler/original/webWorker/childWebWorker.d.ts +1 -0
- package/dist/@types/modules/corecompiler/original/webWorker/configs.d.ts +27 -0
- package/dist/@types/modules/corecompiler/original/webWorker/webWorkerManager.d.ts +1 -0
- package/dist/@types/modules/corecompiler/original/workerThread/getWorkerPoolSize.d.ts +1 -0
- package/dist/@types/modules/corecompiler/original/workerThread/workerManager.d.ts +1 -0
- package/dist/@types/modules/corecompiler/originalCompiler.d.ts +0 -1
- package/dist/@types/modules/corecompiler/summerCompiler.d.ts +1 -1
- package/dist/@types/modules/index.d.ts +2 -1
- package/dist/@types/modules/nativecompiler/ios/buildCloud.d.ts +1 -0
- package/dist/@types/types/ci.d.ts +1 -1
- package/dist/@types/utils/asyncTask/index.d.ts +14 -0
- package/dist/@types/utils/babelHelperContentForWebide.d.ts +1 -0
- package/dist/@types/utils/cosUpload.d.ts +3 -2
- package/dist/@types/utils/env.d.ts +2 -0
- package/dist/@types/utils/packOptionsHelper.d.ts +1 -1
- package/dist/@types/utils/request.d.ts +2 -1
- package/dist/@types/utils/subprocess/getProcess.d.ts +1 -0
- package/dist/@types/utils/subprocess/processService.d.ts +6 -0
- package/dist/@types/utils/subprocess/stringifyPostMsg.d.ts +2 -0
- package/dist/@types/utils/taskqueue.d.ts +1 -0
- package/dist/@types/utils/tools.d.ts +1 -0
- package/dist/@types/utils/waitable.d.ts +1 -1
- package/dist/@types/utils/wxvpkgreader/wxvpkg/utils.d.ts +0 -1
- package/dist/ci/cloud/cloudapi.js +1 -1
- package/dist/ci/cos-upload.js +1 -1
- package/dist/ci/gamepkg/apkplug.js +1 -0
- package/dist/ci/gamepkg/index.js +1 -0
- package/dist/ci/getCompiledResult.js +1 -1
- package/dist/ci/index.js +1 -1
- package/dist/ci/jsserver.js +1 -1
- package/dist/ci/miniapp/upload.js +1 -1
- package/dist/ci/upload.js +1 -1
- package/dist/common/code-analyse/index.js +1 -1
- package/dist/config/config.js +1 -1
- package/dist/config/url.config.js +1 -1
- package/dist/index.js +1 -1
- package/dist/modules/corecompiler/original/compile/game.js +1 -1
- package/dist/modules/corecompiler/original/compile/miniprogram.js +1 -1
- package/dist/modules/corecompiler/original/utils/env.js +1 -1
- package/dist/modules/corecompiler/original/webWorker/WebWorkerInstance.js +1 -0
- package/dist/modules/corecompiler/original/webWorker/childWebWorker.js +1 -0
- package/dist/modules/corecompiler/original/webWorker/configs.js +1 -0
- package/dist/modules/corecompiler/original/webWorker/webWorkerManager.js +1 -0
- package/dist/modules/corecompiler/original/workerThread/fork.js +1 -1
- package/dist/modules/corecompiler/original/workerThread/getWorkerPoolSize.js +1 -0
- package/dist/modules/corecompiler/original/workerThread/index.js +1 -1
- package/dist/modules/corecompiler/original/workerThread/task/minifywxml.js +1 -1
- package/dist/modules/corecompiler/original/workerThread/workerManager.js +1 -1
- package/dist/modules/corecompiler/processHandler.js +1 -1
- package/dist/modules/corecompiler/summer/plugins/base/wxss.js +1 -1
- package/dist/modules/corecompiler/summer/plugins/index.js +1 -1
- package/dist/modules/corecompiler/summer/plugins/less.js +1 -1
- package/dist/modules/corecompiler/summer/plugins/sass.js +1 -1
- package/dist/modules/corecompiler/summer/plugins/typescript.js +1 -1
- package/dist/modules/corecompiler/summerCompiler.js +1 -1
- package/dist/modules/corecompiler/summerEntryProcess.js +1 -1
- package/dist/modules/index.js +1 -1
- package/dist/modules/nativecompiler/ios/buildCloud.js +1 -1
- package/dist/project/advance/precompileProject.js +1 -1
- package/dist/project/baseProject.js +1 -1
- package/dist/utils/asyncTask/index.js +1 -0
- package/dist/utils/babelHelperContentForWebide.js +1 -0
- package/dist/utils/cosUpload.js +1 -1
- package/dist/utils/env.js +1 -1
- package/dist/utils/officialDonutPlugin.js +1 -1
- package/dist/utils/packOptionsHelper.js +1 -1
- package/dist/utils/progressRecorder.js +1 -1
- package/dist/utils/request.js +1 -1
- package/dist/utils/subprocess/entryProcess.js +1 -1
- package/dist/utils/subprocess/getProcess.js +1 -0
- package/dist/utils/subprocess/processManager.js +1 -1
- package/dist/utils/subprocess/processService.js +1 -0
- package/dist/utils/subprocess/stringifyPostMsg.js +1 -0
- package/dist/utils/tools.js +1 -1
- package/dist/utils/waitable.js +1 -1
- package/package.json +16 -7
- package/dist/@types/common/cloud-api/src/apis/apis.d.ts +0 -5
- package/dist/@types/common/cloud-api/src/apis/cdn/cdn.apis.d.ts +0 -2
- package/dist/@types/common/cloud-api/src/apis/cdn/index.d.ts +0 -1
- package/dist/@types/common/cloud-api/src/apis/flexdb/flexdb.apis.d.ts +0 -17
- package/dist/@types/common/cloud-api/src/apis/flexdb/index.d.ts +0 -1
- package/dist/@types/common/cloud-api/src/apis/scf/index.d.ts +0 -1
- package/dist/@types/common/cloud-api/src/apis/scf/scf.apis.d.ts +0 -24
- package/dist/@types/common/cloud-api/src/apis/ssl/index.d.ts +0 -1
- package/dist/@types/common/cloud-api/src/apis/ssl/ssl.apis.d.ts +0 -1
- package/dist/@types/common/cloud-api/src/apis/tcb/general.apis.d.ts +0 -6
- package/dist/@types/common/cloud-api/src/apis/tcb/index.d.ts +0 -2
- package/dist/@types/common/cloud-api/src/apis/tcb/tcb.apis.d.ts +0 -186
- package/dist/@types/common/cloud-api/src/index.d.ts +0 -4
- package/dist/@types/common/cloud-api/src/transaction/contracts/account.contracts.d.ts +0 -2
- package/dist/@types/common/cloud-api/src/transaction/contracts/cdn.contracts.d.ts +0 -3
- package/dist/@types/common/cloud-api/src/transaction/contracts/contracts.d.ts +0 -9
- package/dist/@types/common/cloud-api/src/transaction/contracts/factory.d.ts +0 -60
- package/dist/@types/common/cloud-api/src/transaction/contracts/flexdb.contracts.d.ts +0 -18
- package/dist/@types/common/cloud-api/src/transaction/contracts/lowcode.contracts.d.ts +0 -3
- package/dist/@types/common/cloud-api/src/transaction/contracts/scf.contracts.d.ts +0 -23
- package/dist/@types/common/cloud-api/src/transaction/contracts/ssl.contracts.d.ts +0 -2
- package/dist/@types/common/cloud-api/src/transaction/contracts/tcb.contracts.d.ts +0 -189
- package/dist/@types/common/cloud-api/src/transaction/transactor.d.ts +0 -34
- package/dist/@types/common/cloud-api/src/transaction/validations/account.validations.d.ts +0 -2
- package/dist/@types/common/cloud-api/src/transaction/validations/billing.validations.d.ts +0 -2
- package/dist/@types/common/cloud-api/src/transaction/validations/cdn.validations.d.ts +0 -3
- package/dist/@types/common/cloud-api/src/transaction/validations/common.validations.d.ts +0 -125
- package/dist/@types/common/cloud-api/src/transaction/validations/flexdb.validations.d.ts +0 -23
- package/dist/@types/common/cloud-api/src/transaction/validations/lowcode.validations.d.ts +0 -3
- package/dist/@types/common/cloud-api/src/transaction/validations/scf.validations.d.ts +0 -28
- package/dist/@types/common/cloud-api/src/transaction/validations/ssl.validations.d.ts +0 -2
- package/dist/@types/common/cloud-api/src/transaction/validations/tcb.validations.d.ts +0 -194
- package/dist/@types/common/cloud-api/src/transaction/validations/validations.d.ts +0 -9
- package/dist/@types/common/cloud-api/src/utils/common.d.ts +0 -2
- package/dist/@types/common/cloud-api/src/utils/validator.d.ts +0 -41
- package/dist/common/cloud-api/src/apis/apis.js +0 -1
- package/dist/common/cloud-api/src/apis/cdn/cdn.apis.js +0 -1
- package/dist/common/cloud-api/src/apis/cdn/index.js +0 -1
- package/dist/common/cloud-api/src/apis/flexdb/flexdb.apis.js +0 -1
- package/dist/common/cloud-api/src/apis/flexdb/index.js +0 -1
- package/dist/common/cloud-api/src/apis/scf/index.js +0 -1
- package/dist/common/cloud-api/src/apis/scf/scf.apis.js +0 -1
- package/dist/common/cloud-api/src/apis/ssl/index.js +0 -1
- package/dist/common/cloud-api/src/apis/ssl/ssl.apis.js +0 -1
- package/dist/common/cloud-api/src/apis/tcb/general.apis.js +0 -1
- package/dist/common/cloud-api/src/apis/tcb/index.js +0 -1
- package/dist/common/cloud-api/src/apis/tcb/tcb.apis.js +0 -1
- package/dist/common/cloud-api/src/index.js +0 -1
- package/dist/common/cloud-api/src/transaction/contracts/account.contracts.js +0 -1
- package/dist/common/cloud-api/src/transaction/contracts/cdn.contracts.js +0 -1
- package/dist/common/cloud-api/src/transaction/contracts/contracts.js +0 -1
- package/dist/common/cloud-api/src/transaction/contracts/factory.js +0 -1
- package/dist/common/cloud-api/src/transaction/contracts/flexdb.contracts.js +0 -1
- package/dist/common/cloud-api/src/transaction/contracts/lowcode.contracts.js +0 -1
- package/dist/common/cloud-api/src/transaction/contracts/scf.contracts.js +0 -1
- package/dist/common/cloud-api/src/transaction/contracts/ssl.contracts.js +0 -1
- package/dist/common/cloud-api/src/transaction/contracts/tcb.contracts.js +0 -1
- package/dist/common/cloud-api/src/transaction/transactor.js +0 -1
- package/dist/common/cloud-api/src/transaction/validations/account.validations.js +0 -1
- package/dist/common/cloud-api/src/transaction/validations/billing.validations.js +0 -1
- package/dist/common/cloud-api/src/transaction/validations/cdn.validations.js +0 -1
- package/dist/common/cloud-api/src/transaction/validations/common.validations.js +0 -1
- package/dist/common/cloud-api/src/transaction/validations/flexdb.validations.js +0 -1
- package/dist/common/cloud-api/src/transaction/validations/lowcode.validations.js +0 -1
- package/dist/common/cloud-api/src/transaction/validations/scf.validations.js +0 -1
- package/dist/common/cloud-api/src/transaction/validations/ssl.validations.js +0 -1
- package/dist/common/cloud-api/src/transaction/validations/tcb.validations.js +0 -1
- package/dist/common/cloud-api/src/transaction/validations/validations.js +0 -1
- package/dist/common/cloud-api/src/utils/common.js +0 -1
- package/dist/common/cloud-api/src/utils/validator.js +0 -1
package/dist/config/config.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var COMPILE_TYPE,AstType,EFilterCode;function getDefaultIgnores(e){const _=["node_modules/**/*","**/node_modules/**","**/.git/**",".git/**/*","**/.svn/**",".svn/**/*",".DS_Store","**/.DS_Store"];return"multiPlatform"===e.projectArchitecture&&_.push(exports.multiPlatformRoot+"/**/*"),_}Object.defineProperty(exports,"__esModule",{value:!0}),exports.MAX_CODE_LENGTH=exports.EFilterCode=exports.AstType=exports.compileTypeConfig=exports.getDefaultIgnores=exports.FullPkg=exports.MainPkg=exports.multiPlatformRoot=exports.extendedLibMap=exports.jsonVariablePropertyWhiteList=exports.DefaultProjectAttr=exports.TABBAR_ICON_WHITE_LIST=exports.COMPILE_TYPE=exports.APP_TYPE=exports.MINI_GAME_WORKERS_PACKAGE_ROOT=exports.MINI_GAME_MAIN_PACKAGE_ROOT=exports.MINI_PROGRAM_MAIN_PACKAGE_ROOT=exports.PROJECT_TYPE_ERROR=exports.GET_LATEST_VERSION_CGI_ERR=exports.UPLOAD_JS_SERVER_CGI_ERR=exports.CODE_PROTECT_TRANSLATE_FILENAME=exports.UPLOAD_CGI_ERR=exports.GENERATE_LOCAL_SIGNATURE_ERR=exports.GET_SIGNATURE_RAND_STRING_ERR=exports.APP_JSON_NOT_FOUND=exports.JSON_CONTENT_ERR=exports.FILE_NOT_UTF8=exports.JSON_PARSE_ERR=exports.FILE_NOT_FOUND=exports.PLUGIN_JSON_PARSE_ERR=exports.PLUGIN_JSON_CONTENT_ERR=exports.PLUGIN_JSON_FILE_NOT_FOUND=exports.GAME_PLUGIN_LIB_MD5_NOT_MATCH=exports.SUMMER_PLUGIN_CODE_ERR=exports.SUMMER_PLUGIN_ERR=exports.MINIFY_WXML_ERR=exports.POST_WXSS_ERR=exports.FILE_FLAT_ERR=exports.JS_ES6_ERR=exports.BABILI_JS_ERR=exports.UGLIFY_JS_ERR=exports.BABEL_TRANS_JS_ERR=exports.JS_NOT_FOUND=exports.WXML_NOT_FOUND=exports.PARAM_ERROR=exports.CI_VERSION=void 0,exports.CI_VERSION="2.1.
|
|
1
|
+
"use strict";var COMPILE_TYPE,AstType,EFilterCode;function getDefaultIgnores(e){const _=["node_modules/**/*","**/node_modules/**","**/.git/**",".git/**/*","**/.svn/**",".svn/**/*",".DS_Store","**/.DS_Store"];return"multiPlatform"===e.projectArchitecture&&_.push(exports.multiPlatformRoot+"/**/*"),_}Object.defineProperty(exports,"__esModule",{value:!0}),exports.MAX_CODE_LENGTH=exports.EFilterCode=exports.AstType=exports.compileTypeConfig=exports.getDefaultIgnores=exports.FullPkg=exports.MainPkg=exports.multiPlatformRoot=exports.extendedLibMap=exports.jsonVariablePropertyWhiteList=exports.DefaultProjectAttr=exports.TABBAR_ICON_WHITE_LIST=exports.COMPILE_TYPE=exports.APP_TYPE=exports.MINI_GAME_WORKERS_PACKAGE_ROOT=exports.MINI_GAME_MAIN_PACKAGE_ROOT=exports.MINI_PROGRAM_MAIN_PACKAGE_ROOT=exports.PROJECT_TYPE_ERROR=exports.GET_LATEST_VERSION_CGI_ERR=exports.UPLOAD_JS_SERVER_CGI_ERR=exports.CODE_PROTECT_TRANSLATE_FILENAME=exports.UPLOAD_CGI_ERR=exports.GENERATE_LOCAL_SIGNATURE_ERR=exports.GET_SIGNATURE_RAND_STRING_ERR=exports.APP_JSON_NOT_FOUND=exports.JSON_CONTENT_ERR=exports.FILE_NOT_UTF8=exports.JSON_PARSE_ERR=exports.FILE_NOT_FOUND=exports.PLUGIN_JSON_PARSE_ERR=exports.PLUGIN_JSON_CONTENT_ERR=exports.PLUGIN_JSON_FILE_NOT_FOUND=exports.GAME_PLUGIN_LIB_MD5_NOT_MATCH=exports.SUMMER_PLUGIN_CODE_ERR=exports.SUMMER_PLUGIN_ERR=exports.MINIFY_WXML_ERR=exports.POST_WXSS_ERR=exports.FILE_FLAT_ERR=exports.JS_ES6_ERR=exports.BABILI_JS_ERR=exports.UGLIFY_JS_ERR=exports.BABEL_TRANS_JS_ERR=exports.JS_NOT_FOUND=exports.WXML_NOT_FOUND=exports.PARAM_ERROR=exports.CI_VERSION=void 0,exports.CI_VERSION="2.1.16",exports.PARAM_ERROR=1e4,exports.WXML_NOT_FOUND=10007,exports.JS_NOT_FOUND=10008,exports.BABEL_TRANS_JS_ERR=10032,exports.UGLIFY_JS_ERR=10033,exports.BABILI_JS_ERR=10034,exports.JS_ES6_ERR=10035,exports.FILE_FLAT_ERR=10036,exports.POST_WXSS_ERR=10037,exports.MINIFY_WXML_ERR=10038,exports.SUMMER_PLUGIN_ERR=10045,exports.SUMMER_PLUGIN_CODE_ERR=10046,exports.GAME_PLUGIN_LIB_MD5_NOT_MATCH=10081,exports.PLUGIN_JSON_FILE_NOT_FOUND=10091,exports.PLUGIN_JSON_CONTENT_ERR=10092,exports.PLUGIN_JSON_PARSE_ERR=10093,exports.FILE_NOT_FOUND=10005,exports.JSON_PARSE_ERR=10006,exports.FILE_NOT_UTF8=10031,exports.JSON_CONTENT_ERR=10009,exports.APP_JSON_NOT_FOUND=2e4,exports.GET_SIGNATURE_RAND_STRING_ERR=20001,exports.GENERATE_LOCAL_SIGNATURE_ERR=20002,exports.UPLOAD_CGI_ERR=20003,exports.CODE_PROTECT_TRANSLATE_FILENAME=20004,exports.UPLOAD_JS_SERVER_CGI_ERR=20005,exports.GET_LATEST_VERSION_CGI_ERR=20006,exports.PROJECT_TYPE_ERROR=3e4,exports.MINI_PROGRAM_MAIN_PACKAGE_ROOT="__APP__",exports.MINI_GAME_MAIN_PACKAGE_ROOT="__GAME__",exports.MINI_GAME_WORKERS_PACKAGE_ROOT="workers.js",exports.APP_TYPE={NORMAL:0,PLUGIN:1,SHOP:2,MINISHOP:3,GAME:4,CARD:5,NATIVE:7},function(e){e.miniProgram="miniProgram",e.miniProgramPlugin="miniProgramPlugin",e.miniGame="miniGame",e.miniGamePlugin="miniGamePlugin"}(COMPILE_TYPE=exports.COMPILE_TYPE||(exports.COMPILE_TYPE={})),exports.TABBAR_ICON_WHITE_LIST=[".png",".jpg",".jpeg"],exports.DefaultProjectAttr={platform:!1,appType:0,isSandbox:!1,released:!1,setting:{MaxCodeSize:2,MaxSubpackageSubCodeSize:2,MaxSubpackageFullCodeSize:12,NavigateMiniprogramLimit:10,MaxSubPackageLimit:100,MinTabbarCount:2,MaxTabbarCount:5,MaxCustomTabbarCount:10,MaxTabbarIconSize:40}},exports.jsonVariablePropertyWhiteList={windowPropertWhiteList:["navigationBarBackgroundColor","navigationBarTextStyle","backgroundColor","backgroundTextStyle","backgroundColorTop","backgroundColorBottom","backgroundColorContent"],tabBarPropertyWhiteList:["color","selectedColor","backgroundColor","borderStyle"],tabbarListItemPropertyWhiteList:["iconPath","selectedIconPath"]},exports.extendedLibMap={kbone:{packages:["miniprogram-element","miniprogram-render"]},weui:{packages:["weui-miniprogram"]}},exports.multiPlatformRoot="miniapp",exports.MainPkg="__APP__",exports.FullPkg="__FULL__",exports.getDefaultIgnores=getDefaultIgnores,exports.compileTypeConfig={weapp:"weapp",game:"game",plugin:"plugin",gamePlugin:"gamePlugin"},function(e){e.Babel="babel",e.Acorn="acorn"}(AstType=exports.AstType||(exports.AstType={})),function(e){e[e.Include=0]="Include",e[e.PackOptionsIgnore=1]="PackOptionsIgnore",e[e.AnalyseNoUse=2]="AnalyseNoUse",e[e.PartialCompileNoUse=3]="PartialCompileNoUse"}(EFilterCode=exports.EFilterCode||(exports.EFilterCode={})),exports.MAX_CODE_LENGTH=2048e3;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.getUsedPluginVersionInfo=exports.downloadMiniAppPlugin=exports.getPkgWxapkg=exports.miniappUpload=exports.getCloudBuildPkgUrl=exports.getCloudBuildTaskList=exports.uploadCloudBuildResourcePack=exports.getSdkIntInfo=exports.getAsyncResult=exports.testSourceNewFeatureURL=exports.testSourceURL=exports.getUploadToken=exports.commitSourceURL=exports.commitSourceNewFeatureURL=exports.tcbTencentCloudUrl=exports.dbTencentCloudUrl=exports.scfTencentCloudUrl=exports.cloudCosUploadURL=exports.get3rdCloudCodeSecret=exports.cloudAPIAgentURL=exports.GET_LATEST_VERSION=exports.UPLOAD_JS_SERVER=exports.GET_UPLOAD_SIGN=exports.GET_UPLOAD_INFO=exports.GET_ASYNC_RESULT=exports.GET_UPLOAD_TOKEN=exports.GET_CLOUD_API_SIGNATURE=exports.TRANSLATE_FILENAME=exports.GET_DEV_SOURCE_MAP=exports.GET_RAND_STRING=exports.GET_ONLINE_SCHEMA=exports.GET_WHITE_EXT_LIST=exports.TEST_SOURCE_URL=exports.UPLOAD_URL=exports.GET_ATTR_URL=void 0;const Domain="https://servicewechat.com";exports.GET_ATTR_URL=Domain+"/wxa/ci/getattr",exports.UPLOAD_URL=Domain+"/wxa/ci/upload",exports.TEST_SOURCE_URL=Domain+"/wxa/ci/testSourceURL",exports.GET_WHITE_EXT_LIST=Domain+"/wxa/ci/getwhiteextlist",exports.GET_ONLINE_SCHEMA=Domain+"/wxa/ci/getonlineschema",exports.GET_RAND_STRING=Domain+"/wxa/ci/getrandstr",exports.GET_DEV_SOURCE_MAP=Domain+"/wxa/ci/get_dev_sourcemap",exports.TRANSLATE_FILENAME=Domain+"/wxa/ci/translate_filename",exports.GET_CLOUD_API_SIGNATURE=Domain+"/wxa/ci/getqcloudapisignature",exports.GET_UPLOAD_TOKEN=Domain+"/wxa/ci/getuploadtoken",exports.GET_ASYNC_RESULT=Domain+"/wxa/ci/getasyncresult",exports.GET_UPLOAD_INFO=Domain+"/wxa/ci/getuploadinfo",exports.GET_UPLOAD_SIGN=Domain+"/wxa/ci/getuploadsign",exports.UPLOAD_JS_SERVER=Domain+"/wxa/ci/uploadjsserver",exports.GET_LATEST_VERSION=Domain+"/wxa/ci/getlatestversion",exports.cloudAPIAgentURL=Domain+"/wxa/ci/cloudapihttpagent",exports.get3rdCloudCodeSecret=Domain+"/wxa/ci/getcloudcodesecret",exports.cloudCosUploadURL=Domain+"/wxa/ci/cloudcosupload",exports.scfTencentCloudUrl="https://scf.tencentcloudapi.com",exports.dbTencentCloudUrl="https://flexdb.tencentcloudapi.com",exports.tcbTencentCloudUrl="https://tcb.tencentcloudapi.com",exports.commitSourceNewFeatureURL=Domain+"wxa-dev-new/commitsource",exports.commitSourceURL=Domain+"wxa-dev/commitsource",exports.getUploadToken=Domain+"wxa-dev/getuploadtoken",exports.testSourceURL=Domain+"wxa-dev/testsource",exports.testSourceNewFeatureURL=Domain+"wxa-dev-new/testsource",exports.getAsyncResult=Domain+"wxa-dev/getasyncresult",exports.getSdkIntInfo=Domain+"/wxa/ci/getsdkinitinfo",exports.uploadCloudBuildResourcePack=Domain+"/wxa/ci/uploadcloudbuildresourcepack",exports.getCloudBuildTaskList=Domain+"/wxa/ci/getcloudbuildtasklist",exports.getCloudBuildPkgUrl=Domain+"/wxa/ci/getcloudbuildpkgurl",exports.miniappUpload=Domain+"/wxa/ci/miniappupload",exports.getPkgWxapkg=Domain+"/wxa/ci/downloadpackage",exports.downloadMiniAppPlugin=Domain+"/wxa/ci/downloadcpfplugin",exports.getUsedPluginVersionInfo=Domain+"/wxa/ci/getcpfusedpluginversioninfo";
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.getUsedPluginVersionInfo=exports.downloadMiniAppPlugin=exports.getPkgWxapkg=exports.miniappUpload=exports.getCloudBuildPkgUrl=exports.getCloudBuildTaskList=exports.uploadCloudBuildResourcePack=exports.getSdkIntInfo=exports.getAsyncResult=exports.testSourceNewFeatureURL=exports.testSourceURL=exports.getUploadToken=exports.commitSourceURL=exports.commitSourceNewFeatureURL=exports.tcbTencentCloudUrl=exports.dbTencentCloudUrl=exports.scfTencentCloudUrl=exports.cloudCosUploadURL=exports.get3rdCloudCodeSecret=exports.cloudAPIAgentURL=exports.GET_LATEST_VERSION=exports.UPLOAD_JS_SERVER=exports.GET_UPLOAD_SIGN=exports.GET_UPLOAD_INFO=exports.GET_PLUG_PKG_CHECK_USERVERSION=exports.GET_PLUG_PKG_GET_URL=exports.GET_PLUG_PKG_GET_LIST=exports.GET_GAME_PKG_UPLOAD_SIGN=exports.GET_GAME_PKG_UPLOAD_INFO=exports.GET_GAME_PKG_ASYNC_RESULT=exports.GAME_PKG_UPLOAD_URL=exports.GET_ASYNC_RESULT=exports.GET_UPLOAD_TOKEN=exports.GET_CLOUD_API_SIGNATURE=exports.TRANSLATE_FILENAME=exports.GET_DEV_SOURCE_MAP=exports.GET_RAND_STRING=exports.GET_ONLINE_SCHEMA=exports.GET_WHITE_EXT_LIST=exports.TEST_SOURCE_URL=exports.UPLOAD_URL=exports.GET_ATTR_URL=void 0;const Domain="https://servicewechat.com";exports.GET_ATTR_URL=Domain+"/wxa/ci/getattr",exports.UPLOAD_URL=Domain+"/wxa/ci/upload",exports.TEST_SOURCE_URL=Domain+"/wxa/ci/testSourceURL",exports.GET_WHITE_EXT_LIST=Domain+"/wxa/ci/getwhiteextlist",exports.GET_ONLINE_SCHEMA=Domain+"/wxa/ci/getonlineschema",exports.GET_RAND_STRING=Domain+"/wxa/ci/getrandstr",exports.GET_DEV_SOURCE_MAP=Domain+"/wxa/ci/get_dev_sourcemap",exports.TRANSLATE_FILENAME=Domain+"/wxa/ci/translate_filename",exports.GET_CLOUD_API_SIGNATURE=Domain+"/wxa/ci/getqcloudapisignature",exports.GET_UPLOAD_TOKEN=Domain+"/wxa/ci/getuploadtoken",exports.GET_ASYNC_RESULT=Domain+"/wxa/ci/getasyncresult",exports.GAME_PKG_UPLOAD_URL=Domain+"/wxa/ci/gamepkgupload",exports.GET_GAME_PKG_ASYNC_RESULT=Domain+"/wxa/ci/getgamepkgasyncresult",exports.GET_GAME_PKG_UPLOAD_INFO=Domain+"/wxa/ci/getgamepkguploadinfo",exports.GET_GAME_PKG_UPLOAD_SIGN=Domain+"/wxa/ci/getgamepkguploadsign",exports.GET_PLUG_PKG_GET_LIST=Domain+"/wxa/ci/apkpluggetlist",exports.GET_PLUG_PKG_GET_URL=Domain+"/wxa/ci/apkpluggeturl",exports.GET_PLUG_PKG_CHECK_USERVERSION=Domain+"/wxa/ci/apkplugcheckuserversion",exports.GET_UPLOAD_INFO=Domain+"/wxa/ci/getuploadinfo",exports.GET_UPLOAD_SIGN=Domain+"/wxa/ci/getuploadsign",exports.UPLOAD_JS_SERVER=Domain+"/wxa/ci/uploadjsserver",exports.GET_LATEST_VERSION=Domain+"/wxa/ci/getlatestversion",exports.cloudAPIAgentURL=Domain+"/wxa/ci/cloudapihttpagent",exports.get3rdCloudCodeSecret=Domain+"/wxa/ci/getcloudcodesecret",exports.cloudCosUploadURL=Domain+"/wxa/ci/cloudcosupload",exports.scfTencentCloudUrl="https://scf.tencentcloudapi.com",exports.dbTencentCloudUrl="https://flexdb.tencentcloudapi.com",exports.tcbTencentCloudUrl="https://tcb.tencentcloudapi.com",exports.commitSourceNewFeatureURL=Domain+"wxa-dev-new/commitsource",exports.commitSourceURL=Domain+"wxa-dev/commitsource",exports.getUploadToken=Domain+"wxa-dev/getuploadtoken",exports.testSourceURL=Domain+"wxa-dev/testsource",exports.testSourceNewFeatureURL=Domain+"wxa-dev-new/testsource",exports.getAsyncResult=Domain+"wxa-dev/getasyncresult",exports.getSdkIntInfo=Domain+"/wxa/ci/getsdkinitinfo",exports.uploadCloudBuildResourcePack=Domain+"/wxa/ci/uploadcloudbuildresourcepack",exports.getCloudBuildTaskList=Domain+"/wxa/ci/getcloudbuildtasklist",exports.getCloudBuildPkgUrl=Domain+"/wxa/ci/getcloudbuildpkgurl",exports.miniappUpload=Domain+"/wxa/ci/miniappupload",exports.getPkgWxapkg=Domain+"/wxa/ci/downloadpackage",exports.downloadMiniAppPlugin=Domain+"/wxa/ci/downloadcpfplugin",exports.getUsedPluginVersionInfo=Domain+"/wxa/ci/getcpfusedpluginversioninfo";
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.MiniAppJson=exports.MiniAppI18N=exports.miniappBuilder=exports.iosDeviceUtils=exports.adroidDeviceUtils=exports.cosUpload=exports.
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.MiniAppJson=exports.MiniAppI18N=exports.encryptLocalFile=exports.generateFileMD5=exports.miniappBuilder=exports.iosDeviceUtils=exports.adroidDeviceUtils=exports.cosUpload=exports.escapeScript=exports.escapeQuot=exports.checkIsInSubPackage=exports.compareVersion=exports.normalizePath=exports.mkdirSync=exports.generateMD5=exports.compileTypeConfig=exports.JSON_CONTENT_ERR=exports.DefaultProjectAttr=exports.isHexColor=exports.locales=exports.proxy=exports.getWhiteExtList=exports.OriginalCompiler=exports.BaseCoreCompiler=exports.CIProject=exports.Project=exports.PreCompileProject=exports.WebProject=exports.BaseProject=exports.workletVersion=exports.packOptionsHelper=exports.getHelperDeps=exports.getHelperOutputPath=exports.getHelperContent=exports.getHelperName=exports.isValidHelperFunc=exports.getBabelHelperDepMap=exports.getBabelHelperVersion=exports.getSummerPluginConfig=exports.DevtoolsProject=exports.SummerCompiler=exports.Builder=void 0;const tslib_1=require("tslib");tslib_1.__exportStar(require("./ci/index"),exports);const modules_1=require("./modules");Object.defineProperty(exports,"Builder",{enumerable:!0,get:function(){return modules_1.Builder}});const summerCompiler_1=require("./modules/corecompiler/summerCompiler");Object.defineProperty(exports,"SummerCompiler",{enumerable:!0,get:function(){return summerCompiler_1.SummerCompiler}});const devtoolsProject_1=require("./project/devtoolsProject");Object.defineProperty(exports,"DevtoolsProject",{enumerable:!0,get:function(){return devtoolsProject_1.DevtoolsProject}});const pluginconfig_1=require("./modules/corecompiler/summer/pluginconfig");Object.defineProperty(exports,"getSummerPluginConfig",{enumerable:!0,get:function(){return pluginconfig_1.getSummerPluginConfig}});const babel_helper_1=require("./utils/babel_helper");Object.defineProperty(exports,"getBabelHelperVersion",{enumerable:!0,get:function(){return babel_helper_1.getBabelHelperVersion}}),Object.defineProperty(exports,"getBabelHelperDepMap",{enumerable:!0,get:function(){return babel_helper_1.getBabelHelperDepMap}});const helper_util_1=require("./utils/helper_util");Object.defineProperty(exports,"getHelperOutputPath",{enumerable:!0,get:function(){return helper_util_1.getHelperOutputPath}}),Object.defineProperty(exports,"getHelperDeps",{enumerable:!0,get:function(){return helper_util_1.getHelperDeps}}),Object.defineProperty(exports,"isValidHelperFunc",{enumerable:!0,get:function(){return helper_util_1.isValidHelperFunc}}),Object.defineProperty(exports,"getHelperContent",{enumerable:!0,get:function(){return helper_util_1.getHelperContent}}),Object.defineProperty(exports,"getHelperName",{enumerable:!0,get:function(){return helper_util_1.getHelperName}});const packOptionsHelper_1=tslib_1.__importDefault(require("./utils/packOptionsHelper"));exports.packOptionsHelper=packOptionsHelper_1.default;const baseProject_1=require("./project/baseProject");Object.defineProperty(exports,"BaseProject",{enumerable:!0,get:function(){return baseProject_1.BaseProject}});const webProject_1=require("./project/webProject");Object.defineProperty(exports,"WebProject",{enumerable:!0,get:function(){return webProject_1.WebProject}});const precompileProject_1=require("./project/advance/precompileProject");Object.defineProperty(exports,"PreCompileProject",{enumerable:!0,get:function(){return precompileProject_1.PreCompileProject}});const ciProject_1=require("./project/ciProject");Object.defineProperty(exports,"Project",{enumerable:!0,get:function(){return ciProject_1.CIProject}}),Object.defineProperty(exports,"CIProject",{enumerable:!0,get:function(){return ciProject_1.CIProject}});const baseCompiler_1=require("./modules/corecompiler/baseCompiler");Object.defineProperty(exports,"BaseCoreCompiler",{enumerable:!0,get:function(){return baseCompiler_1.BaseCoreCompiler}});const originalCompiler_1=require("./modules/corecompiler/originalCompiler");Object.defineProperty(exports,"OriginalCompiler",{enumerable:!0,get:function(){return originalCompiler_1.OriginalCompiler}});const white_ext_list_1=require("./utils/white_ext_list");Object.defineProperty(exports,"getWhiteExtList",{enumerable:!0,get:function(){return white_ext_list_1.getWhiteExtList}});const request_1=require("./utils/request");Object.defineProperty(exports,"proxy",{enumerable:!0,get:function(){return request_1.setCiProxy}});const locales_1=tslib_1.__importDefault(require("./utils/locales/locales"));exports.locales=locales_1.default;const tools_1=require("./utils/tools");Object.defineProperty(exports,"checkIsInSubPackage",{enumerable:!0,get:function(){return tools_1.checkIsInSubPackage}}),Object.defineProperty(exports,"escapeQuot",{enumerable:!0,get:function(){return tools_1.escapeQuot}}),Object.defineProperty(exports,"escapeScript",{enumerable:!0,get:function(){return tools_1.escapeScript}}),Object.defineProperty(exports,"generateMD5",{enumerable:!0,get:function(){return tools_1.generateMD5}}),Object.defineProperty(exports,"isHexColor",{enumerable:!0,get:function(){return tools_1.isHexColor}}),Object.defineProperty(exports,"mkdirSync",{enumerable:!0,get:function(){return tools_1.mkdirSync}}),Object.defineProperty(exports,"normalizePath",{enumerable:!0,get:function(){return tools_1.normalizePath}}),Object.defineProperty(exports,"compareVersion",{enumerable:!0,get:function(){return tools_1.compareVersion}});const config_1=require("./config/config");Object.defineProperty(exports,"DefaultProjectAttr",{enumerable:!0,get:function(){return config_1.DefaultProjectAttr}}),Object.defineProperty(exports,"JSON_CONTENT_ERR",{enumerable:!0,get:function(){return config_1.JSON_CONTENT_ERR}}),Object.defineProperty(exports,"compileTypeConfig",{enumerable:!0,get:function(){return config_1.compileTypeConfig}});const adroidDeviceUtils=tslib_1.__importStar(require("./modules/nativecompiler/android/device"));exports.adroidDeviceUtils=adroidDeviceUtils;const iosDeviceUtils=tslib_1.__importStar(require("./modules/nativecompiler/ios/device"));exports.iosDeviceUtils=iosDeviceUtils;const miniappBuilder=tslib_1.__importStar(require("./utils/miniapp-builder"));exports.miniappBuilder=miniappBuilder;const miniAppI18N_1=tslib_1.__importDefault(require("./utils/miniAppI18N"));exports.MiniAppI18N=miniAppI18N_1.default;const MiniAppJson=tslib_1.__importStar(require("./utils/miniappJson"));exports.MiniAppJson=MiniAppJson;const cosUpload=tslib_1.__importStar(require("./utils/cosUpload"));exports.cosUpload=cosUpload,exports.workletVersion=require("./utils/common").workletVersion,tslib_1.__exportStar(require("./modules/corecompiler/original"),exports);var tools_2=require("./utils/tools");Object.defineProperty(exports,"generateFileMD5",{enumerable:!0,get:function(){return tools_2.generateFileMD5}});var asyncTask_1=require("./utils/asyncTask");Object.defineProperty(exports,"encryptLocalFile",{enumerable:!0,get:function(){return asyncTask_1.encryptLocalFile}});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.compile=void 0;const tslib_1=require("tslib"),path_1=tslib_1.__importDefault(require("path")),game_1=tslib_1.__importDefault(require("../json/game")),projectconfig_1=require("../json/projectconfig"),taskstatus_1=require("../../../../utils/taskstatus"),config_1=require("../../../../config/config"),common_1=require("../../../../utils/common"),locales_1=tslib_1.__importDefault(require("../../../../utils/locales/locales")),white_ext_list_1=require("../../../../utils/white_ext_list"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.compile=void 0;const tslib_1=require("tslib"),path_1=tslib_1.__importDefault(require("path")),game_1=tslib_1.__importDefault(require("../json/game")),projectconfig_1=require("../json/projectconfig"),taskstatus_1=require("../../../../utils/taskstatus"),config_1=require("../../../../config/config"),common_1=require("../../../../utils/common"),locales_1=tslib_1.__importDefault(require("../../../../utils/locales/locales")),white_ext_list_1=require("../../../../utils/white_ext_list"),common_2=require("./common"),uglifyfilenames_1=require("../protect/uglifyfilenames");async function compileGameJSON(e,i){const{onProgressUpdate:t=(()=>{})}=i,o=new taskstatus_1.TaskStatus("game.json");t(o);const a=(0,game_1.default)(e);return o.done(),t(o),a}async function compile(e,i){var t;const o=(0,projectconfig_1.getProjectConfigJSON)(e),a=o.miniprogramRoot||"",{GameWhiteList:s}=await(0,white_ext_list_1.getWhiteExtList)(),n=e.getFileList(a,"").filter(common_2.isNotIgnoredByProjectConfig.bind(null,o,a)).filter(e=>s.has(path_1.default.posix.extname(e))),r=await compileGameJSON(e,i);e.stat(a,"game.js")||(0,common_1.throwError)({msg:locales_1.default.config.FILE_NOT_FOUND.format(path_1.default.posix.join(a,"game.js")),filePath:path_1.default.posix.join(a,"game.js"),code:config_1.FILE_NOT_FOUND});const l=n.filter(e=>".js"===path_1.default.posix.extname(e)).map(e=>path_1.default.posix.relative(a,e)),m=await(0,common_2.compileJSFiles)(e,l,a,i),_=n.filter(e=>e!==path_1.default.posix.join(a,"game.json")&&".js"!==path_1.default.posix.extname(e)),c=await(0,common_2.compileOther)(e,_,i),p=await(0,common_2.getUploadProjectConfig)(e,o);let f=Object.assign(Object.assign({},m),c);if(e.type===config_1.COMPILE_TYPE.miniGame){if(p.miniprogramRoot&&"."!==p.miniprogramRoot&&"./"!==p.miniprogramRoot){const i={};for(const t in f)i[path_1.default.posix.relative(e.miniprogramRoot,t)]=f[t];f=i}p.miniprogramRoot="",f["game.json"]=JSON.stringify(r)}else f[path_1.default.posix.join(p.miniprogramRoot||"","game.json")]=JSON.stringify(r);return p.__compileDebugInfo__=i.__compileDebugInfo__||{},f["project.config.json"]=JSON.stringify(p),delete f["project.private.config.json"],e.type===config_1.COMPILE_TYPE.miniGame&&(null===(t=i.setting)||void 0===t?void 0:t.uglifyFileName)&&(f=await(0,uglifyfilenames_1.uglifyFileNames)(e,f)),f}exports.compile=compile;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.compile=void 0;const tslib_1=require("tslib"),path_1=tslib_1.__importDefault(require("path")),lodash_1=tslib_1.__importDefault(require("lodash")),white_ext_list_1=require("../../../../utils/white_ext_list"),config_1=require("../../../../config/config"),projectconfig_1=require("../json/projectconfig"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.compile=void 0;const tslib_1=require("tslib"),path_1=tslib_1.__importDefault(require("path")),lodash_1=tslib_1.__importDefault(require("lodash")),white_ext_list_1=require("../../../../utils/white_ext_list"),config_1=require("../../../../config/config"),projectconfig_1=require("../json/projectconfig"),partial_1=require("../analyse/partial"),summer=tslib_1.__importStar(require("../../summer")),mpjson_1=require("./handler/mpjson"),common_1=require("./common"),uglifyfilenames_1=require("../protect/uglifyfilenames");async function compile(e,i){var t,o,a,l;const s=(0,projectconfig_1.getProjectConfigJSON)(e);if(null===(t=s.setting)||void 0===t?void 0:t.useCompilerPlugins)return summer.compile(e,s,i,s.setting.useCompilerPlugins);const r=s.miniprogramRoot||"",{MiniProgramWhiteList:p}=await(0,white_ext_list_1.getWhiteExtList)();let n=e.getFileList(r,"").filter(common_1.isNotIgnoredByProjectConfig.bind(null,s,r)).filter(e=>p.has(path_1.default.posix.extname(e)));if((null===(o=i.compilePages)||void 0===o?void 0:o.length)&&i.analyzer){const e=(0,partial_1.partialGetCodeFiles)(i.analyzer,i.compilePages).map(e=>path_1.default.posix.join(r,e)),t=n.filter(e=>{const i=path_1.default.posix.extname(e);return".js"!==i&&".json"!==i&&".wxss"!==i&&".wxml"!==i});n=t.concat(e)}let m=!1,c=await(0,mpjson_1.compileJSON)(e,i);if((null===(a=i.compilePages)||void 0===a?void 0:a.length)&&i.analyzer){const e=JSON.parse(c[path_1.default.posix.join(r,"app.json")]);e.pages=e.pages.filter(e=>{var t;return null===(t=i.compilePages)||void 0===t?void 0:t.includes(e)}),0===e.pages.length&&(e.pages=["partialcompileplaceholder"],m=!0),e.subPackages&&(e.subPackages.forEach(e=>{e.pages=e.pages.filter(t=>{var o;return null===(o=i.compilePages)||void 0===o?void 0:o.includes(e.root+t)})}),e.subPackages=e.subPackages.filter(e=>e.pages.length>0)),c[path_1.default.posix.join(r,"app.json")]=JSON.stringify(e),c=lodash_1.default.pick(c,Object.keys(c).filter(e=>c[e]instanceof Buffer||n.includes(e)))}const _=n.filter(e=>".js"===path_1.default.posix.extname(e)).map(e=>path_1.default.posix.relative(r,e)),u=await(0,common_1.compileJSFiles)(e,_,r,i),f=n.filter(e=>".wxss"===path_1.default.posix.extname(e)).map(e=>path_1.default.posix.relative(r,e)),g=await(0,common_1.compileWXSSFiles)(e,f,r,i),d=n.filter(e=>".wxml"===path_1.default.posix.extname(e)).map(e=>path_1.default.posix.relative(r,e)),h=await(0,common_1.compileWXMLFiles)(e,d,r,i),j=n.filter(e=>{const i=path_1.default.posix.extname(e);return".js"!==i&&".json"!==i&&".wxss"!==i&&".wxml"!==i}),x=await(0,common_1.compileOther)(e,j,i);let v=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},c),u),x),g),h);if(m&&(v[path_1.default.posix.join(r,"partialcompileplaceholder.js")]||(v[path_1.default.posix.join(r,"partialcompileplaceholder.js")]=""),v[path_1.default.posix.join(r,"partialcompileplaceholder.wxml")]||(v[path_1.default.posix.join(r,"partialcompileplaceholder.wxml")]="")),e.type===config_1.COMPILE_TYPE.miniProgram){if(s.miniprogramRoot&&"."!==s.miniprogramRoot&&"./"!==s.miniprogramRoot){const i={};for(const t in v)i[path_1.default.posix.relative(e.miniprogramRoot,t)]=v[t];v=i}v["project.config.json"]=JSON.stringify({miniprogramRoot:"",__compileDebugInfo__:i.__compileDebugInfo__||{}}),delete v["project.private.config.json"]}else v["project.config.json"]=JSON.stringify({miniprogramRoot:e.miniprogramRoot||"",__compileDebugInfo__:i.__compileDebugInfo__||{}}),delete v["project.private.config.json"];return e.type===config_1.COMPILE_TYPE.miniProgram&&(null===(l=i.setting)||void 0===l?void 0:l.uglifyFileName)&&(v=await(0,uglifyfilenames_1.uglifyFileNames)(e,v)),v}exports.compile=compile;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";function getProcessEnv(){
|
|
1
|
+
"use strict";function windowOrSelf(e){return"undefined"!=typeof window?window[e]:"undefined"!=typeof self?self[e]:null}function getProcessEnv(){let e=null===process||void 0===process?void 0:process.env.cpprocessEnv;return"childprocess"===e||"workerthread"===e||"workerprocess"===e?e:"main"}function getHostEnv(){var e;return(null===(e=null===process||void 0===process?void 0:process.env)||void 0===e?void 0:e.isDevtools)||(null===process||void 0===process?void 0:process.__nwjs)&&"wechatwebdevtools"===nw.App.manifest.appname?"devtools":"undefined"!=typeof WEBIDE_WEBPECK_DEFINE_PLUGIN?"webide":"ci"}Object.defineProperty(exports,"__esModule",{value:!0}),exports.nativeProcess=exports.summerProcess=exports.hostEnv=exports.processEnv=void 0,exports.processEnv=getProcessEnv(),exports.hostEnv=getHostEnv();let summerProcessYet="1"===(null===process||void 0===process?void 0:process.env.summerProcess);exports.summerProcess=summerProcessYet;let nativeProcessYet="1"===(null===process||void 0===process?void 0:process.env.nativeProcess);exports.nativeProcess=nativeProcessYet;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var MSG_TYPE;Object.defineProperty(exports,"__esModule",{value:!0}),exports.MSG_TYPE=void 0,function(R){R.CREATE_WORKER="CREATE_WORKER",R.CREATE_WORKER_RESULT="CREATE_WORKER_RESULT",R.PROXY_WORKER_TO_FROM_WORKER_PROXY_MSG="PROXY_WORKER_TO_FROM_WORKER_PROXY_MSG",R.MAIN_TO_WORKER_PROXY_MSG="MAIN_TO_WORKER_PROXY_MSG",R.TERMINATE_WORKER_PROXY_MSG="TERMINATE_WORKER_PROXY_MSG",R.ON_WORKER_ERROR="ON_WORKER_ERROR",R.WEBWORKER_FS_OPERATE_CALLBACK="WEBWORKER_FS_OPERATE_CALLBACK",R.WEBWORKER_FS_OPERATE="WEBWORKER_FS_OPERATE",R.WEBWORKER_FS_OPERATE_SYNC="WEBWORKER_FS_OPERATE_SYNC",R.SYNC_CHANNEL="SYNC_CHANNEL",R.WORKER_LOGIC_MSG="WORKER_LOGIC_MSG"}(MSG_TYPE=exports.MSG_TYPE||(exports.MSG_TYPE={}));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const tslib_1=require("tslib"),log=tslib_1.__importStar(require("../../../../utils/log")),index_1=tslib_1.__importDefault(require("./task/index")),config_1=require("./config");let isbusy=!1;process.on("message",s=>{const{command:e,data:
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const tslib_1=require("tslib"),log=tslib_1.__importStar(require("../../../../utils/log")),index_1=tslib_1.__importDefault(require("./task/index")),config_1=require("./config"),getProcess_1=require("../../../../utils/subprocess/getProcess"),process=(0,getProcess_1.getProcess)();let isbusy=!1;process.on("message",s=>{const{command:e,data:r}=s;e===config_1.COMMAND.RUN_TASK&&(isbusy=!0,(0,index_1.default)(r.taskName,r.data).then(s=>{isbusy=!1,process.send({command:config_1.COMMAND.TASK_DONE,data:s})}).catch(s=>{isbusy=!1,process.send({command:config_1.COMMAND.TASK_DONE,data:{error:s.toString()}})}))}),process.on("SIGTERM",()=>{isbusy&&(log.error("forked sub process is kill when busy"),process.exit(1)),process.exit(0)});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const tslib_1=require("tslib"),os_1=tslib_1.__importDefault(require("os"));let cpus=1;cpus=os_1.default.cpus().length;const envCpus=parseInt(process.env.COMPILE_THREADS||"0",10);function default_1(){return cpus}envCpus<=0||envCpus>cpus||(cpus=envCpus),exports.default=default_1;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.abortTask=exports.runTask=void 0;const tslib_1=require("tslib"),logger_1=require("../utils/logger"),workerManager_1=require("./workerManager"),childprocessManager_1=require("./childprocessManager"),index_1=tslib_1.__importDefault(require("./task/index"));tslib_1.__exportStar(require("./config"),exports);const isDevtools=void 0!==process.env.__nwjs;async function runTask(r,e,o=(()=>{})){var
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.abortTask=exports.runTask=void 0;const tslib_1=require("tslib"),logger_1=require("../utils/logger"),workerManager_1=require("./workerManager"),childprocessManager_1=require("./childprocessManager"),index_1=tslib_1.__importDefault(require("./task/index"));tslib_1.__exportStar(require("./config"),exports);const isDevtools=void 0!==(null===process||void 0===process?void 0:process.env.__nwjs);async function runTask(r,e,o=(()=>{})){var s;if(logger_1.logger.info("runTask",r,e.filePath),global.__MINIPROGRAM_CI_TEST__||"true"===(null===(s=null===process||void 0===process?void 0:process.env)||void 0===s?void 0:s.__MINIPROGRAM_CI_TEST__))return(0,index_1.default)(r,e);try{if((null===process||void 0===process?void 0:process.__nwjs)&&"wechatwebdevtools"===nw.App.manifest.appname)return await childprocessManager_1.childProcessManager.runTask(r,e,o);const s=(0,workerManager_1.getWorkerManager)(isDevtools);return await s.runTask(r,e,o)}catch(o){if(o===workerManager_1.AbortEvent)throw o;if(logger_1.logger.error(`runTask ${r}, ${e.filePath} catch error ${o}`),o instanceof childprocessManager_1.ChildProcessCrashedError)throw new Error(`runTask ${r}, ${e.filePath} catch error ${o}`);return(0,index_1.default)(r,e)}}function abortTask(r){(0,workerManager_1.getWorkerManager)(isDevtools).abort(r)}exports.runTask=runTask,exports.abortTask=abortTask;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.minifyWXML=exports.StyleAttrValueTokenizer=exports.TemplateTokenizer=void 0;const tslib_1=require("tslib"),path_1=tslib_1.__importDefault(require("path")),log=tslib_1.__importStar(require("../../../../../utils/log")),config_1=require("../../../../../config/config");function getCharCode(T){return T.charCodeAt(0)>=256?BASE_STATE.OTHERS:T.charCodeAt(0)}function trimStringLeft(T,E=!0){return E?T.trimLeft():T.split("\n").map(T=>T.replace(/^[ \t]*/g,"")).join("\n")}function trimStringRight(T,E=!0){return E?T.trimRight():T.split("\n").map(T=>T.replace(/[ \t]*$/,"")).join("\n")}var TokenType,BASE_STATE,STATE,TEMPLATE_STATE,STYLE_ATTR_VALUE_STATE,ACTION;!function(T){T[T.ATTR=0]="ATTR",T[T.TAG=1]="TAG",T[T.LEFT_ANGLE_BRACKET=2]="LEFT_ANGLE_BRACKET",T[T.RIGHT_ANGLE_BRACKET=3]="RIGHT_ANGLE_BRACKET",T[T.END_LEFT_ANGLE_BRACKET=4]="END_LEFT_ANGLE_BRACKET",T[T.STRING1=5]="STRING1",T[T.STRING2=6]="STRING2",T[T.ATTR_VALUE=7]="ATTR_VALUE",T[T.TEXT_VALUE=8]="TEXT_VALUE",T[T.TAG_TEXT_VALUE=9]="TAG_TEXT_VALUE",T[T.TEMPLATE_START=10]="TEMPLATE_START",T[T.TEMPLATE_END=11]="TEMPLATE_END",T[T.TEMPLATE_ITEM=12]="TEMPLATE_ITEM",T[T.TEMPLATE_STRING=13]="TEMPLATE_STRING",T[T.SELF_CLOSE=14]="SELF_CLOSE",T[T.WXS_VALUE=15]="WXS_VALUE",T[T.STYLE_KEY=16]="STYLE_KEY",T[T.TAG_EQ=17]="TAG_EQ",T[T.STYLE_VALUE=18]="STYLE_VALUE",T[T.STYLE_ATTR_VALUE=19]="STYLE_ATTR_VALUE",T[T.CLASS_ATTR_VALUE=20]="CLASS_ATTR_VALUE",T[T.OTHERS=21]="OTHERS"}(TokenType||(TokenType={})),function(T){T[T.ERROR=-1]="ERROR",T[T.NOT_SET=0]="NOT_SET",T[T.START=1]="START",T[T.OTHERS=2]="OTHERS",T[T.END=3]="END",T[T.MAX_STATE=4]="MAX_STATE"}(BASE_STATE||(BASE_STATE={})),function(T){T[T.IN_TAG_TEXT=5]="IN_TAG_TEXT",T[T.TAG_START=6]="TAG_START",T[T.IN_TAG_WORD=7]="IN_TAG_WORD",T[T.TAG_EQ=8]="TAG_EQ",T[T.IN_TAG_ATTR_WORD=9]="IN_TAG_ATTR_WORD",T[T.IN_TAG_ATTR_VALUE_STRING=10]="IN_TAG_ATTR_VALUE_STRING",T[T.IN_TAG_ATTR_VALUE_STRING_ESCAPE=11]="IN_TAG_ATTR_VALUE_STRING_ESCAPE",T[T.IN_TAG_ATTR_VALUE_STRING_SINGLE=12]="IN_TAG_ATTR_VALUE_STRING_SINGLE",T[T.IN_TAG_ATTR_VALUE_STRING_SINGLE_ESCAPE=13]="IN_TAG_ATTR_VALUE_STRING_SINGLE_ESCAPE",T[T.WAIT_TEMPLATE_START=14]="WAIT_TEMPLATE_START",T[T.IN_TEMPLATE=15]="IN_TEMPLATE",T[T.WAIT_TEMPLATE_END=16]="WAIT_TEMPLATE_END",T[T.TEMPLATE_END_CHECK=17]="TEMPLATE_END_CHECK",T[T.IN_TEMPLATE_STRING=18]="IN_TEMPLATE_STRING",T[T.IN_TEMPLATE_STRING_ESCAPE=19]="IN_TEMPLATE_STRING_ESCAPE",T[T.IN_TEMPLATE_STRING2=20]="IN_TEMPLATE_STRING2",T[T.IN_TEMPLATE_STRING2_ESCAPE=21]="IN_TEMPLATE_STRING2_ESCAPE",T[T.WAIT_FOR_RIGHT_BRACKET=22]="WAIT_FOR_RIGHT_BRACKET",T[T.IN_WXS=23]="IN_WXS",T[T.IN_WXS_STRING=24]="IN_WXS_STRING",T[T.IN_WXS_STRING_ESCAPE=25]="IN_WXS_STRING_ESCAPE",T[T.IN_WXS_STRING_SINGLE=26]="IN_WXS_STRING_SINGLE",T[T.IN_WXS_STRING_SINGLE_ESCAPE=27]="IN_WXS_STRING_SINGLE_ESCAPE",T[T.WXS_END_STEP=28]="WXS_END_STEP",T[T.IN_COMMENT_BEGIN1=29]="IN_COMMENT_BEGIN1",T[T.IN_COMMENT_BEGIN2=30]="IN_COMMENT_BEGIN2",T[T.IN_COMMENT=31]="IN_COMMENT",T[T.WAIT_FOR_COMMENT_END1=32]="WAIT_FOR_COMMENT_END1",T[T.WAIT_FOR_COMMENT_END2=33]="WAIT_FOR_COMMENT_END2",T[T.IN_TEXT=34]="IN_TEXT",T[T.IN_END_TAG=35]="IN_END_TAG",T[T.IN_END_TAG_WORD=36]="IN_END_TAG_WORD",T[T.MAX_STATE=37]="MAX_STATE"}(STATE||(STATE={})),function(T){T[T.WAIT_TEMPLATE_START=5]="WAIT_TEMPLATE_START",T[T.IN_TEMPLATE_ITEM=6]="IN_TEMPLATE_ITEM",T[T.WAIT_TEMPLATE_END=7]="WAIT_TEMPLATE_END",T[T.SPACE_AFTER_WAIT_TEMPLATE_END=8]="SPACE_AFTER_WAIT_TEMPLATE_END",T[T.IN_TEMPLATE_STRING=9]="IN_TEMPLATE_STRING",T[T.IN_TEMPLATE_STRING_ESCAPE=10]="IN_TEMPLATE_STRING_ESCAPE",T[T.IN_TEMPLATE_STRING2=11]="IN_TEMPLATE_STRING2",T[T.IN_TEMPLATE_STRING2_ESCAPE=12]="IN_TEMPLATE_STRING2_ESCAPE",T[T.WAIT_FOR_COMMENT_START=13]="WAIT_FOR_COMMENT_START",T[T.IN_COMMENT=14]="IN_COMMENT",T[T.WAIT_FOR_COMMENT_END=15]="WAIT_FOR_COMMENT_END",T[T.IN_TEMPLATE_SPACE=16]="IN_TEMPLATE_SPACE",T[T.MAX_STATE=17]="MAX_STATE"}(TEMPLATE_STATE||(TEMPLATE_STATE={})),function(T){T[T.WAIT_KEY=5]="WAIT_KEY",T[T.IN_KEY=6]="IN_KEY",T[T.WAIT_KEY_VALUE_SAPERATE=7]="WAIT_KEY_VALUE_SAPERATE",T[T.IN_KEY_VALUE_SAPERATE=8]="IN_KEY_VALUE_SAPERATE",T[T.WAIT_VALUE=9]="WAIT_VALUE",T[T.IN_VALUE=10]="IN_VALUE",T[T.WAIT_ITEM_SAPERATE=11]="WAIT_ITEM_SAPERATE",T[T.IN_ITEM_SAPERATE=12]="IN_ITEM_SAPERATE",T[T.IN_STRING=13]="IN_STRING",T[T.IN_STRING_ESCAPE=14]="IN_STRING_ESCAPE",T[T.IN_STRING2=15]="IN_STRING2",T[T.IN_STRING2_ESCAPE=16]="IN_STRING2_ESCAPE",T[T.WAIT_TEMPLATE_START=17]="WAIT_TEMPLATE_START",T[T.IN_TEMPLATE=18]="IN_TEMPLATE",T[T.WAIT_TEMPLATE_END=19]="WAIT_TEMPLATE_END",T[T.IN_TEMPLATE_STRING=20]="IN_TEMPLATE_STRING",T[T.IN_TEMPLATE_STRING_ESCAPE=21]="IN_TEMPLATE_STRING_ESCAPE",T[T.IN_TEMPLATE_STRING2=22]="IN_TEMPLATE_STRING2",T[T.IN_TEMPLATE_STRING2_ESCAPE=23]="IN_TEMPLATE_STRING2_ESCAPE",T[T.WAIT_FOR_COMMENT_START=24]="WAIT_FOR_COMMENT_START",T[T.IN_COMMENT=25]="IN_COMMENT",T[T.WAIT_FOR_COMMENT_END=26]="WAIT_FOR_COMMENT_END",T[T.MAX_STATE=27]="MAX_STATE"}(STYLE_ATTR_VALUE_STATE||(STYLE_ATTR_VALUE_STATE={})),function(T){T[T.NOTHING=0]="NOTHING",T[T.DO_ACTION=65536]="DO_ACTION",T[T.STORE_TOKEN_EXCLUDE=131072]="STORE_TOKEN_EXCLUDE",T[T.STORE_TOKEN_INCLUDE=262144]="STORE_TOKEN_INCLUDE",T[T.IGNORE=524288]="IGNORE",T[T.REFEED=1048576]="REFEED",T[T.STORE_TOKEN_FIRST=2097152]="STORE_TOKEN_FIRST",T[T.STORE_ONE_SPACE=4194304]="STORE_ONE_SPACE",T[T.STORE_ONE_LINE_BREAK=8388608]="STORE_ONE_LINE_BREAK",T[T.GET_STATE_BEFORE=16777216]="GET_STATE_BEFORE",T[T.STORE_STATE_BEFORE=33554432]="STORE_STATE_BEFORE",T[T.SET_WXS_STATE=67108864]="SET_WXS_STATE",T[T.RECORD_IN_TEMPLATE_OBJECT=134217728]="RECORD_IN_TEMPLATE_OBJECT",T[T.CHECK_IN_TEMPLATE_OBJECT=268435456]="CHECK_IN_TEMPLATE_OBJECT"}(ACTION||(ACTION={}));class Token{constructor(T,E){this.type=T,this.value=E}}class MachineState{constructor(){this.cur_pos=0,this.last_pos=0,this.line=1,this.col=1,this.mark_pos=0,this.mark_col=0,this.last_line=this.line,this.last_col=1,this.state=BASE_STATE.START,this.in_template_object_count=0}}const ALPHA="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_-:",DIGIT="0123456789.",WHITECHARS=" \n\t\r";class BaseMachine{constructor(T,E){this.mState=new MachineState,this.storedStates=[],this.oldState=BASE_STATE.START,this.tokens=[],this.mPath=T,this.mSrc=E}FillTT(T,E,_,A){for(const S of A)this.TT[T][getCharCode(S)]=E|_}Reset(){return this.mState.cur_pos=0,this.mState.last_pos=0,this.mState.mark_pos=0,this.mState.line=1,this.mState.col=1,this.mState.last_col=1,this.mState.mark_col=1,this.mState.last_line=this.mState.line,this.mState.state=BASE_STATE.START,0}refeed(T){let E=this.TT[this.mState.state][getCharCode(T)];if(E===BASE_STATE.NOT_SET&&(E=this.TT[this.mState.state][BASE_STATE.OTHERS]),E===BASE_STATE.NOT_SET)throw{col:this.mState.col,line:this.mState.line,message:"BAD STATE MACHINE!"};if(E<0){if("\0"!==T)throw{col:this.mState.col,line:this.mState.line,message:`unexpected character \`${T.replace(/\n/g,"\\n")}\``};throw{col:this.mState.col,line:this.mState.line,message:"unexpected end"}}const _=E,A=65535&E,S=this.mState.state;_&ACTION.STORE_STATE_BEFORE&&(this.storedStates.push(S),this.mState.mark_pos=this.mState.cur_pos,this.mState.mark_col=this.mState.mark_col),this.mState.state=A,this.doAction(T,S,_)}Feed(T){"\n"===T&&(this.mState.line++,this.mState.col=0),this.refeed(T)}FillTT_template_string(T,E,_){const A=T+1;this.TT[T][getCharCode("\\")]=A,this.TT[A][BASE_STATE.OTHERS]=T,this.TT[T][getCharCode(_)]=E,this.TT[T][0]=BASE_STATE.ERROR,this.TT[T][BASE_STATE.OTHERS]=T}updatePosition(){this.mState.last_pos=this.mState.cur_pos,this.mState.last_col=this.mState.col,this.mState.last_line=this.mState.line}processPosition(){this.mState.cur_pos++,this.mState.col++}doAction(T,E,_){if(_&ACTION.STORE_TOKEN_FIRST&&this.mState.mark_pos>this.mState.last_pos){const T=this.mSrc.substring(this.mState.last_pos,this.mState.mark_pos);this.doExcludeAction(this.storedStates[this.storedStates.length-1],T),this.mState.last_pos=this.mState.mark_pos,this.mState.last_col=this.mState.mark_col}if(_&ACTION.STORE_ONE_LINE_BREAK&&(this.appendToken(TokenType.OTHERS,"\n"),this.updatePosition()),_&ACTION.STORE_ONE_SPACE&&(this.appendToken(TokenType.OTHERS," "),this.updatePosition()),_&ACTION.STORE_TOKEN_EXCLUDE){const T=this.mState.cur_pos,_=this.mState.last_pos;if(T>=_){const A=this.mSrc.substring(_,T);this.doExcludeAction(E,A),this.updatePosition()}}if(_&ACTION.RECORD_IN_TEMPLATE_OBJECT&&this.mState.in_template_object_count++,_&ACTION.CHECK_IN_TEMPLATE_OBJECT&&this.mState.in_template_object_count>0&&(this.mState.in_template_object_count--,this.mState.state=STATE.IN_TEMPLATE),_&ACTION.REFEED){if(_&ACTION.IGNORE&&this.updatePosition(),_&ACTION.GET_STATE_BEFORE){const T=this.storedStates.pop();T&&(this.mState.state=T)}this.refeed(T)}else{if(this.processPosition(),_&ACTION.STORE_TOKEN_INCLUDE){const _=this.mSrc.substring(this.mState.last_pos,this.mState.cur_pos);this.doIncludeAction(T,E,_),this.updatePosition()}if(_&ACTION.IGNORE&&this.updatePosition(),_&ACTION.GET_STATE_BEFORE){const T=this.storedStates.pop();T&&(this.mState.state=T)}}}}class StyleAttrValueMachine extends BaseMachine{get TT(){return StyleAttrValueMachine._TT||this.InitTransitTable(),StyleAttrValueMachine._TT}constructor(T,E){super(T,E),this.mState.state=BASE_STATE.START}getTokens(){return[...this.tokens]}appendToken(T,E){T===TokenType.STYLE_VALUE&&(E=E.replace(/[ \t]+/g," ")),this.tokens.push(new Token(T,E))}doExcludeAction(T,E){let _=TokenType.OTHERS;switch(T){case STYLE_ATTR_VALUE_STATE.IN_KEY:_=TokenType.STYLE_KEY;break;case STYLE_ATTR_VALUE_STATE.IN_KEY_VALUE_SAPERATE:_=TokenType.OTHERS;break;case STYLE_ATTR_VALUE_STATE.IN_ITEM_SAPERATE:_=TokenType.OTHERS,E=";";break;case STYLE_ATTR_VALUE_STATE.IN_VALUE:_=TokenType.STYLE_VALUE}this.appendToken(_,E)}doIncludeAction(T,E,_){let A=TokenType.OTHERS;switch(E){case STYLE_ATTR_VALUE_STATE.IN_STRING:A=TokenType.STRING1;break;case STYLE_ATTR_VALUE_STATE.IN_STRING2:A=TokenType.STRING2;break;case STYLE_ATTR_VALUE_STATE.WAIT_TEMPLATE_END:A=TokenType.TEMPLATE_ITEM,_=new TemplateTokenizer(_,this.mPath).toString();break;case STYLE_ATTR_VALUE_STATE.WAIT_FOR_COMMENT_START:this.doExcludeAction(this.storedStates[this.storedStates.length-1],_.replace(/\/\*$/,"")),A=TokenType.OTHERS,_="/*";break;case STYLE_ATTR_VALUE_STATE.WAIT_FOR_COMMENT_END:A=TokenType.OTHERS,_="*/"}this.appendToken(A,_)}FillTT_string(T,E,_){const A=T+1;this.TT[T][getCharCode("\\")]=A,this.TT[T][getCharCode("\n")]=BASE_STATE.ERROR,this.TT[A][BASE_STATE.OTHERS]=T,this.TT[A][getCharCode("\n")]=E|ACTION.STORE_TOKEN_EXCLUDE|ACTION.IGNORE,this.TT[T][getCharCode(_)]=E|ACTION.STORE_TOKEN_INCLUDE,this.TT[T][getCharCode("{")]=STYLE_ATTR_VALUE_STATE.WAIT_TEMPLATE_START|ACTION.STORE_STATE_BEFORE,this.TT[T][0]=BASE_STATE.ERROR,this.TT[T][BASE_STATE.OTHERS]=T}InitTransitTable(){StyleAttrValueMachine._TT=new Array(STYLE_ATTR_VALUE_STATE.MAX_STATE);for(let T=0;T<STYLE_ATTR_VALUE_STATE.MAX_STATE;T++){const E=new Array(257);E.fill(0),this.TT[T]=E}this.TT[BASE_STATE.END][BASE_STATE.OTHERS]=BASE_STATE.END,this.FillTT(BASE_STATE.START,BASE_STATE.START,ACTION.IGNORE," \n\t\r"),this.TT[BASE_STATE.START][getCharCode(":")]=BASE_STATE.ERROR,this.TT[BASE_STATE.START][getCharCode(";")]=STYLE_ATTR_VALUE_STATE.IN_ITEM_SAPERATE|ACTION.STORE_TOKEN_EXCLUDE,this.TT[BASE_STATE.START][getCharCode("{")]=STYLE_ATTR_VALUE_STATE.WAIT_TEMPLATE_START|ACTION.STORE_STATE_BEFORE,this.TT[BASE_STATE.START][getCharCode("/")]=STYLE_ATTR_VALUE_STATE.WAIT_FOR_COMMENT_START|ACTION.STORE_STATE_BEFORE,this.TT[BASE_STATE.START][BASE_STATE.OTHERS]=STYLE_ATTR_VALUE_STATE.IN_KEY,this.FillTT(STYLE_ATTR_VALUE_STATE.WAIT_KEY,STYLE_ATTR_VALUE_STATE.WAIT_KEY,ACTION.IGNORE," \n\t\r"),this.TT[STYLE_ATTR_VALUE_STATE.WAIT_KEY][getCharCode(":")]=BASE_STATE.ERROR,this.TT[STYLE_ATTR_VALUE_STATE.WAIT_KEY][getCharCode(";")]=STYLE_ATTR_VALUE_STATE.IN_ITEM_SAPERATE|ACTION.STORE_TOKEN_EXCLUDE,this.TT[STYLE_ATTR_VALUE_STATE.WAIT_KEY][getCharCode("{")]=STYLE_ATTR_VALUE_STATE.IN_KEY|ACTION.REFEED,this.TT[STYLE_ATTR_VALUE_STATE.WAIT_KEY][BASE_STATE.OTHERS]=STYLE_ATTR_VALUE_STATE.IN_KEY,this.TT[STYLE_ATTR_VALUE_STATE.WAIT_KEY][getCharCode("/")]=STYLE_ATTR_VALUE_STATE.WAIT_FOR_COMMENT_START|ACTION.STORE_STATE_BEFORE,this.FillTT(STYLE_ATTR_VALUE_STATE.IN_KEY,STYLE_ATTR_VALUE_STATE.WAIT_KEY_VALUE_SAPERATE,ACTION.STORE_TOKEN_EXCLUDE|ACTION.IGNORE," \n\t\r"),this.TT[STYLE_ATTR_VALUE_STATE.IN_KEY][getCharCode(":")]=STYLE_ATTR_VALUE_STATE.IN_KEY_VALUE_SAPERATE|ACTION.STORE_TOKEN_EXCLUDE,this.TT[STYLE_ATTR_VALUE_STATE.IN_KEY][getCharCode(";")]=STYLE_ATTR_VALUE_STATE.IN_ITEM_SAPERATE|ACTION.STORE_TOKEN_EXCLUDE,this.TT[STYLE_ATTR_VALUE_STATE.IN_KEY][getCharCode("{")]=STYLE_ATTR_VALUE_STATE.WAIT_TEMPLATE_START|ACTION.STORE_STATE_BEFORE,this.TT[STYLE_ATTR_VALUE_STATE.IN_KEY][getCharCode('"')]=BASE_STATE.ERROR,this.TT[STYLE_ATTR_VALUE_STATE.IN_KEY][getCharCode("'")]=BASE_STATE.ERROR,this.TT[STYLE_ATTR_VALUE_STATE.IN_KEY][BASE_STATE.OTHERS]=STYLE_ATTR_VALUE_STATE.IN_KEY,this.TT[STYLE_ATTR_VALUE_STATE.IN_KEY][getCharCode("/")]=STYLE_ATTR_VALUE_STATE.WAIT_FOR_COMMENT_START|ACTION.STORE_STATE_BEFORE,this.FillTT(STYLE_ATTR_VALUE_STATE.WAIT_KEY_VALUE_SAPERATE,STYLE_ATTR_VALUE_STATE.WAIT_KEY_VALUE_SAPERATE,ACTION.IGNORE," \n\t\r"),this.TT[STYLE_ATTR_VALUE_STATE.WAIT_KEY_VALUE_SAPERATE][getCharCode(":")]=STYLE_ATTR_VALUE_STATE.IN_KEY_VALUE_SAPERATE|ACTION.STORE_TOKEN_EXCLUDE,this.TT[STYLE_ATTR_VALUE_STATE.WAIT_KEY_VALUE_SAPERATE][getCharCode(";")]=STYLE_ATTR_VALUE_STATE.WAIT_KEY|ACTION.STORE_TOKEN_EXCLUDE,this.TT[STYLE_ATTR_VALUE_STATE.WAIT_KEY_VALUE_SAPERATE][BASE_STATE.OTHERS]=BASE_STATE.ERROR,this.TT[STYLE_ATTR_VALUE_STATE.WAIT_KEY_VALUE_SAPERATE][getCharCode("/")]=STYLE_ATTR_VALUE_STATE.WAIT_FOR_COMMENT_START|ACTION.STORE_STATE_BEFORE,this.FillTT(STYLE_ATTR_VALUE_STATE.IN_KEY_VALUE_SAPERATE,STYLE_ATTR_VALUE_STATE.WAIT_VALUE,ACTION.STORE_TOKEN_EXCLUDE|ACTION.IGNORE," \n\t\r"),this.TT[STYLE_ATTR_VALUE_STATE.IN_KEY_VALUE_SAPERATE][getCharCode(":")]=STYLE_ATTR_VALUE_STATE.IN_KEY_VALUE_SAPERATE|ACTION.STORE_TOKEN_EXCLUDE,this.TT[STYLE_ATTR_VALUE_STATE.IN_KEY_VALUE_SAPERATE][getCharCode(";")]=STYLE_ATTR_VALUE_STATE.IN_ITEM_SAPERATE|ACTION.STORE_TOKEN_EXCLUDE,this.TT[STYLE_ATTR_VALUE_STATE.IN_KEY_VALUE_SAPERATE][BASE_STATE.OTHERS]=STYLE_ATTR_VALUE_STATE.IN_VALUE|ACTION.STORE_TOKEN_EXCLUDE,this.TT[STYLE_ATTR_VALUE_STATE.IN_KEY_VALUE_SAPERATE][getCharCode("\0")]=BASE_STATE.END|ACTION.STORE_TOKEN_EXCLUDE,this.TT[STYLE_ATTR_VALUE_STATE.IN_KEY_VALUE_SAPERATE][getCharCode('"')]=STYLE_ATTR_VALUE_STATE.IN_VALUE|ACTION.REFEED,this.TT[STYLE_ATTR_VALUE_STATE.IN_KEY_VALUE_SAPERATE][getCharCode("'")]=STYLE_ATTR_VALUE_STATE.IN_VALUE|ACTION.REFEED,this.TT[STYLE_ATTR_VALUE_STATE.IN_KEY_VALUE_SAPERATE][getCharCode("/")]=STYLE_ATTR_VALUE_STATE.IN_VALUE|ACTION.REFEED|ACTION.STORE_TOKEN_EXCLUDE,this.FillTT(STYLE_ATTR_VALUE_STATE.WAIT_VALUE,STYLE_ATTR_VALUE_STATE.WAIT_VALUE,ACTION.IGNORE," \n\t\r"),this.TT[STYLE_ATTR_VALUE_STATE.WAIT_VALUE][getCharCode(":")]=BASE_STATE.ERROR,this.TT[STYLE_ATTR_VALUE_STATE.WAIT_VALUE][getCharCode(";")]=STYLE_ATTR_VALUE_STATE.IN_ITEM_SAPERATE|ACTION.STORE_TOKEN_EXCLUDE,this.TT[STYLE_ATTR_VALUE_STATE.WAIT_VALUE][getCharCode("{")]=STYLE_ATTR_VALUE_STATE.WAIT_TEMPLATE_START|ACTION.STORE_STATE_BEFORE,this.TT[STYLE_ATTR_VALUE_STATE.WAIT_VALUE][getCharCode('"')]=STYLE_ATTR_VALUE_STATE.IN_VALUE|ACTION.REFEED,this.TT[STYLE_ATTR_VALUE_STATE.WAIT_VALUE][getCharCode("'")]=STYLE_ATTR_VALUE_STATE.IN_VALUE|ACTION.REFEED,this.TT[STYLE_ATTR_VALUE_STATE.WAIT_VALUE][getCharCode("\0")]=BASE_STATE.END,this.TT[STYLE_ATTR_VALUE_STATE.WAIT_VALUE][BASE_STATE.OTHERS]=STYLE_ATTR_VALUE_STATE.IN_VALUE,this.TT[STYLE_ATTR_VALUE_STATE.WAIT_VALUE][getCharCode("/")]=STYLE_ATTR_VALUE_STATE.WAIT_FOR_COMMENT_START|ACTION.STORE_STATE_BEFORE,this.TT[STYLE_ATTR_VALUE_STATE.IN_VALUE][getCharCode(";")]=STYLE_ATTR_VALUE_STATE.IN_ITEM_SAPERATE|ACTION.STORE_TOKEN_EXCLUDE,this.TT[STYLE_ATTR_VALUE_STATE.IN_VALUE][getCharCode('"')]=STYLE_ATTR_VALUE_STATE.IN_STRING|ACTION.STORE_STATE_BEFORE|ACTION.STORE_TOKEN_EXCLUDE,this.TT[STYLE_ATTR_VALUE_STATE.IN_VALUE][getCharCode("'")]=STYLE_ATTR_VALUE_STATE.IN_STRING2|ACTION.STORE_STATE_BEFORE|ACTION.STORE_TOKEN_EXCLUDE,this.TT[STYLE_ATTR_VALUE_STATE.IN_VALUE][getCharCode("{")]=STYLE_ATTR_VALUE_STATE.WAIT_TEMPLATE_START|ACTION.STORE_STATE_BEFORE,this.TT[STYLE_ATTR_VALUE_STATE.IN_VALUE][BASE_STATE.OTHERS]=STYLE_ATTR_VALUE_STATE.IN_VALUE,this.TT[STYLE_ATTR_VALUE_STATE.IN_VALUE][getCharCode("\0")]=BASE_STATE.END|ACTION.STORE_TOKEN_EXCLUDE,this.TT[STYLE_ATTR_VALUE_STATE.IN_VALUE][getCharCode("/")]=STYLE_ATTR_VALUE_STATE.WAIT_FOR_COMMENT_START|ACTION.STORE_STATE_BEFORE,this.FillTT(STYLE_ATTR_VALUE_STATE.IN_ITEM_SAPERATE,STYLE_ATTR_VALUE_STATE.WAIT_KEY,ACTION.STORE_TOKEN_EXCLUDE|ACTION.IGNORE," \n\t\r"),this.TT[STYLE_ATTR_VALUE_STATE.IN_ITEM_SAPERATE][getCharCode(";")]=STYLE_ATTR_VALUE_STATE.IN_ITEM_SAPERATE|ACTION.STORE_TOKEN_EXCLUDE,this.TT[STYLE_ATTR_VALUE_STATE.IN_ITEM_SAPERATE][getCharCode("{")]=STYLE_ATTR_VALUE_STATE.WAIT_TEMPLATE_START|ACTION.STORE_STATE_BEFORE,this.TT[STYLE_ATTR_VALUE_STATE.IN_ITEM_SAPERATE][getCharCode("'")]=BASE_STATE.ERROR,this.TT[STYLE_ATTR_VALUE_STATE.IN_ITEM_SAPERATE][getCharCode('"')]=BASE_STATE.ERROR,this.TT[STYLE_ATTR_VALUE_STATE.IN_ITEM_SAPERATE][BASE_STATE.OTHERS]=STYLE_ATTR_VALUE_STATE.IN_KEY|ACTION.STORE_TOKEN_EXCLUDE,this.TT[STYLE_ATTR_VALUE_STATE.IN_ITEM_SAPERATE][getCharCode("\0")]=BASE_STATE.END|ACTION.STORE_TOKEN_EXCLUDE,this.TT[STYLE_ATTR_VALUE_STATE.IN_ITEM_SAPERATE][getCharCode("/")]=STYLE_ATTR_VALUE_STATE.IN_KEY|ACTION.REFEED,this.TT[STYLE_ATTR_VALUE_STATE.WAIT_TEMPLATE_START][getCharCode("{")]=STYLE_ATTR_VALUE_STATE.IN_TEMPLATE|ACTION.STORE_TOKEN_FIRST,this.TT[STYLE_ATTR_VALUE_STATE.WAIT_TEMPLATE_START][BASE_STATE.OTHERS]=ACTION.GET_STATE_BEFORE,this.TT[STYLE_ATTR_VALUE_STATE.WAIT_TEMPLATE_START][getCharCode("/")]=STYLE_ATTR_VALUE_STATE.WAIT_FOR_COMMENT_START|ACTION.STORE_STATE_BEFORE,this.TT[STYLE_ATTR_VALUE_STATE.IN_TEMPLATE][getCharCode("}")]=STYLE_ATTR_VALUE_STATE.WAIT_TEMPLATE_END,this.TT[STYLE_ATTR_VALUE_STATE.IN_TEMPLATE][getCharCode("\\")]=BASE_STATE.ERROR,this.FillTT(STYLE_ATTR_VALUE_STATE.IN_TEMPLATE,STYLE_ATTR_VALUE_STATE.IN_TEMPLATE,ACTION.NOTHING," \n\t\r"),this.TT[STYLE_ATTR_VALUE_STATE.IN_TEMPLATE][BASE_STATE.OTHERS]=STYLE_ATTR_VALUE_STATE.IN_TEMPLATE,this.TT[STYLE_ATTR_VALUE_STATE.IN_TEMPLATE][0]=BASE_STATE.ERROR,this.TT[STYLE_ATTR_VALUE_STATE.IN_TEMPLATE][getCharCode("/")]=STYLE_ATTR_VALUE_STATE.WAIT_FOR_COMMENT_START|ACTION.STORE_STATE_BEFORE,this.TT[STYLE_ATTR_VALUE_STATE.WAIT_TEMPLATE_END][getCharCode("}")]=ACTION.GET_STATE_BEFORE|ACTION.STORE_TOKEN_INCLUDE,this.TT[STYLE_ATTR_VALUE_STATE.WAIT_TEMPLATE_END][BASE_STATE.OTHERS]=STYLE_ATTR_VALUE_STATE.IN_TEMPLATE|ACTION.REFEED,this.TT[STYLE_ATTR_VALUE_STATE.WAIT_TEMPLATE_END][getCharCode("/")]=STYLE_ATTR_VALUE_STATE.WAIT_FOR_COMMENT_START|ACTION.STORE_STATE_BEFORE,this.TT[STYLE_ATTR_VALUE_STATE.IN_TEMPLATE][getCharCode('"')]=STYLE_ATTR_VALUE_STATE.IN_TEMPLATE_STRING|ACTION.NOTHING,this.TT[STYLE_ATTR_VALUE_STATE.IN_TEMPLATE][getCharCode("'")]=STYLE_ATTR_VALUE_STATE.IN_TEMPLATE_STRING2|ACTION.NOTHING,this.TT[STYLE_ATTR_VALUE_STATE.WAIT_FOR_COMMENT_START][getCharCode("*")]=STYLE_ATTR_VALUE_STATE.IN_COMMENT|ACTION.STORE_TOKEN_INCLUDE,this.TT[STYLE_ATTR_VALUE_STATE.WAIT_FOR_COMMENT_START][BASE_STATE.OTHERS]=ACTION.GET_STATE_BEFORE,this.TT[STYLE_ATTR_VALUE_STATE.IN_COMMENT][getCharCode("*")]=STYLE_ATTR_VALUE_STATE.WAIT_FOR_COMMENT_END,this.TT[STYLE_ATTR_VALUE_STATE.IN_COMMENT][BASE_STATE.OTHERS]=STYLE_ATTR_VALUE_STATE.IN_COMMENT|ACTION.IGNORE,this.TT[STYLE_ATTR_VALUE_STATE.WAIT_FOR_COMMENT_END][getCharCode("/")]=ACTION.GET_STATE_BEFORE|ACTION.STORE_TOKEN_INCLUDE,this.TT[STYLE_ATTR_VALUE_STATE.WAIT_FOR_COMMENT_END][BASE_STATE.OTHERS]=STYLE_ATTR_VALUE_STATE.IN_COMMENT|ACTION.NOTHING,this.FillTT_template_string(STYLE_ATTR_VALUE_STATE.IN_TEMPLATE_STRING,STYLE_ATTR_VALUE_STATE.IN_TEMPLATE|ACTION.NOTHING,'"'),this.FillTT_template_string(STYLE_ATTR_VALUE_STATE.IN_TEMPLATE_STRING2,STYLE_ATTR_VALUE_STATE.IN_TEMPLATE|ACTION.NOTHING,"'"),this.FillTT_string(STYLE_ATTR_VALUE_STATE.IN_STRING,ACTION.GET_STATE_BEFORE,'"'),this.FillTT_string(STYLE_ATTR_VALUE_STATE.IN_STRING2,ACTION.GET_STATE_BEFORE,"'")}}class TemplateMachine extends BaseMachine{get TT(){return TemplateMachine._TT||this.InitTransitTable(),TemplateMachine._TT}constructor(T,E){super(T,E),this.mState.state=BASE_STATE.START}getTokens(){return[...this.tokens]}appendToken(T,E){this.tokens.push(new Token(T,E))}doExcludeAction(T,E){let _=TokenType.OTHERS;switch(T){case TEMPLATE_STATE.IN_TEMPLATE_ITEM:case TEMPLATE_STATE.WAIT_TEMPLATE_END:_=TokenType.TEMPLATE_ITEM}this.appendToken(_,E)}doIncludeAction(T,E,_){let A=TokenType.OTHERS;switch(E){case TEMPLATE_STATE.WAIT_TEMPLATE_START:A=TokenType.TEMPLATE_START;break;case TEMPLATE_STATE.WAIT_TEMPLATE_END:A=TokenType.TEMPLATE_END}this.appendToken(A,_)}InitTransitTable(){TemplateMachine._TT=new Array(TEMPLATE_STATE.MAX_STATE);for(let T=0;T<TEMPLATE_STATE.MAX_STATE;T++){const E=new Array(257);E.fill(0),this.TT[T]=E}this.FillTT(BASE_STATE.START,BASE_STATE.START,ACTION.IGNORE," \n\t\r"),this.TT[BASE_STATE.START][getCharCode("{")]=TEMPLATE_STATE.WAIT_TEMPLATE_START,this.TT[BASE_STATE.START][BASE_STATE.OTHERS]=BASE_STATE.ERROR,this.TT[TEMPLATE_STATE.WAIT_TEMPLATE_START][getCharCode("{")]=TEMPLATE_STATE.IN_TEMPLATE_ITEM|ACTION.STORE_TOKEN_INCLUDE,this.TT[TEMPLATE_STATE.WAIT_TEMPLATE_START][BASE_STATE.OTHERS]=BASE_STATE.ERROR,this.FillTT(TEMPLATE_STATE.IN_TEMPLATE_SPACE,TEMPLATE_STATE.IN_TEMPLATE_SPACE,ACTION.IGNORE," \n\t\r"),this.TT[TEMPLATE_STATE.IN_TEMPLATE_SPACE][getCharCode("}")]=TEMPLATE_STATE.WAIT_TEMPLATE_END,this.TT[TEMPLATE_STATE.IN_TEMPLATE_SPACE][getCharCode('"')]=TEMPLATE_STATE.IN_TEMPLATE_STRING|ACTION.STORE_STATE_BEFORE,this.TT[TEMPLATE_STATE.IN_TEMPLATE_SPACE][getCharCode("'")]=TEMPLATE_STATE.IN_TEMPLATE_STRING2|ACTION.STORE_STATE_BEFORE,this.TT[TEMPLATE_STATE.IN_TEMPLATE_SPACE][getCharCode("/")]=TEMPLATE_STATE.WAIT_FOR_COMMENT_START,this.TT[TEMPLATE_STATE.IN_TEMPLATE_SPACE][BASE_STATE.OTHERS]=TEMPLATE_STATE.IN_TEMPLATE_ITEM,this.FillTT(TEMPLATE_STATE.IN_TEMPLATE_ITEM,TEMPLATE_STATE.IN_TEMPLATE_SPACE,ACTION.STORE_TOKEN_EXCLUDE|ACTION.IGNORE," \n\t\r"),this.TT[TEMPLATE_STATE.IN_TEMPLATE_ITEM][getCharCode("}")]=TEMPLATE_STATE.WAIT_TEMPLATE_END,this.TT[TEMPLATE_STATE.IN_TEMPLATE_ITEM][getCharCode("\\")]=BASE_STATE.ERROR,this.TT[TEMPLATE_STATE.IN_TEMPLATE_ITEM][getCharCode('"')]=TEMPLATE_STATE.IN_TEMPLATE_STRING|ACTION.STORE_STATE_BEFORE|ACTION.STORE_TOKEN_EXCLUDE,this.TT[TEMPLATE_STATE.IN_TEMPLATE_ITEM][getCharCode("'")]=TEMPLATE_STATE.IN_TEMPLATE_STRING2|ACTION.STORE_STATE_BEFORE|ACTION.STORE_TOKEN_EXCLUDE,this.TT[TEMPLATE_STATE.IN_TEMPLATE_ITEM][BASE_STATE.OTHERS]=TEMPLATE_STATE.IN_TEMPLATE_ITEM,this.TT[TEMPLATE_STATE.IN_TEMPLATE_ITEM][0]=BASE_STATE.ERROR,this.TT[TEMPLATE_STATE.WAIT_FOR_COMMENT_START][getCharCode("*")]=TEMPLATE_STATE.IN_COMMENT,this.FillTT(TEMPLATE_STATE.WAIT_FOR_COMMENT_START,TEMPLATE_STATE.IN_TEMPLATE_ITEM,ACTION.REFEED," \n\t\r"),this.TT[TEMPLATE_STATE.WAIT_FOR_COMMENT_START][BASE_STATE.OTHERS]=TEMPLATE_STATE.IN_TEMPLATE_ITEM,this.TT[TEMPLATE_STATE.IN_COMMENT][getCharCode("*")]=TEMPLATE_STATE.WAIT_FOR_COMMENT_END,this.TT[TEMPLATE_STATE.IN_COMMENT][BASE_STATE.OTHERS]=TEMPLATE_STATE.IN_COMMENT,this.TT[TEMPLATE_STATE.WAIT_FOR_COMMENT_END][getCharCode("/")]=TEMPLATE_STATE.IN_TEMPLATE_SPACE|ACTION.IGNORE,this.FillTT_template_string(TEMPLATE_STATE.IN_TEMPLATE_STRING,TEMPLATE_STATE.IN_TEMPLATE_ITEM|ACTION.STORE_TOKEN_INCLUDE|ACTION.GET_STATE_BEFORE,'"'),this.FillTT_template_string(TEMPLATE_STATE.IN_TEMPLATE_STRING2,TEMPLATE_STATE.IN_TEMPLATE_ITEM|ACTION.STORE_TOKEN_INCLUDE|ACTION.GET_STATE_BEFORE,"'"),this.TT[TEMPLATE_STATE.WAIT_TEMPLATE_END][getCharCode("}")]=BASE_STATE.END|ACTION.STORE_TOKEN_INCLUDE,this.FillTT(TEMPLATE_STATE.WAIT_TEMPLATE_END,TEMPLATE_STATE.SPACE_AFTER_WAIT_TEMPLATE_END,ACTION.STORE_TOKEN_EXCLUDE," \n\t\r"),this.TT[TEMPLATE_STATE.WAIT_TEMPLATE_END][BASE_STATE.OTHERS]=TEMPLATE_STATE.IN_TEMPLATE_ITEM|ACTION.REFEED,this.FillTT(TEMPLATE_STATE.SPACE_AFTER_WAIT_TEMPLATE_END,TEMPLATE_STATE.SPACE_AFTER_WAIT_TEMPLATE_END,ACTION.IGNORE," \n\t\r"),this.TT[TEMPLATE_STATE.SPACE_AFTER_WAIT_TEMPLATE_END][getCharCode("}")]=TEMPLATE_STATE.WAIT_TEMPLATE_END|ACTION.STORE_ONE_SPACE,this.TT[TEMPLATE_STATE.SPACE_AFTER_WAIT_TEMPLATE_END][BASE_STATE.OTHERS]=TEMPLATE_STATE.IN_TEMPLATE_ITEM|ACTION.IGNORE|ACTION.REFEED,this.FillTT(BASE_STATE.END,BASE_STATE.END,ACTION.IGNORE," \n\t\r"),this.TT[BASE_STATE.END][getCharCode("\0")]=BASE_STATE.END,this.TT[BASE_STATE.END][BASE_STATE.OTHERS]=BASE_STATE.ERROR}}class TemplateTokenizer{constructor(T,E){this.machine=new TemplateMachine(E,T),this.m_pSrc=T,this.path=E}toString(){this.tokens||(this.tokens=this.generateTokens());return this.tokens.map(T=>T.value).join("")}generateTokens(){if(this.machine.Reset(),0===this.m_pSrc.length)return[];for(let T=0;T<this.m_pSrc.length;T++){const E=this.m_pSrc[T];this.machine.Feed(E)}return this.machine.Feed("\0"),this.machine.getTokens()}}exports.TemplateTokenizer=TemplateTokenizer;class StyleAttrValueTokenizer{constructor(T,E){this.machine=new StyleAttrValueMachine(E,T),this.m_pSrc=T,this.path=E}toString(){return this.tokens||(this.tokens=this.generateTokens()),this.tokens.map(T=>T.value).join("")}generateTokens(){if(this.machine.Reset(),0===this.m_pSrc.length)return[];for(let T=0;T<this.m_pSrc.length;T++){const E=this.m_pSrc[T];this.machine.Feed(E)}return this.machine.Feed("\0"),this.machine.getTokens()}}exports.StyleAttrValueTokenizer=StyleAttrValueTokenizer;class Machine extends BaseMachine{get TT(){return Machine._TT||this.InitTransitTable(),Machine._TT}constructor(T,E){super(T,E),this.tagStack=[],this.InitTransitTable(),this.mPath=T,this.mSrc=E}get wxsState(){return"wxs"===this.tagStack[this.tagStack.length-1]}get textState(){return"text"===this.tagStack[this.tagStack.length-1]}getTokens(){return[...this.tokens]}checkLastTokenIfTypeMatch(T){var E;return(null===(E=this.tokens[this.tokens.length-1])||void 0===E?void 0:E.type)===T?this.tokens[this.tokens.length-1]:void 0}getLastTokenIfTypeMatch(T){if(0!==this.tokens.length)for(let E=this.tokens.length-1;E>=0;E--){const _=this.tokens[E];if(_.type===T)return _}}canBeOmittedTokenType(T){return T===TokenType.WXS_VALUE}appendToken(T,E){if(this.canBeOmittedTokenType(T)&&(E=this.transTagTextTokenValue(E)),T===TokenType.ATTR_VALUE){const T=this.getLastTokenIfTypeMatch(TokenType.ATTR);"style"===(null==T?void 0:T.value)&&(E=this.trySlimStyleAttrValue(E))}E&&this.tokens.push(new Token(T,E))}transTagTextTokenValue(T){return this.wxsState?T=T.split("\n").map(T=>T.trim()).join("\n"):T}trySlimStyleAttrValue(T){const E=[];try{if(T.length<=1)return T;for(let T=this.tokens.length-1;T>=0;T--){if(this.tokens[T].type===TokenType.TAG_EQ)break;E.unshift(this.tokens.pop())}const _=`${E.map(T=>null==T?void 0:T.value).join("")}${T}`,A=_.startsWith('"')||_.startsWith("'"),S=_.endsWith('"')||_.endsWith("'"),t=new StyleAttrValueTokenizer(_.replace(/^['"]/,"").replace(/['"]$/,""),this.mPath).toString();return`${A?_.substr(0,1):""}${t}${S?_.substr(_.length-1,1):""}`}catch(T){console.error(T),this.tokens.push(...E)}return T}doExcludeAction(T,E){let _=TokenType.OTHERS;switch(T){case STATE.IN_TAG_ATTR_VALUE_STRING:case STATE.IN_TAG_ATTR_VALUE_STRING_SINGLE:_=TokenType.ATTR_VALUE;break;case STATE.IN_TAG_WORD:_=TokenType.TAG,this.tagStack.push(E);break;case STATE.IN_END_TAG_WORD:_=TokenType.TAG;if(this.tagStack.pop()!==E)throw{col:this.mState.col-E.length,line:this.mState.line,message:"unexpected end tag: "+E};break;case STATE.IN_WXS:_=TokenType.WXS_VALUE;break;case STATE.IN_TEXT:_=TokenType.TEXT_VALUE;break;case STATE.IN_TAG_TEXT:_=TokenType.TAG_TEXT_VALUE;break;case STATE.IN_TAG_ATTR_WORD:_=TokenType.ATTR;break;case STATE.TAG_START:_=TokenType.LEFT_ANGLE_BRACKET;break;case STATE.IN_TEMPLATE:_=TokenType.TEMPLATE_ITEM;break;case STATE.TAG_EQ:_=TokenType.TAG_EQ;break;case STATE.TEMPLATE_END_CHECK:{const T=this.mState.cur_pos;if("}"===this.mSrc.substring(T-3,T-2))throw{col:this.mState.col-3,line:this.mState.line,message:"unexpected end tag: }. } should not be followed by }} direactly, add a space and change it to } }}"};this.appendToken(TokenType.TEMPLATE_ITEM,""+new TemplateTokenizer(E,this.mPath)),_=TokenType.TEMPLATE_END,E=""}}this.appendToken(_,E)}doIncludeAction(T,E,_){const A=this.mState.state;let S;E===STATE.WXS_END_STEP?(this.appendToken(TokenType.WXS_VALUE,_.substr(0,_.length-2)),S=TokenType.END_LEFT_ANGLE_BRACKET,_="</"):E===STATE.IN_WXS_STRING||E===STATE.IN_WXS_STRING_SINGLE?S=TokenType.WXS_VALUE:E===STATE.IN_TAG_ATTR_VALUE_STRING||E===STATE.IN_TAG_ATTR_VALUE_STRING_SINGLE?S=TokenType.ATTR_VALUE:E===STATE.TAG_START&&A===STATE.IN_END_TAG?S=TokenType.END_LEFT_ANGLE_BRACKET:E===STATE.WAIT_FOR_RIGHT_BRACKET?(S=TokenType.SELF_CLOSE,this.tagStack.pop()):S=TokenType.OTHERS,">"!==T||E!==STATE.IN_TAG_WORD&&E!==STATE.IN_TAG_ATTR_WORD&&E!==STATE.IN_TAG_ATTR_VALUE_STRING&&E!==STATE.IN_TAG_ATTR_VALUE_STRING_SINGLE&&E!==STATE.IN_END_TAG_WORD||(S=TokenType.RIGHT_ANGLE_BRACKET),this.appendToken(S,_)}Feed(T){super.Feed(T),this.wxsState&&this.mState.state===STATE.IN_TAG_TEXT&&(this.mState.state=STATE.IN_WXS),this.textState&&this.mState.state===STATE.IN_TAG_TEXT&&(this.mState.state=STATE.IN_TEXT)}FillTT_attr_string(T,E,_){const A=T+1;this.TT[T][getCharCode("\\")]=A,this.TT[T][getCharCode("\n")]=BASE_STATE.ERROR,this.TT[A][BASE_STATE.OTHERS]=T,this.TT[A][getCharCode("\n")]=E|ACTION.STORE_TOKEN_EXCLUDE|ACTION.IGNORE,this.TT[T][getCharCode(_)]=E|ACTION.STORE_TOKEN_INCLUDE,this.TT[T][getCharCode("{")]=STATE.WAIT_TEMPLATE_START|ACTION.STORE_STATE_BEFORE,this.TT[T][0]=BASE_STATE.ERROR,this.TT[T][BASE_STATE.OTHERS]=T}InitTransitTable(){Machine._TT=new Array(STATE.MAX_STATE);for(let T=0;T<STATE.MAX_STATE;T++){const E=new Array(257);E.fill(0),this.TT[T]=E}this.TT[BASE_STATE.END][BASE_STATE.OTHERS]=BASE_STATE.END,this.TT[BASE_STATE.START][getCharCode("<")]=STATE.TAG_START|ACTION.STORE_TOKEN_EXCLUDE|ACTION.STORE_STATE_BEFORE,this.TT[BASE_STATE.START][getCharCode("{")]=STATE.WAIT_TEMPLATE_START|ACTION.STORE_STATE_BEFORE,this.TT[BASE_STATE.START][BASE_STATE.OTHERS]=STATE.IN_TAG_TEXT|ACTION.NOTHING,this.TT[BASE_STATE.START][0]=BASE_STATE.END|ACTION.STORE_TOKEN_EXCLUDE,this.TT[STATE.IN_TAG_TEXT][getCharCode("<")]=STATE.TAG_START|ACTION.STORE_TOKEN_EXCLUDE|ACTION.STORE_STATE_BEFORE,this.TT[STATE.IN_TAG_TEXT][getCharCode("{")]=STATE.WAIT_TEMPLATE_START|ACTION.STORE_STATE_BEFORE,this.TT[STATE.IN_TAG_TEXT][BASE_STATE.OTHERS]=STATE.IN_TAG_TEXT|ACTION.NOTHING,this.TT[STATE.IN_TAG_TEXT][0]=BASE_STATE.END|ACTION.STORE_TOKEN_EXCLUDE,this.TT[STATE.IN_TAG_TEXT][BASE_STATE.OTHERS]=STATE.IN_TAG_TEXT,this.TT[STATE.WAIT_TEMPLATE_START][getCharCode("{")]=STATE.IN_TEMPLATE|ACTION.STORE_TOKEN_FIRST,this.TT[STATE.WAIT_TEMPLATE_START][BASE_STATE.OTHERS]=STATE.IN_TAG_TEXT|ACTION.GET_STATE_BEFORE,this.TT[STATE.IN_TEMPLATE][getCharCode("{")]=STATE.IN_TEMPLATE|ACTION.RECORD_IN_TEMPLATE_OBJECT,this.TT[STATE.IN_TEMPLATE][getCharCode("}")]=STATE.WAIT_TEMPLATE_END|ACTION.CHECK_IN_TEMPLATE_OBJECT,this.TT[STATE.IN_TEMPLATE][getCharCode("\\")]=BASE_STATE.ERROR,this.FillTT(STATE.IN_TEMPLATE,STATE.IN_TEMPLATE,ACTION.NOTHING," \n\t\r"),this.TT[STATE.IN_TEMPLATE][BASE_STATE.OTHERS]=STATE.IN_TEMPLATE,this.TT[STATE.IN_TEMPLATE][0]=BASE_STATE.ERROR,this.TT[STATE.WAIT_TEMPLATE_END][getCharCode("}")]=STATE.TEMPLATE_END_CHECK,this.TT[STATE.TEMPLATE_END_CHECK][BASE_STATE.OTHERS]=STATE.IN_TAG_TEXT|ACTION.REFEED|ACTION.STORE_TOKEN_EXCLUDE|ACTION.GET_STATE_BEFORE,this.TT[STATE.WAIT_TEMPLATE_END][BASE_STATE.OTHERS]=STATE.IN_TEMPLATE|ACTION.REFEED,this.TT[STATE.IN_TEMPLATE][getCharCode('"')]=STATE.IN_TEMPLATE_STRING|ACTION.NOTHING,this.TT[STATE.IN_TEMPLATE][getCharCode("'")]=STATE.IN_TEMPLATE_STRING2|ACTION.NOTHING,this.FillTT_template_string(STATE.IN_TEMPLATE_STRING,STATE.IN_TEMPLATE|ACTION.NOTHING,'"'),this.FillTT_template_string(STATE.IN_TEMPLATE_STRING2,STATE.IN_TEMPLATE|ACTION.NOTHING,"'"),this.FillTT(STATE.TAG_START,STATE.TAG_START,ACTION.STORE_TOKEN_EXCLUDE|ACTION.IGNORE," \n\t\r"),this.FillTT(STATE.TAG_START,STATE.IN_TAG_WORD,ACTION.STORE_TOKEN_EXCLUDE,ALPHA),this.TT[STATE.TAG_START][getCharCode("/")]=STATE.IN_END_TAG|ACTION.STORE_TOKEN_INCLUDE,this.TT[STATE.TAG_START][getCharCode("!")]=STATE.IN_COMMENT_BEGIN1,this.TT[STATE.TAG_START][BASE_STATE.OTHERS]=BASE_STATE.ERROR,this.TT[STATE.IN_COMMENT_BEGIN1][getCharCode("-")]=STATE.IN_COMMENT_BEGIN2,this.TT[STATE.IN_COMMENT_BEGIN1][BASE_STATE.OTHERS]=BASE_STATE.ERROR,this.TT[STATE.IN_COMMENT_BEGIN2][getCharCode("-")]=STATE.IN_COMMENT,this.TT[STATE.IN_COMMENT_BEGIN2][BASE_STATE.OTHERS]=BASE_STATE.ERROR,this.TT[STATE.IN_COMMENT][getCharCode("-")]=STATE.WAIT_FOR_COMMENT_END1,this.TT[STATE.IN_COMMENT][BASE_STATE.OTHERS]=STATE.IN_COMMENT,this.TT[STATE.WAIT_FOR_COMMENT_END1][getCharCode("-")]=STATE.WAIT_FOR_COMMENT_END2,this.TT[STATE.WAIT_FOR_COMMENT_END1][BASE_STATE.OTHERS]=STATE.IN_COMMENT,this.TT[STATE.WAIT_FOR_COMMENT_END2][getCharCode(">")]=STATE.IN_TAG_TEXT|ACTION.IGNORE|ACTION.GET_STATE_BEFORE,this.TT[STATE.WAIT_FOR_COMMENT_END2][getCharCode("-")]=STATE.WAIT_FOR_COMMENT_END2,this.TT[STATE.WAIT_FOR_COMMENT_END2][BASE_STATE.OTHERS]=STATE.IN_COMMENT,this.FillTT(STATE.IN_TAG_WORD,STATE.IN_TAG_WORD,ACTION.NOTHING,ALPHA),this.FillTT(STATE.IN_TAG_WORD,STATE.IN_TAG_WORD,ACTION.NOTHING,DIGIT),this.FillTT(STATE.IN_TAG_WORD,STATE.IN_TAG_ATTR_WORD,ACTION.STORE_TOKEN_EXCLUDE|ACTION.IGNORE," \n\t\r"),this.TT[STATE.IN_TAG_WORD][getCharCode(">")]=STATE.IN_TAG_TEXT|ACTION.STORE_TOKEN_EXCLUDE|ACTION.STORE_TOKEN_INCLUDE,this.TT[STATE.IN_TAG_WORD][getCharCode("/")]=STATE.WAIT_FOR_RIGHT_BRACKET|ACTION.STORE_TOKEN_EXCLUDE,this.TT[STATE.IN_TAG_WORD][BASE_STATE.OTHERS]=BASE_STATE.ERROR,this.TT[STATE.IN_TAG_WORD][0]=BASE_STATE.ERROR,this.FillTT(STATE.IN_TAG_ATTR_WORD,STATE.IN_TAG_ATTR_WORD,ACTION.NOTHING,ALPHA),this.FillTT(STATE.IN_TAG_ATTR_WORD,STATE.IN_TAG_ATTR_WORD,ACTION.NOTHING,DIGIT),this.FillTT(STATE.IN_TAG_ATTR_WORD,STATE.IN_TAG_ATTR_WORD,ACTION.STORE_TOKEN_EXCLUDE|ACTION.IGNORE," \n\t\r"),this.TT[STATE.IN_TAG_ATTR_WORD][getCharCode("=")]=STATE.TAG_EQ|ACTION.STORE_TOKEN_EXCLUDE,this.TT[STATE.IN_TAG_ATTR_WORD][getCharCode('"')]=BASE_STATE.ERROR,this.TT[STATE.IN_TAG_ATTR_WORD][getCharCode(">")]=STATE.IN_TAG_TEXT|ACTION.STORE_TOKEN_EXCLUDE|ACTION.STORE_TOKEN_INCLUDE,this.TT[STATE.IN_TAG_ATTR_WORD][getCharCode("/")]=STATE.WAIT_FOR_RIGHT_BRACKET|ACTION.STORE_TOKEN_EXCLUDE,this.TT[STATE.IN_TAG_ATTR_WORD][BASE_STATE.OTHERS]=BASE_STATE.ERROR,this.TT[STATE.IN_TAG_ATTR_WORD][0]=BASE_STATE.ERROR,this.FillTT(STATE.TAG_EQ,STATE.TAG_EQ,ACTION.STORE_TOKEN_EXCLUDE|ACTION.IGNORE," \n\t\r"),this.FillTT(STATE.TAG_EQ,STATE.IN_TAG_ATTR_VALUE_STRING,ACTION.STORE_TOKEN_EXCLUDE,ALPHA),this.TT[STATE.TAG_EQ][getCharCode('"')]=STATE.IN_TAG_ATTR_VALUE_STRING|ACTION.STORE_TOKEN_EXCLUDE,this.TT[STATE.TAG_EQ][getCharCode("'")]=STATE.IN_TAG_ATTR_VALUE_STRING_SINGLE|ACTION.STORE_TOKEN_EXCLUDE,this.TT[STATE.TAG_EQ][0]=BASE_STATE.ERROR,this.TT[STATE.TAG_EQ][BASE_STATE.OTHERS]=BASE_STATE.ERROR,this.FillTT(STATE.IN_END_TAG,STATE.IN_END_TAG,ACTION.IGNORE," \n\t\r"),this.FillTT(STATE.IN_END_TAG,STATE.IN_END_TAG_WORD,ACTION.NOTHING,ALPHA),this.FillTT(STATE.IN_END_TAG,BASE_STATE.ERROR,ACTION.NOTHING,DIGIT),this.TT[STATE.IN_END_TAG][getCharCode(">")]=STATE.IN_TAG_TEXT|ACTION.STORE_TOKEN_INCLUDE,this.TT[STATE.IN_END_TAG][BASE_STATE.OTHERS]=BASE_STATE.ERROR,this.FillTT(STATE.IN_END_TAG_WORD,STATE.IN_END_TAG_WORD,ACTION.NOTHING,ALPHA),this.FillTT(STATE.IN_END_TAG_WORD,STATE.IN_END_TAG_WORD,ACTION.NOTHING,DIGIT),this.FillTT(STATE.IN_END_TAG_WORD,STATE.IN_END_TAG,ACTION.STORE_TOKEN_EXCLUDE|ACTION.IGNORE," \n\t\r"),this.TT[STATE.IN_END_TAG_WORD][getCharCode(">")]=STATE.IN_TAG_TEXT|ACTION.STORE_TOKEN_EXCLUDE|ACTION.STORE_TOKEN_INCLUDE,this.TT[STATE.IN_END_TAG_WORD][getCharCode("/")]=STATE.WAIT_FOR_RIGHT_BRACKET|ACTION.STORE_TOKEN_EXCLUDE,this.TT[STATE.IN_END_TAG_WORD][BASE_STATE.OTHERS]=BASE_STATE.ERROR,this.FillTT(STATE.WAIT_FOR_RIGHT_BRACKET,STATE.IN_TAG_WORD,ACTION.STORE_TOKEN_EXCLUDE,ALPHA),this.TT[STATE.WAIT_FOR_RIGHT_BRACKET][getCharCode(">")]=STATE.IN_TAG_TEXT|ACTION.STORE_TOKEN_INCLUDE,this.TT[STATE.WAIT_FOR_RIGHT_BRACKET][BASE_STATE.OTHERS]=BASE_STATE.ERROR,this.FillTT_attr_string(STATE.IN_TAG_ATTR_VALUE_STRING,STATE.IN_TAG_ATTR_WORD,'"'),this.FillTT_attr_string(STATE.IN_TAG_ATTR_VALUE_STRING_SINGLE,STATE.IN_TAG_ATTR_WORD,"'"),this.TT[STATE.IN_WXS][getCharCode("<")]=STATE.WXS_END_STEP,this.TT[STATE.IN_WXS][getCharCode('"')]=STATE.IN_WXS_STRING|ACTION.STORE_TOKEN_EXCLUDE,this.TT[STATE.IN_WXS][getCharCode("'")]=STATE.IN_WXS_STRING_SINGLE|ACTION.STORE_TOKEN_EXCLUDE,this.FillTT_attr_string(STATE.IN_WXS_STRING,STATE.IN_WXS,'"'),this.FillTT_attr_string(STATE.IN_WXS_STRING_SINGLE,STATE.IN_WXS,"'"),this.TT[STATE.IN_WXS][BASE_STATE.OTHERS]=STATE.IN_WXS,this.TT[STATE.WXS_END_STEP][getCharCode("/")]=STATE.IN_END_TAG|ACTION.STORE_TOKEN_INCLUDE,this.TT[STATE.WXS_END_STEP][BASE_STATE.OTHERS]=STATE.IN_WXS,this.TT[STATE.IN_TEXT][getCharCode("<")]=STATE.TAG_START|ACTION.STORE_TOKEN_EXCLUDE,this.TT[STATE.IN_TEXT][BASE_STATE.OTHERS]=STATE.IN_TEXT,this.TT[STATE.IN_TEXT][getCharCode("{")]=STATE.WAIT_TEMPLATE_START|ACTION.STORE_STATE_BEFORE}}class Tokenizer{constructor(T,E){this.machine=new Machine(E,T),this.m_pSrc=T,this.path=E}generateTokens(){if(this.machine.Reset(),0===this.m_pSrc.length)return[];try{for(let T=0;T<this.m_pSrc.length;T++){const E=this.m_pSrc[T];this.machine.Feed(E)}this.machine.Feed("\0")}catch(T){throw new Error(`${T.line}:${T.col}:${T.message}`)}return this.machine.getTokens()}}function generateWXMLFromTokens(T,E={collapseWhitespace:!0,conservativeCollapse:!1,preserveLineBreaks:!1}){const{collapseWhitespace:_,conservativeCollapse:A,preserveLineBreaks:S}=E,t=[];for(let E=0;E<T.length;E++){const e=T[E];let N=e.value;const R=e.type;if(R===TokenType.ATTR&&(N=" "+N),R===TokenType.TAG_TEXT_VALUE){S||(N=N.replace(/\n/g," ")),_&&(N=N.replace(/([ \t])+/g," "));const t=T[E-1];t&&t.type!==TokenType.RIGHT_ANGLE_BRACKET&&t.type!==TokenType.SELF_CLOSE||_&&!A&&(N=trimStringLeft(N,!1)),(null==t?void 0:t.type)===TokenType.TAG_TEXT_VALUE&&((null==t?void 0:t.value.endsWith(" "))||(null==t?void 0:t.value.endsWith("\n")))&&_&&(N=trimStringLeft(N,!1))}if(R===TokenType.LEFT_ANGLE_BRACKET||R===TokenType.END_LEFT_ANGLE_BRACKET){const S=T[E-1];if((null==S?void 0:S.type)===TokenType.TAG_TEXT_VALUE&&_&&!A){const T=t.pop()||"";t.push(trimStringRight(T,!1))}}t.push(N)}return t.join("")}async function minifyWXML(T){const{filePath:E,root:_=""}=T,A=T.code instanceof Buffer?T.code.toString():T.code,S=Object.assign({collapseWhitespace:!0,conservativeCollapse:!1,preserveLineBreaks:!1},T.setting),t=path_1.default.posix.join(_,E);if(A.length>0)try{const T=new Tokenizer(A.replace(/\r\n/g,"\n"),t);return{error:null,code:generateWXMLFromTokens(T.generateTokens(),S)}}catch(T){return log.error("minifywxml error @ "+t),log.error(T.message),{error:{code:config_1.MINIFY_WXML_ERR,path:t,message:T.message}}}return{error:null,code:A.replace(/\r\n/g,"\n")}}exports.minifyWXML=minifyWXML;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.minifyWXML=exports.StyleAttrValueTokenizer=exports.TemplateTokenizer=void 0;const tslib_1=require("tslib"),path_1=tslib_1.__importDefault(require("path")),log=tslib_1.__importStar(require("../../../../../utils/log")),config_1=require("../../../../../config/config");function getCharCode(T){return T.charCodeAt(0)>=256?BASE_STATE.OTHERS:T.charCodeAt(0)}function trimStringLeft(T,E=!0){return E?T.trimLeft():T.split("\n").map(T=>T.replace(/^[ \t]*/g,"")).join("\n")}function trimStringRight(T,E=!0){return E?T.trimRight():T.split("\n").map(T=>T.replace(/[ \t]*$/,"")).join("\n")}var TokenType,BASE_STATE,STATE,TEMPLATE_STATE,STYLE_ATTR_VALUE_STATE,ACTION;!function(T){T[T.ATTR=0]="ATTR",T[T.TAG=1]="TAG",T[T.LEFT_ANGLE_BRACKET=2]="LEFT_ANGLE_BRACKET",T[T.RIGHT_ANGLE_BRACKET=3]="RIGHT_ANGLE_BRACKET",T[T.END_LEFT_ANGLE_BRACKET=4]="END_LEFT_ANGLE_BRACKET",T[T.STRING1=5]="STRING1",T[T.STRING2=6]="STRING2",T[T.ATTR_VALUE=7]="ATTR_VALUE",T[T.TEXT_VALUE=8]="TEXT_VALUE",T[T.TAG_TEXT_VALUE=9]="TAG_TEXT_VALUE",T[T.TEMPLATE_START=10]="TEMPLATE_START",T[T.TEMPLATE_END=11]="TEMPLATE_END",T[T.TEMPLATE_ITEM=12]="TEMPLATE_ITEM",T[T.TEMPLATE_STRING=13]="TEMPLATE_STRING",T[T.SELF_CLOSE=14]="SELF_CLOSE",T[T.WXS_VALUE=15]="WXS_VALUE",T[T.STYLE_KEY=16]="STYLE_KEY",T[T.TAG_EQ=17]="TAG_EQ",T[T.STYLE_VALUE=18]="STYLE_VALUE",T[T.STYLE_ATTR_VALUE=19]="STYLE_ATTR_VALUE",T[T.CLASS_ATTR_VALUE=20]="CLASS_ATTR_VALUE",T[T.OTHERS=21]="OTHERS"}(TokenType||(TokenType={})),function(T){T[T.ERROR=-1]="ERROR",T[T.NOT_SET=0]="NOT_SET",T[T.START=1]="START",T[T.OTHERS=2]="OTHERS",T[T.END=3]="END",T[T.MAX_STATE=4]="MAX_STATE"}(BASE_STATE||(BASE_STATE={})),function(T){T[T.IN_TAG_TEXT=5]="IN_TAG_TEXT",T[T.TAG_START=6]="TAG_START",T[T.IN_TAG_WORD=7]="IN_TAG_WORD",T[T.TAG_EQ=8]="TAG_EQ",T[T.IN_TAG_ATTR_WORD=9]="IN_TAG_ATTR_WORD",T[T.IN_TAG_ATTR_VALUE_STRING=10]="IN_TAG_ATTR_VALUE_STRING",T[T.IN_TAG_ATTR_VALUE_STRING_ESCAPE=11]="IN_TAG_ATTR_VALUE_STRING_ESCAPE",T[T.IN_TAG_ATTR_VALUE_STRING_SINGLE=12]="IN_TAG_ATTR_VALUE_STRING_SINGLE",T[T.IN_TAG_ATTR_VALUE_STRING_SINGLE_ESCAPE=13]="IN_TAG_ATTR_VALUE_STRING_SINGLE_ESCAPE",T[T.WAIT_TEMPLATE_START=14]="WAIT_TEMPLATE_START",T[T.IN_TEMPLATE=15]="IN_TEMPLATE",T[T.WAIT_TEMPLATE_END=16]="WAIT_TEMPLATE_END",T[T.TEMPLATE_END_CHECK=17]="TEMPLATE_END_CHECK",T[T.IN_TEMPLATE_STRING=18]="IN_TEMPLATE_STRING",T[T.IN_TEMPLATE_STRING_ESCAPE=19]="IN_TEMPLATE_STRING_ESCAPE",T[T.IN_TEMPLATE_STRING2=20]="IN_TEMPLATE_STRING2",T[T.IN_TEMPLATE_STRING2_ESCAPE=21]="IN_TEMPLATE_STRING2_ESCAPE",T[T.WAIT_FOR_RIGHT_BRACKET=22]="WAIT_FOR_RIGHT_BRACKET",T[T.IN_WXS=23]="IN_WXS",T[T.IN_WXS_STRING=24]="IN_WXS_STRING",T[T.IN_WXS_STRING_ESCAPE=25]="IN_WXS_STRING_ESCAPE",T[T.IN_WXS_STRING_SINGLE=26]="IN_WXS_STRING_SINGLE",T[T.IN_WXS_STRING_SINGLE_ESCAPE=27]="IN_WXS_STRING_SINGLE_ESCAPE",T[T.WXS_END_STEP=28]="WXS_END_STEP",T[T.IN_COMMENT_BEGIN1=29]="IN_COMMENT_BEGIN1",T[T.IN_COMMENT_BEGIN2=30]="IN_COMMENT_BEGIN2",T[T.IN_COMMENT=31]="IN_COMMENT",T[T.WAIT_FOR_COMMENT_END1=32]="WAIT_FOR_COMMENT_END1",T[T.WAIT_FOR_COMMENT_END2=33]="WAIT_FOR_COMMENT_END2",T[T.IN_TEXT=34]="IN_TEXT",T[T.IN_END_TAG=35]="IN_END_TAG",T[T.IN_END_TAG_WORD=36]="IN_END_TAG_WORD",T[T.MAX_STATE=37]="MAX_STATE"}(STATE||(STATE={})),function(T){T[T.WAIT_TEMPLATE_START=5]="WAIT_TEMPLATE_START",T[T.IN_TEMPLATE_ITEM=6]="IN_TEMPLATE_ITEM",T[T.WAIT_TEMPLATE_END=7]="WAIT_TEMPLATE_END",T[T.SPACE_AFTER_WAIT_TEMPLATE_END=8]="SPACE_AFTER_WAIT_TEMPLATE_END",T[T.IN_TEMPLATE_STRING=9]="IN_TEMPLATE_STRING",T[T.IN_TEMPLATE_STRING_ESCAPE=10]="IN_TEMPLATE_STRING_ESCAPE",T[T.IN_TEMPLATE_STRING2=11]="IN_TEMPLATE_STRING2",T[T.IN_TEMPLATE_STRING2_ESCAPE=12]="IN_TEMPLATE_STRING2_ESCAPE",T[T.WAIT_FOR_COMMENT_START=13]="WAIT_FOR_COMMENT_START",T[T.IN_COMMENT=14]="IN_COMMENT",T[T.WAIT_FOR_COMMENT_END=15]="WAIT_FOR_COMMENT_END",T[T.IN_TEMPLATE_SPACE=16]="IN_TEMPLATE_SPACE",T[T.MAX_STATE=17]="MAX_STATE"}(TEMPLATE_STATE||(TEMPLATE_STATE={})),function(T){T[T.WAIT_KEY=5]="WAIT_KEY",T[T.IN_KEY=6]="IN_KEY",T[T.WAIT_KEY_VALUE_SAPERATE=7]="WAIT_KEY_VALUE_SAPERATE",T[T.IN_KEY_VALUE_SAPERATE=8]="IN_KEY_VALUE_SAPERATE",T[T.WAIT_VALUE=9]="WAIT_VALUE",T[T.IN_VALUE=10]="IN_VALUE",T[T.WAIT_ITEM_SAPERATE=11]="WAIT_ITEM_SAPERATE",T[T.IN_ITEM_SAPERATE=12]="IN_ITEM_SAPERATE",T[T.IN_STRING=13]="IN_STRING",T[T.IN_STRING_ESCAPE=14]="IN_STRING_ESCAPE",T[T.IN_STRING2=15]="IN_STRING2",T[T.IN_STRING2_ESCAPE=16]="IN_STRING2_ESCAPE",T[T.WAIT_TEMPLATE_START=17]="WAIT_TEMPLATE_START",T[T.IN_TEMPLATE=18]="IN_TEMPLATE",T[T.WAIT_TEMPLATE_END=19]="WAIT_TEMPLATE_END",T[T.IN_TEMPLATE_STRING=20]="IN_TEMPLATE_STRING",T[T.IN_TEMPLATE_STRING_ESCAPE=21]="IN_TEMPLATE_STRING_ESCAPE",T[T.IN_TEMPLATE_STRING2=22]="IN_TEMPLATE_STRING2",T[T.IN_TEMPLATE_STRING2_ESCAPE=23]="IN_TEMPLATE_STRING2_ESCAPE",T[T.WAIT_FOR_COMMENT_START=24]="WAIT_FOR_COMMENT_START",T[T.IN_COMMENT=25]="IN_COMMENT",T[T.WAIT_FOR_COMMENT_END=26]="WAIT_FOR_COMMENT_END",T[T.MAX_STATE=27]="MAX_STATE"}(STYLE_ATTR_VALUE_STATE||(STYLE_ATTR_VALUE_STATE={})),function(T){T[T.NOTHING=0]="NOTHING",T[T.DO_ACTION=65536]="DO_ACTION",T[T.STORE_TOKEN_EXCLUDE=131072]="STORE_TOKEN_EXCLUDE",T[T.STORE_TOKEN_INCLUDE=262144]="STORE_TOKEN_INCLUDE",T[T.IGNORE=524288]="IGNORE",T[T.REFEED=1048576]="REFEED",T[T.STORE_TOKEN_FIRST=2097152]="STORE_TOKEN_FIRST",T[T.STORE_ONE_SPACE=4194304]="STORE_ONE_SPACE",T[T.STORE_ONE_LINE_BREAK=8388608]="STORE_ONE_LINE_BREAK",T[T.GET_STATE_BEFORE=16777216]="GET_STATE_BEFORE",T[T.STORE_STATE_BEFORE=33554432]="STORE_STATE_BEFORE",T[T.SET_WXS_STATE=67108864]="SET_WXS_STATE",T[T.RECORD_IN_TEMPLATE_OBJECT=134217728]="RECORD_IN_TEMPLATE_OBJECT",T[T.CHECK_IN_TEMPLATE_OBJECT=268435456]="CHECK_IN_TEMPLATE_OBJECT"}(ACTION||(ACTION={}));class Token{constructor(T,E){this.type=T,this.value=E}}class MachineState{constructor(){this.cur_pos=0,this.last_pos=0,this.line=1,this.col=1,this.mark_pos=0,this.mark_col=0,this.last_line=this.line,this.last_col=1,this.state=BASE_STATE.START,this.in_template_object_count=0}}const ALPHA="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_-:",DIGIT="0123456789.",WHITECHARS=" \n\t\r";class BaseMachine{constructor(T,E){this.mState=new MachineState,this.storedStates=[],this.oldState=BASE_STATE.START,this.tokens=[],this.mPath=T,this.mSrc=E}FillTT(T,E,_,A){for(const S of A)this.TT[T][getCharCode(S)]=E|_}Reset(){return this.mState.cur_pos=0,this.mState.last_pos=0,this.mState.mark_pos=0,this.mState.line=1,this.mState.col=1,this.mState.last_col=1,this.mState.mark_col=1,this.mState.last_line=this.mState.line,this.mState.state=BASE_STATE.START,0}refeed(T){let E=this.TT[this.mState.state][getCharCode(T)];if(E===BASE_STATE.NOT_SET&&(E=this.TT[this.mState.state][BASE_STATE.OTHERS]),E===BASE_STATE.NOT_SET)throw{col:this.mState.col,line:this.mState.line,message:"BAD STATE MACHINE!"};if(E<0){if("\0"!==T)throw{col:this.mState.col,line:this.mState.line,message:`unexpected character \`${T.replace(/\n/g,"\\n")}\``};throw{col:this.mState.col,line:this.mState.line,message:"unexpected end"}}const _=E,A=65535&E,S=this.mState.state;_&ACTION.STORE_STATE_BEFORE&&(this.storedStates.push(S),this.mState.mark_pos=this.mState.cur_pos,this.mState.mark_col=this.mState.mark_col),this.mState.state=A,this.doAction(T,S,_)}Feed(T){"\n"===T&&(this.mState.line++,this.mState.col=0),this.refeed(T)}FillTT_template_string(T,E,_){const A=T+1;this.TT[T][getCharCode("\\")]=A,this.TT[A][BASE_STATE.OTHERS]=T,this.TT[T][getCharCode(_)]=E,this.TT[T][0]=BASE_STATE.ERROR,this.TT[T][BASE_STATE.OTHERS]=T}updatePosition(){this.mState.last_pos=this.mState.cur_pos,this.mState.last_col=this.mState.col,this.mState.last_line=this.mState.line}processPosition(){this.mState.cur_pos++,this.mState.col++}doAction(T,E,_){if(_&ACTION.STORE_TOKEN_FIRST&&this.mState.mark_pos>this.mState.last_pos){const T=this.mSrc.substring(this.mState.last_pos,this.mState.mark_pos);this.doExcludeAction(this.storedStates[this.storedStates.length-1],T),this.mState.last_pos=this.mState.mark_pos,this.mState.last_col=this.mState.mark_col}if(_&ACTION.STORE_ONE_LINE_BREAK&&(this.appendToken(TokenType.OTHERS,"\n"),this.updatePosition()),_&ACTION.STORE_ONE_SPACE&&(this.appendToken(TokenType.OTHERS," "),this.updatePosition()),_&ACTION.STORE_TOKEN_EXCLUDE){const T=this.mState.cur_pos,_=this.mState.last_pos;if(T>=_){const A=this.mSrc.substring(_,T);this.doExcludeAction(E,A),this.updatePosition()}}if(_&ACTION.RECORD_IN_TEMPLATE_OBJECT&&this.mState.in_template_object_count++,_&ACTION.CHECK_IN_TEMPLATE_OBJECT&&this.mState.in_template_object_count>0&&(this.mState.in_template_object_count--,this.mState.state=STATE.IN_TEMPLATE),_&ACTION.REFEED){if(_&ACTION.IGNORE&&this.updatePosition(),_&ACTION.GET_STATE_BEFORE){const T=this.storedStates.pop();T&&(this.mState.state=T)}this.refeed(T)}else{if(this.processPosition(),_&ACTION.STORE_TOKEN_INCLUDE){const _=this.mSrc.substring(this.mState.last_pos,this.mState.cur_pos);this.doIncludeAction(T,E,_),this.updatePosition()}if(_&ACTION.IGNORE&&this.updatePosition(),_&ACTION.GET_STATE_BEFORE){const T=this.storedStates.pop();T&&(this.mState.state=T)}}}}class StyleAttrValueMachine extends BaseMachine{get TT(){return StyleAttrValueMachine._TT||this.InitTransitTable(),StyleAttrValueMachine._TT}constructor(T,E){super(T,E),this.mState.state=BASE_STATE.START}getTokens(){return[...this.tokens]}appendToken(T,E){T===TokenType.STYLE_VALUE&&(E=E.replace(/[ \t]+/g," ")),this.tokens.push(new Token(T,E))}doExcludeAction(T,E){let _=TokenType.OTHERS;switch(T){case STYLE_ATTR_VALUE_STATE.IN_KEY:_=TokenType.STYLE_KEY;break;case STYLE_ATTR_VALUE_STATE.IN_KEY_VALUE_SAPERATE:_=TokenType.OTHERS;break;case STYLE_ATTR_VALUE_STATE.IN_ITEM_SAPERATE:_=TokenType.OTHERS,E=";";break;case STYLE_ATTR_VALUE_STATE.IN_VALUE:_=TokenType.STYLE_VALUE}this.appendToken(_,E)}doIncludeAction(T,E,_){let A=TokenType.OTHERS;switch(E){case STYLE_ATTR_VALUE_STATE.IN_STRING:A=TokenType.STRING1;break;case STYLE_ATTR_VALUE_STATE.IN_STRING2:A=TokenType.STRING2;break;case STYLE_ATTR_VALUE_STATE.WAIT_TEMPLATE_END:A=TokenType.TEMPLATE_ITEM,_=new TemplateTokenizer(_,this.mPath).toString();break;case STYLE_ATTR_VALUE_STATE.WAIT_FOR_COMMENT_START:this.doExcludeAction(this.storedStates[this.storedStates.length-1],_.replace(/\/\*$/,"")),A=TokenType.OTHERS,_="/*";break;case STYLE_ATTR_VALUE_STATE.WAIT_FOR_COMMENT_END:A=TokenType.OTHERS,_="*/"}this.appendToken(A,_)}FillTT_string(T,E,_){const A=T+1;this.TT[T][getCharCode("\\")]=A,this.TT[T][getCharCode("\n")]=BASE_STATE.ERROR,this.TT[A][BASE_STATE.OTHERS]=T,this.TT[A][getCharCode("\n")]=E|ACTION.STORE_TOKEN_EXCLUDE|ACTION.IGNORE,this.TT[T][getCharCode(_)]=E|ACTION.STORE_TOKEN_INCLUDE,this.TT[T][getCharCode("{")]=STYLE_ATTR_VALUE_STATE.WAIT_TEMPLATE_START|ACTION.STORE_STATE_BEFORE,this.TT[T][0]=BASE_STATE.ERROR,this.TT[T][BASE_STATE.OTHERS]=T}InitTransitTable(){StyleAttrValueMachine._TT=new Array(STYLE_ATTR_VALUE_STATE.MAX_STATE);for(let T=0;T<STYLE_ATTR_VALUE_STATE.MAX_STATE;T++){const E=new Array(257);E.fill(0),this.TT[T]=E}this.TT[BASE_STATE.END][BASE_STATE.OTHERS]=BASE_STATE.END,this.FillTT(BASE_STATE.START,BASE_STATE.START,ACTION.IGNORE," \n\t\r"),this.TT[BASE_STATE.START][getCharCode(":")]=BASE_STATE.ERROR,this.TT[BASE_STATE.START][getCharCode(";")]=STYLE_ATTR_VALUE_STATE.IN_ITEM_SAPERATE|ACTION.STORE_TOKEN_EXCLUDE,this.TT[BASE_STATE.START][getCharCode("{")]=STYLE_ATTR_VALUE_STATE.WAIT_TEMPLATE_START|ACTION.STORE_STATE_BEFORE,this.TT[BASE_STATE.START][getCharCode("/")]=STYLE_ATTR_VALUE_STATE.WAIT_FOR_COMMENT_START|ACTION.STORE_STATE_BEFORE,this.TT[BASE_STATE.START][BASE_STATE.OTHERS]=STYLE_ATTR_VALUE_STATE.IN_KEY,this.FillTT(STYLE_ATTR_VALUE_STATE.WAIT_KEY,STYLE_ATTR_VALUE_STATE.WAIT_KEY,ACTION.IGNORE," \n\t\r"),this.TT[STYLE_ATTR_VALUE_STATE.WAIT_KEY][getCharCode(":")]=BASE_STATE.ERROR,this.TT[STYLE_ATTR_VALUE_STATE.WAIT_KEY][getCharCode(";")]=STYLE_ATTR_VALUE_STATE.IN_ITEM_SAPERATE|ACTION.STORE_TOKEN_EXCLUDE,this.TT[STYLE_ATTR_VALUE_STATE.WAIT_KEY][getCharCode("{")]=STYLE_ATTR_VALUE_STATE.IN_KEY|ACTION.REFEED,this.TT[STYLE_ATTR_VALUE_STATE.WAIT_KEY][BASE_STATE.OTHERS]=STYLE_ATTR_VALUE_STATE.IN_KEY,this.TT[STYLE_ATTR_VALUE_STATE.WAIT_KEY][getCharCode("/")]=STYLE_ATTR_VALUE_STATE.WAIT_FOR_COMMENT_START|ACTION.STORE_STATE_BEFORE,this.FillTT(STYLE_ATTR_VALUE_STATE.IN_KEY,STYLE_ATTR_VALUE_STATE.WAIT_KEY_VALUE_SAPERATE,ACTION.STORE_TOKEN_EXCLUDE|ACTION.IGNORE," \n\t\r"),this.TT[STYLE_ATTR_VALUE_STATE.IN_KEY][getCharCode(":")]=STYLE_ATTR_VALUE_STATE.IN_KEY_VALUE_SAPERATE|ACTION.STORE_TOKEN_EXCLUDE,this.TT[STYLE_ATTR_VALUE_STATE.IN_KEY][getCharCode(";")]=STYLE_ATTR_VALUE_STATE.IN_ITEM_SAPERATE|ACTION.STORE_TOKEN_EXCLUDE,this.TT[STYLE_ATTR_VALUE_STATE.IN_KEY][getCharCode("{")]=STYLE_ATTR_VALUE_STATE.WAIT_TEMPLATE_START|ACTION.STORE_STATE_BEFORE,this.TT[STYLE_ATTR_VALUE_STATE.IN_KEY][getCharCode('"')]=BASE_STATE.ERROR,this.TT[STYLE_ATTR_VALUE_STATE.IN_KEY][getCharCode("'")]=BASE_STATE.ERROR,this.TT[STYLE_ATTR_VALUE_STATE.IN_KEY][BASE_STATE.OTHERS]=STYLE_ATTR_VALUE_STATE.IN_KEY,this.TT[STYLE_ATTR_VALUE_STATE.IN_KEY][getCharCode("/")]=STYLE_ATTR_VALUE_STATE.WAIT_FOR_COMMENT_START|ACTION.STORE_STATE_BEFORE,this.FillTT(STYLE_ATTR_VALUE_STATE.WAIT_KEY_VALUE_SAPERATE,STYLE_ATTR_VALUE_STATE.WAIT_KEY_VALUE_SAPERATE,ACTION.IGNORE," \n\t\r"),this.TT[STYLE_ATTR_VALUE_STATE.WAIT_KEY_VALUE_SAPERATE][getCharCode(":")]=STYLE_ATTR_VALUE_STATE.IN_KEY_VALUE_SAPERATE|ACTION.STORE_TOKEN_EXCLUDE,this.TT[STYLE_ATTR_VALUE_STATE.WAIT_KEY_VALUE_SAPERATE][getCharCode(";")]=STYLE_ATTR_VALUE_STATE.WAIT_KEY|ACTION.STORE_TOKEN_EXCLUDE,this.TT[STYLE_ATTR_VALUE_STATE.WAIT_KEY_VALUE_SAPERATE][BASE_STATE.OTHERS]=BASE_STATE.ERROR,this.TT[STYLE_ATTR_VALUE_STATE.WAIT_KEY_VALUE_SAPERATE][getCharCode("/")]=STYLE_ATTR_VALUE_STATE.WAIT_FOR_COMMENT_START|ACTION.STORE_STATE_BEFORE,this.FillTT(STYLE_ATTR_VALUE_STATE.IN_KEY_VALUE_SAPERATE,STYLE_ATTR_VALUE_STATE.WAIT_VALUE,ACTION.STORE_TOKEN_EXCLUDE|ACTION.IGNORE," \n\t\r"),this.TT[STYLE_ATTR_VALUE_STATE.IN_KEY_VALUE_SAPERATE][getCharCode(":")]=STYLE_ATTR_VALUE_STATE.IN_KEY_VALUE_SAPERATE|ACTION.STORE_TOKEN_EXCLUDE,this.TT[STYLE_ATTR_VALUE_STATE.IN_KEY_VALUE_SAPERATE][getCharCode(";")]=STYLE_ATTR_VALUE_STATE.IN_ITEM_SAPERATE|ACTION.STORE_TOKEN_EXCLUDE,this.TT[STYLE_ATTR_VALUE_STATE.IN_KEY_VALUE_SAPERATE][BASE_STATE.OTHERS]=STYLE_ATTR_VALUE_STATE.IN_VALUE|ACTION.STORE_TOKEN_EXCLUDE,this.TT[STYLE_ATTR_VALUE_STATE.IN_KEY_VALUE_SAPERATE][getCharCode("\0")]=BASE_STATE.END|ACTION.STORE_TOKEN_EXCLUDE,this.TT[STYLE_ATTR_VALUE_STATE.IN_KEY_VALUE_SAPERATE][getCharCode('"')]=STYLE_ATTR_VALUE_STATE.IN_VALUE|ACTION.REFEED,this.TT[STYLE_ATTR_VALUE_STATE.IN_KEY_VALUE_SAPERATE][getCharCode("'")]=STYLE_ATTR_VALUE_STATE.IN_VALUE|ACTION.REFEED,this.TT[STYLE_ATTR_VALUE_STATE.IN_KEY_VALUE_SAPERATE][getCharCode("/")]=STYLE_ATTR_VALUE_STATE.IN_VALUE|ACTION.REFEED|ACTION.STORE_TOKEN_EXCLUDE,this.FillTT(STYLE_ATTR_VALUE_STATE.WAIT_VALUE,STYLE_ATTR_VALUE_STATE.WAIT_VALUE,ACTION.IGNORE," \n\t\r"),this.TT[STYLE_ATTR_VALUE_STATE.WAIT_VALUE][getCharCode(":")]=BASE_STATE.ERROR,this.TT[STYLE_ATTR_VALUE_STATE.WAIT_VALUE][getCharCode(";")]=STYLE_ATTR_VALUE_STATE.IN_ITEM_SAPERATE|ACTION.STORE_TOKEN_EXCLUDE,this.TT[STYLE_ATTR_VALUE_STATE.WAIT_VALUE][getCharCode("{")]=STYLE_ATTR_VALUE_STATE.WAIT_TEMPLATE_START|ACTION.STORE_STATE_BEFORE,this.TT[STYLE_ATTR_VALUE_STATE.WAIT_VALUE][getCharCode('"')]=STYLE_ATTR_VALUE_STATE.IN_VALUE|ACTION.REFEED,this.TT[STYLE_ATTR_VALUE_STATE.WAIT_VALUE][getCharCode("'")]=STYLE_ATTR_VALUE_STATE.IN_VALUE|ACTION.REFEED,this.TT[STYLE_ATTR_VALUE_STATE.WAIT_VALUE][getCharCode("\0")]=BASE_STATE.END,this.TT[STYLE_ATTR_VALUE_STATE.WAIT_VALUE][BASE_STATE.OTHERS]=STYLE_ATTR_VALUE_STATE.IN_VALUE,this.TT[STYLE_ATTR_VALUE_STATE.WAIT_VALUE][getCharCode("/")]=STYLE_ATTR_VALUE_STATE.WAIT_FOR_COMMENT_START|ACTION.STORE_STATE_BEFORE,this.TT[STYLE_ATTR_VALUE_STATE.IN_VALUE][getCharCode(";")]=STYLE_ATTR_VALUE_STATE.IN_ITEM_SAPERATE|ACTION.STORE_TOKEN_EXCLUDE,this.TT[STYLE_ATTR_VALUE_STATE.IN_VALUE][getCharCode('"')]=STYLE_ATTR_VALUE_STATE.IN_STRING|ACTION.STORE_STATE_BEFORE|ACTION.STORE_TOKEN_EXCLUDE,this.TT[STYLE_ATTR_VALUE_STATE.IN_VALUE][getCharCode("'")]=STYLE_ATTR_VALUE_STATE.IN_STRING2|ACTION.STORE_STATE_BEFORE|ACTION.STORE_TOKEN_EXCLUDE,this.TT[STYLE_ATTR_VALUE_STATE.IN_VALUE][getCharCode("{")]=STYLE_ATTR_VALUE_STATE.WAIT_TEMPLATE_START|ACTION.STORE_STATE_BEFORE,this.TT[STYLE_ATTR_VALUE_STATE.IN_VALUE][BASE_STATE.OTHERS]=STYLE_ATTR_VALUE_STATE.IN_VALUE,this.TT[STYLE_ATTR_VALUE_STATE.IN_VALUE][getCharCode("\0")]=BASE_STATE.END|ACTION.STORE_TOKEN_EXCLUDE,this.TT[STYLE_ATTR_VALUE_STATE.IN_VALUE][getCharCode("/")]=STYLE_ATTR_VALUE_STATE.WAIT_FOR_COMMENT_START|ACTION.STORE_STATE_BEFORE,this.FillTT(STYLE_ATTR_VALUE_STATE.IN_ITEM_SAPERATE,STYLE_ATTR_VALUE_STATE.WAIT_KEY,ACTION.STORE_TOKEN_EXCLUDE|ACTION.IGNORE," \n\t\r"),this.TT[STYLE_ATTR_VALUE_STATE.IN_ITEM_SAPERATE][getCharCode(";")]=STYLE_ATTR_VALUE_STATE.IN_ITEM_SAPERATE|ACTION.STORE_TOKEN_EXCLUDE,this.TT[STYLE_ATTR_VALUE_STATE.IN_ITEM_SAPERATE][getCharCode("{")]=STYLE_ATTR_VALUE_STATE.WAIT_TEMPLATE_START|ACTION.STORE_STATE_BEFORE,this.TT[STYLE_ATTR_VALUE_STATE.IN_ITEM_SAPERATE][getCharCode("'")]=BASE_STATE.ERROR,this.TT[STYLE_ATTR_VALUE_STATE.IN_ITEM_SAPERATE][getCharCode('"')]=BASE_STATE.ERROR,this.TT[STYLE_ATTR_VALUE_STATE.IN_ITEM_SAPERATE][BASE_STATE.OTHERS]=STYLE_ATTR_VALUE_STATE.IN_KEY|ACTION.STORE_TOKEN_EXCLUDE,this.TT[STYLE_ATTR_VALUE_STATE.IN_ITEM_SAPERATE][getCharCode("\0")]=BASE_STATE.END|ACTION.STORE_TOKEN_EXCLUDE,this.TT[STYLE_ATTR_VALUE_STATE.IN_ITEM_SAPERATE][getCharCode("/")]=STYLE_ATTR_VALUE_STATE.IN_KEY|ACTION.REFEED,this.TT[STYLE_ATTR_VALUE_STATE.WAIT_TEMPLATE_START][getCharCode("{")]=STYLE_ATTR_VALUE_STATE.IN_TEMPLATE|ACTION.STORE_TOKEN_FIRST,this.TT[STYLE_ATTR_VALUE_STATE.WAIT_TEMPLATE_START][BASE_STATE.OTHERS]=ACTION.GET_STATE_BEFORE,this.TT[STYLE_ATTR_VALUE_STATE.WAIT_TEMPLATE_START][getCharCode("/")]=STYLE_ATTR_VALUE_STATE.WAIT_FOR_COMMENT_START|ACTION.STORE_STATE_BEFORE,this.TT[STYLE_ATTR_VALUE_STATE.IN_TEMPLATE][getCharCode("}")]=STYLE_ATTR_VALUE_STATE.WAIT_TEMPLATE_END,this.TT[STYLE_ATTR_VALUE_STATE.IN_TEMPLATE][getCharCode("\\")]=BASE_STATE.ERROR,this.FillTT(STYLE_ATTR_VALUE_STATE.IN_TEMPLATE,STYLE_ATTR_VALUE_STATE.IN_TEMPLATE,ACTION.NOTHING," \n\t\r"),this.TT[STYLE_ATTR_VALUE_STATE.IN_TEMPLATE][BASE_STATE.OTHERS]=STYLE_ATTR_VALUE_STATE.IN_TEMPLATE,this.TT[STYLE_ATTR_VALUE_STATE.IN_TEMPLATE][0]=BASE_STATE.ERROR,this.TT[STYLE_ATTR_VALUE_STATE.IN_TEMPLATE][getCharCode("/")]=STYLE_ATTR_VALUE_STATE.WAIT_FOR_COMMENT_START|ACTION.STORE_STATE_BEFORE,this.TT[STYLE_ATTR_VALUE_STATE.WAIT_TEMPLATE_END][getCharCode("}")]=ACTION.GET_STATE_BEFORE|ACTION.STORE_TOKEN_INCLUDE,this.TT[STYLE_ATTR_VALUE_STATE.WAIT_TEMPLATE_END][BASE_STATE.OTHERS]=STYLE_ATTR_VALUE_STATE.IN_TEMPLATE|ACTION.REFEED,this.TT[STYLE_ATTR_VALUE_STATE.WAIT_TEMPLATE_END][getCharCode("/")]=STYLE_ATTR_VALUE_STATE.WAIT_FOR_COMMENT_START|ACTION.STORE_STATE_BEFORE,this.TT[STYLE_ATTR_VALUE_STATE.IN_TEMPLATE][getCharCode('"')]=STYLE_ATTR_VALUE_STATE.IN_TEMPLATE_STRING|ACTION.NOTHING,this.TT[STYLE_ATTR_VALUE_STATE.IN_TEMPLATE][getCharCode("'")]=STYLE_ATTR_VALUE_STATE.IN_TEMPLATE_STRING2|ACTION.NOTHING,this.TT[STYLE_ATTR_VALUE_STATE.WAIT_FOR_COMMENT_START][getCharCode("*")]=STYLE_ATTR_VALUE_STATE.IN_COMMENT|ACTION.STORE_TOKEN_INCLUDE,this.TT[STYLE_ATTR_VALUE_STATE.WAIT_FOR_COMMENT_START][BASE_STATE.OTHERS]=ACTION.GET_STATE_BEFORE,this.TT[STYLE_ATTR_VALUE_STATE.IN_COMMENT][getCharCode("*")]=STYLE_ATTR_VALUE_STATE.WAIT_FOR_COMMENT_END,this.TT[STYLE_ATTR_VALUE_STATE.IN_COMMENT][BASE_STATE.OTHERS]=STYLE_ATTR_VALUE_STATE.IN_COMMENT|ACTION.IGNORE,this.TT[STYLE_ATTR_VALUE_STATE.WAIT_FOR_COMMENT_END][getCharCode("/")]=ACTION.GET_STATE_BEFORE|ACTION.STORE_TOKEN_INCLUDE,this.TT[STYLE_ATTR_VALUE_STATE.WAIT_FOR_COMMENT_END][BASE_STATE.OTHERS]=STYLE_ATTR_VALUE_STATE.IN_COMMENT|ACTION.NOTHING,this.FillTT_template_string(STYLE_ATTR_VALUE_STATE.IN_TEMPLATE_STRING,STYLE_ATTR_VALUE_STATE.IN_TEMPLATE|ACTION.NOTHING,'"'),this.FillTT_template_string(STYLE_ATTR_VALUE_STATE.IN_TEMPLATE_STRING2,STYLE_ATTR_VALUE_STATE.IN_TEMPLATE|ACTION.NOTHING,"'"),this.FillTT_string(STYLE_ATTR_VALUE_STATE.IN_STRING,ACTION.GET_STATE_BEFORE,'"'),this.FillTT_string(STYLE_ATTR_VALUE_STATE.IN_STRING2,ACTION.GET_STATE_BEFORE,"'")}}class TemplateMachine extends BaseMachine{get TT(){return TemplateMachine._TT||this.InitTransitTable(),TemplateMachine._TT}constructor(T,E){super(T,E),this.mState.state=BASE_STATE.START}getTokens(){return[...this.tokens]}appendToken(T,E){this.tokens.push(new Token(T,E))}doExcludeAction(T,E){let _=TokenType.OTHERS;switch(T){case TEMPLATE_STATE.IN_TEMPLATE_ITEM:case TEMPLATE_STATE.WAIT_TEMPLATE_END:_=TokenType.TEMPLATE_ITEM}this.appendToken(_,E)}doIncludeAction(T,E,_){let A=TokenType.OTHERS;switch(E){case TEMPLATE_STATE.WAIT_TEMPLATE_START:A=TokenType.TEMPLATE_START;break;case TEMPLATE_STATE.WAIT_TEMPLATE_END:A=TokenType.TEMPLATE_END}this.appendToken(A,_)}InitTransitTable(){TemplateMachine._TT=new Array(TEMPLATE_STATE.MAX_STATE);for(let T=0;T<TEMPLATE_STATE.MAX_STATE;T++){const E=new Array(257);E.fill(0),this.TT[T]=E}this.FillTT(BASE_STATE.START,BASE_STATE.START,ACTION.IGNORE," \n\t\r"),this.TT[BASE_STATE.START][getCharCode("{")]=TEMPLATE_STATE.WAIT_TEMPLATE_START,this.TT[BASE_STATE.START][BASE_STATE.OTHERS]=BASE_STATE.ERROR,this.TT[TEMPLATE_STATE.WAIT_TEMPLATE_START][getCharCode("{")]=TEMPLATE_STATE.IN_TEMPLATE_ITEM|ACTION.STORE_TOKEN_INCLUDE,this.TT[TEMPLATE_STATE.WAIT_TEMPLATE_START][BASE_STATE.OTHERS]=BASE_STATE.ERROR,this.FillTT(TEMPLATE_STATE.IN_TEMPLATE_SPACE,TEMPLATE_STATE.IN_TEMPLATE_SPACE,ACTION.IGNORE," \n\t\r"),this.TT[TEMPLATE_STATE.IN_TEMPLATE_SPACE][getCharCode("}")]=TEMPLATE_STATE.WAIT_TEMPLATE_END,this.TT[TEMPLATE_STATE.IN_TEMPLATE_SPACE][getCharCode('"')]=TEMPLATE_STATE.IN_TEMPLATE_STRING|ACTION.STORE_STATE_BEFORE,this.TT[TEMPLATE_STATE.IN_TEMPLATE_SPACE][getCharCode("'")]=TEMPLATE_STATE.IN_TEMPLATE_STRING2|ACTION.STORE_STATE_BEFORE,this.TT[TEMPLATE_STATE.IN_TEMPLATE_SPACE][getCharCode("/")]=TEMPLATE_STATE.WAIT_FOR_COMMENT_START,this.TT[TEMPLATE_STATE.IN_TEMPLATE_SPACE][BASE_STATE.OTHERS]=TEMPLATE_STATE.IN_TEMPLATE_ITEM,this.FillTT(TEMPLATE_STATE.IN_TEMPLATE_ITEM,TEMPLATE_STATE.IN_TEMPLATE_SPACE,ACTION.STORE_TOKEN_EXCLUDE|ACTION.IGNORE," \n\t\r"),this.TT[TEMPLATE_STATE.IN_TEMPLATE_ITEM][getCharCode("}")]=TEMPLATE_STATE.WAIT_TEMPLATE_END,this.TT[TEMPLATE_STATE.IN_TEMPLATE_ITEM][getCharCode("\\")]=BASE_STATE.ERROR,this.TT[TEMPLATE_STATE.IN_TEMPLATE_ITEM][getCharCode('"')]=TEMPLATE_STATE.IN_TEMPLATE_STRING|ACTION.STORE_STATE_BEFORE|ACTION.STORE_TOKEN_EXCLUDE,this.TT[TEMPLATE_STATE.IN_TEMPLATE_ITEM][getCharCode("'")]=TEMPLATE_STATE.IN_TEMPLATE_STRING2|ACTION.STORE_STATE_BEFORE|ACTION.STORE_TOKEN_EXCLUDE,this.TT[TEMPLATE_STATE.IN_TEMPLATE_ITEM][BASE_STATE.OTHERS]=TEMPLATE_STATE.IN_TEMPLATE_ITEM,this.TT[TEMPLATE_STATE.IN_TEMPLATE_ITEM][0]=BASE_STATE.ERROR,this.TT[TEMPLATE_STATE.WAIT_FOR_COMMENT_START][getCharCode("*")]=TEMPLATE_STATE.IN_COMMENT,this.FillTT(TEMPLATE_STATE.WAIT_FOR_COMMENT_START,TEMPLATE_STATE.IN_TEMPLATE_ITEM,ACTION.REFEED," \n\t\r"),this.TT[TEMPLATE_STATE.WAIT_FOR_COMMENT_START][BASE_STATE.OTHERS]=TEMPLATE_STATE.IN_TEMPLATE_ITEM,this.TT[TEMPLATE_STATE.IN_COMMENT][getCharCode("*")]=TEMPLATE_STATE.WAIT_FOR_COMMENT_END,this.TT[TEMPLATE_STATE.IN_COMMENT][BASE_STATE.OTHERS]=TEMPLATE_STATE.IN_COMMENT,this.TT[TEMPLATE_STATE.WAIT_FOR_COMMENT_END][getCharCode("/")]=TEMPLATE_STATE.IN_TEMPLATE_SPACE|ACTION.IGNORE,this.FillTT_template_string(TEMPLATE_STATE.IN_TEMPLATE_STRING,TEMPLATE_STATE.IN_TEMPLATE_ITEM|ACTION.STORE_TOKEN_INCLUDE|ACTION.GET_STATE_BEFORE,'"'),this.FillTT_template_string(TEMPLATE_STATE.IN_TEMPLATE_STRING2,TEMPLATE_STATE.IN_TEMPLATE_ITEM|ACTION.STORE_TOKEN_INCLUDE|ACTION.GET_STATE_BEFORE,"'"),this.TT[TEMPLATE_STATE.WAIT_TEMPLATE_END][getCharCode("}")]=BASE_STATE.END|ACTION.STORE_TOKEN_INCLUDE,this.FillTT(TEMPLATE_STATE.WAIT_TEMPLATE_END,TEMPLATE_STATE.SPACE_AFTER_WAIT_TEMPLATE_END,ACTION.STORE_TOKEN_EXCLUDE," \n\t\r"),this.TT[TEMPLATE_STATE.WAIT_TEMPLATE_END][BASE_STATE.OTHERS]=TEMPLATE_STATE.IN_TEMPLATE_ITEM|ACTION.REFEED,this.FillTT(TEMPLATE_STATE.SPACE_AFTER_WAIT_TEMPLATE_END,TEMPLATE_STATE.SPACE_AFTER_WAIT_TEMPLATE_END,ACTION.IGNORE," \n\t\r"),this.TT[TEMPLATE_STATE.SPACE_AFTER_WAIT_TEMPLATE_END][getCharCode("}")]=TEMPLATE_STATE.WAIT_TEMPLATE_END|ACTION.STORE_ONE_SPACE,this.TT[TEMPLATE_STATE.SPACE_AFTER_WAIT_TEMPLATE_END][BASE_STATE.OTHERS]=TEMPLATE_STATE.IN_TEMPLATE_ITEM|ACTION.IGNORE|ACTION.REFEED,this.FillTT(BASE_STATE.END,BASE_STATE.END,ACTION.IGNORE," \n\t\r"),this.TT[BASE_STATE.END][getCharCode("\0")]=BASE_STATE.END,this.TT[BASE_STATE.END][BASE_STATE.OTHERS]=BASE_STATE.ERROR}}class TemplateTokenizer{constructor(T,E){this.machine=new TemplateMachine(E,T),this.m_pSrc=T,this.path=E}toString(){this.tokens||(this.tokens=this.generateTokens());return this.tokens.map(T=>T.value).join("")}generateTokens(){if(this.machine.Reset(),0===this.m_pSrc.length)return[];for(let T=0;T<this.m_pSrc.length;T++){const E=this.m_pSrc[T];this.machine.Feed(E)}return this.machine.Feed("\0"),this.machine.getTokens()}}exports.TemplateTokenizer=TemplateTokenizer;class StyleAttrValueTokenizer{constructor(T,E){this.machine=new StyleAttrValueMachine(E,T),this.m_pSrc=T,this.path=E}toString(){return this.tokens||(this.tokens=this.generateTokens()),this.tokens.map(T=>T.value).join("")}generateTokens(){if(this.machine.Reset(),0===this.m_pSrc.length)return[];for(let T=0;T<this.m_pSrc.length;T++){const E=this.m_pSrc[T];this.machine.Feed(E)}return this.machine.Feed("\0"),this.machine.getTokens()}}exports.StyleAttrValueTokenizer=StyleAttrValueTokenizer;class Machine extends BaseMachine{get TT(){return Machine._TT||this.InitTransitTable(),Machine._TT}constructor(T,E){super(T,E),this.tagStack=[],this.InitTransitTable(),this.mPath=T,this.mSrc=E}get wxsState(){return"wxs"===this.tagStack[this.tagStack.length-1]}get textState(){return"text"===this.tagStack[this.tagStack.length-1]}getTokens(){return[...this.tokens]}checkLastTokenIfTypeMatch(T){var E;return(null===(E=this.tokens[this.tokens.length-1])||void 0===E?void 0:E.type)===T?this.tokens[this.tokens.length-1]:void 0}getLastTokenIfTypeMatch(T){if(0!==this.tokens.length)for(let E=this.tokens.length-1;E>=0;E--){const _=this.tokens[E];if(_.type===T)return _}}canBeOmittedTokenType(T){return T===TokenType.WXS_VALUE}appendToken(T,E){if(this.canBeOmittedTokenType(T)&&(E=this.transTagTextTokenValue(E)),T===TokenType.ATTR_VALUE){const T=this.getLastTokenIfTypeMatch(TokenType.ATTR);"style"===(null==T?void 0:T.value)&&(E=this.trySlimStyleAttrValue(E))}E&&this.tokens.push(new Token(T,E))}transTagTextTokenValue(T){return this.wxsState?T=T.split("\n").map(T=>T.trim()).join("\n"):T}trySlimStyleAttrValue(T){const E=[];try{if(T.length<=1)return T;for(let T=this.tokens.length-1;T>=0;T--){if(this.tokens[T].type===TokenType.TAG_EQ)break;E.unshift(this.tokens.pop())}const _=`${E.map(T=>null==T?void 0:T.value).join("")}${T}`,A=_.startsWith('"')||_.startsWith("'"),S=_.endsWith('"')||_.endsWith("'"),t=new StyleAttrValueTokenizer(_.replace(/^['"]/,"").replace(/['"]$/,""),this.mPath).toString();return`${A?_.substr(0,1):""}${t}${S?_.substr(_.length-1,1):""}`}catch(T){this.tokens.push(...E)}return T}doExcludeAction(T,E){let _=TokenType.OTHERS;switch(T){case STATE.IN_TAG_ATTR_VALUE_STRING:case STATE.IN_TAG_ATTR_VALUE_STRING_SINGLE:_=TokenType.ATTR_VALUE;break;case STATE.IN_TAG_WORD:_=TokenType.TAG,this.tagStack.push(E);break;case STATE.IN_END_TAG_WORD:_=TokenType.TAG;if(this.tagStack.pop()!==E)throw{col:this.mState.col-E.length,line:this.mState.line,message:"unexpected end tag: "+E};break;case STATE.IN_WXS:_=TokenType.WXS_VALUE;break;case STATE.IN_TEXT:_=TokenType.TEXT_VALUE;break;case STATE.IN_TAG_TEXT:_=TokenType.TAG_TEXT_VALUE;break;case STATE.IN_TAG_ATTR_WORD:_=TokenType.ATTR;break;case STATE.TAG_START:_=TokenType.LEFT_ANGLE_BRACKET;break;case STATE.IN_TEMPLATE:_=TokenType.TEMPLATE_ITEM;break;case STATE.TAG_EQ:_=TokenType.TAG_EQ;break;case STATE.TEMPLATE_END_CHECK:{const T=this.mState.cur_pos;if("}"===this.mSrc.substring(T-3,T-2))throw{col:this.mState.col-3,line:this.mState.line,message:"unexpected end tag: }. } should not be followed by }} direactly, add a space and change it to } }}"};this.appendToken(TokenType.TEMPLATE_ITEM,""+new TemplateTokenizer(E,this.mPath)),_=TokenType.TEMPLATE_END,E=""}}this.appendToken(_,E)}doIncludeAction(T,E,_){const A=this.mState.state;let S;E===STATE.WXS_END_STEP?(this.appendToken(TokenType.WXS_VALUE,_.substr(0,_.length-2)),S=TokenType.END_LEFT_ANGLE_BRACKET,_="</"):E===STATE.IN_WXS_STRING||E===STATE.IN_WXS_STRING_SINGLE?S=TokenType.WXS_VALUE:E===STATE.IN_TAG_ATTR_VALUE_STRING||E===STATE.IN_TAG_ATTR_VALUE_STRING_SINGLE?S=TokenType.ATTR_VALUE:E===STATE.TAG_START&&A===STATE.IN_END_TAG?S=TokenType.END_LEFT_ANGLE_BRACKET:E===STATE.WAIT_FOR_RIGHT_BRACKET?(S=TokenType.SELF_CLOSE,this.tagStack.pop()):S=TokenType.OTHERS,">"!==T||E!==STATE.IN_TAG_WORD&&E!==STATE.IN_TAG_ATTR_WORD&&E!==STATE.IN_TAG_ATTR_VALUE_STRING&&E!==STATE.IN_TAG_ATTR_VALUE_STRING_SINGLE&&E!==STATE.IN_END_TAG_WORD||(S=TokenType.RIGHT_ANGLE_BRACKET),this.appendToken(S,_)}Feed(T){super.Feed(T),this.wxsState&&this.mState.state===STATE.IN_TAG_TEXT&&(this.mState.state=STATE.IN_WXS),this.textState&&this.mState.state===STATE.IN_TAG_TEXT&&(this.mState.state=STATE.IN_TEXT)}FillTT_attr_string(T,E,_){const A=T+1;this.TT[T][getCharCode("\\")]=A,this.TT[T][getCharCode("\n")]=BASE_STATE.ERROR,this.TT[A][BASE_STATE.OTHERS]=T,this.TT[A][getCharCode("\n")]=E|ACTION.STORE_TOKEN_EXCLUDE|ACTION.IGNORE,this.TT[T][getCharCode(_)]=E|ACTION.STORE_TOKEN_INCLUDE,this.TT[T][getCharCode("{")]=STATE.WAIT_TEMPLATE_START|ACTION.STORE_STATE_BEFORE,this.TT[T][0]=BASE_STATE.ERROR,this.TT[T][BASE_STATE.OTHERS]=T}InitTransitTable(){Machine._TT=new Array(STATE.MAX_STATE);for(let T=0;T<STATE.MAX_STATE;T++){const E=new Array(257);E.fill(0),this.TT[T]=E}this.TT[BASE_STATE.END][BASE_STATE.OTHERS]=BASE_STATE.END,this.TT[BASE_STATE.START][getCharCode("<")]=STATE.TAG_START|ACTION.STORE_TOKEN_EXCLUDE|ACTION.STORE_STATE_BEFORE,this.TT[BASE_STATE.START][getCharCode("{")]=STATE.WAIT_TEMPLATE_START|ACTION.STORE_STATE_BEFORE,this.TT[BASE_STATE.START][BASE_STATE.OTHERS]=STATE.IN_TAG_TEXT|ACTION.NOTHING,this.TT[BASE_STATE.START][0]=BASE_STATE.END|ACTION.STORE_TOKEN_EXCLUDE,this.TT[STATE.IN_TAG_TEXT][getCharCode("<")]=STATE.TAG_START|ACTION.STORE_TOKEN_EXCLUDE|ACTION.STORE_STATE_BEFORE,this.TT[STATE.IN_TAG_TEXT][getCharCode("{")]=STATE.WAIT_TEMPLATE_START|ACTION.STORE_STATE_BEFORE,this.TT[STATE.IN_TAG_TEXT][BASE_STATE.OTHERS]=STATE.IN_TAG_TEXT|ACTION.NOTHING,this.TT[STATE.IN_TAG_TEXT][0]=BASE_STATE.END|ACTION.STORE_TOKEN_EXCLUDE,this.TT[STATE.IN_TAG_TEXT][BASE_STATE.OTHERS]=STATE.IN_TAG_TEXT,this.TT[STATE.WAIT_TEMPLATE_START][getCharCode("{")]=STATE.IN_TEMPLATE|ACTION.STORE_TOKEN_FIRST,this.TT[STATE.WAIT_TEMPLATE_START][BASE_STATE.OTHERS]=STATE.IN_TAG_TEXT|ACTION.GET_STATE_BEFORE,this.TT[STATE.IN_TEMPLATE][getCharCode("{")]=STATE.IN_TEMPLATE|ACTION.RECORD_IN_TEMPLATE_OBJECT,this.TT[STATE.IN_TEMPLATE][getCharCode("}")]=STATE.WAIT_TEMPLATE_END|ACTION.CHECK_IN_TEMPLATE_OBJECT,this.TT[STATE.IN_TEMPLATE][getCharCode("\\")]=BASE_STATE.ERROR,this.FillTT(STATE.IN_TEMPLATE,STATE.IN_TEMPLATE,ACTION.NOTHING," \n\t\r"),this.TT[STATE.IN_TEMPLATE][BASE_STATE.OTHERS]=STATE.IN_TEMPLATE,this.TT[STATE.IN_TEMPLATE][0]=BASE_STATE.ERROR,this.TT[STATE.WAIT_TEMPLATE_END][getCharCode("}")]=STATE.TEMPLATE_END_CHECK,this.TT[STATE.TEMPLATE_END_CHECK][BASE_STATE.OTHERS]=STATE.IN_TAG_TEXT|ACTION.REFEED|ACTION.STORE_TOKEN_EXCLUDE|ACTION.GET_STATE_BEFORE,this.TT[STATE.WAIT_TEMPLATE_END][BASE_STATE.OTHERS]=STATE.IN_TEMPLATE|ACTION.REFEED,this.TT[STATE.IN_TEMPLATE][getCharCode('"')]=STATE.IN_TEMPLATE_STRING|ACTION.NOTHING,this.TT[STATE.IN_TEMPLATE][getCharCode("'")]=STATE.IN_TEMPLATE_STRING2|ACTION.NOTHING,this.FillTT_template_string(STATE.IN_TEMPLATE_STRING,STATE.IN_TEMPLATE|ACTION.NOTHING,'"'),this.FillTT_template_string(STATE.IN_TEMPLATE_STRING2,STATE.IN_TEMPLATE|ACTION.NOTHING,"'"),this.FillTT(STATE.TAG_START,STATE.TAG_START,ACTION.STORE_TOKEN_EXCLUDE|ACTION.IGNORE," \n\t\r"),this.FillTT(STATE.TAG_START,STATE.IN_TAG_WORD,ACTION.STORE_TOKEN_EXCLUDE,ALPHA),this.TT[STATE.TAG_START][getCharCode("/")]=STATE.IN_END_TAG|ACTION.STORE_TOKEN_INCLUDE,this.TT[STATE.TAG_START][getCharCode("!")]=STATE.IN_COMMENT_BEGIN1,this.TT[STATE.TAG_START][BASE_STATE.OTHERS]=BASE_STATE.ERROR,this.TT[STATE.IN_COMMENT_BEGIN1][getCharCode("-")]=STATE.IN_COMMENT_BEGIN2,this.TT[STATE.IN_COMMENT_BEGIN1][BASE_STATE.OTHERS]=BASE_STATE.ERROR,this.TT[STATE.IN_COMMENT_BEGIN2][getCharCode("-")]=STATE.IN_COMMENT,this.TT[STATE.IN_COMMENT_BEGIN2][BASE_STATE.OTHERS]=BASE_STATE.ERROR,this.TT[STATE.IN_COMMENT][getCharCode("-")]=STATE.WAIT_FOR_COMMENT_END1,this.TT[STATE.IN_COMMENT][BASE_STATE.OTHERS]=STATE.IN_COMMENT,this.TT[STATE.WAIT_FOR_COMMENT_END1][getCharCode("-")]=STATE.WAIT_FOR_COMMENT_END2,this.TT[STATE.WAIT_FOR_COMMENT_END1][BASE_STATE.OTHERS]=STATE.IN_COMMENT,this.TT[STATE.WAIT_FOR_COMMENT_END2][getCharCode(">")]=STATE.IN_TAG_TEXT|ACTION.IGNORE|ACTION.GET_STATE_BEFORE,this.TT[STATE.WAIT_FOR_COMMENT_END2][getCharCode("-")]=STATE.WAIT_FOR_COMMENT_END2,this.TT[STATE.WAIT_FOR_COMMENT_END2][BASE_STATE.OTHERS]=STATE.IN_COMMENT,this.FillTT(STATE.IN_TAG_WORD,STATE.IN_TAG_WORD,ACTION.NOTHING,ALPHA),this.FillTT(STATE.IN_TAG_WORD,STATE.IN_TAG_WORD,ACTION.NOTHING,DIGIT),this.FillTT(STATE.IN_TAG_WORD,STATE.IN_TAG_ATTR_WORD,ACTION.STORE_TOKEN_EXCLUDE|ACTION.IGNORE," \n\t\r"),this.TT[STATE.IN_TAG_WORD][getCharCode(">")]=STATE.IN_TAG_TEXT|ACTION.STORE_TOKEN_EXCLUDE|ACTION.STORE_TOKEN_INCLUDE,this.TT[STATE.IN_TAG_WORD][getCharCode("/")]=STATE.WAIT_FOR_RIGHT_BRACKET|ACTION.STORE_TOKEN_EXCLUDE,this.TT[STATE.IN_TAG_WORD][BASE_STATE.OTHERS]=BASE_STATE.ERROR,this.TT[STATE.IN_TAG_WORD][0]=BASE_STATE.ERROR,this.FillTT(STATE.IN_TAG_ATTR_WORD,STATE.IN_TAG_ATTR_WORD,ACTION.NOTHING,ALPHA),this.FillTT(STATE.IN_TAG_ATTR_WORD,STATE.IN_TAG_ATTR_WORD,ACTION.NOTHING,DIGIT),this.FillTT(STATE.IN_TAG_ATTR_WORD,STATE.IN_TAG_ATTR_WORD,ACTION.STORE_TOKEN_EXCLUDE|ACTION.IGNORE," \n\t\r"),this.TT[STATE.IN_TAG_ATTR_WORD][getCharCode("=")]=STATE.TAG_EQ|ACTION.STORE_TOKEN_EXCLUDE,this.TT[STATE.IN_TAG_ATTR_WORD][getCharCode('"')]=BASE_STATE.ERROR,this.TT[STATE.IN_TAG_ATTR_WORD][getCharCode(">")]=STATE.IN_TAG_TEXT|ACTION.STORE_TOKEN_EXCLUDE|ACTION.STORE_TOKEN_INCLUDE,this.TT[STATE.IN_TAG_ATTR_WORD][getCharCode("/")]=STATE.WAIT_FOR_RIGHT_BRACKET|ACTION.STORE_TOKEN_EXCLUDE,this.TT[STATE.IN_TAG_ATTR_WORD][BASE_STATE.OTHERS]=BASE_STATE.ERROR,this.TT[STATE.IN_TAG_ATTR_WORD][0]=BASE_STATE.ERROR,this.FillTT(STATE.TAG_EQ,STATE.TAG_EQ,ACTION.STORE_TOKEN_EXCLUDE|ACTION.IGNORE," \n\t\r"),this.FillTT(STATE.TAG_EQ,STATE.IN_TAG_ATTR_VALUE_STRING,ACTION.STORE_TOKEN_EXCLUDE,ALPHA),this.TT[STATE.TAG_EQ][getCharCode('"')]=STATE.IN_TAG_ATTR_VALUE_STRING|ACTION.STORE_TOKEN_EXCLUDE,this.TT[STATE.TAG_EQ][getCharCode("'")]=STATE.IN_TAG_ATTR_VALUE_STRING_SINGLE|ACTION.STORE_TOKEN_EXCLUDE,this.TT[STATE.TAG_EQ][0]=BASE_STATE.ERROR,this.TT[STATE.TAG_EQ][BASE_STATE.OTHERS]=BASE_STATE.ERROR,this.FillTT(STATE.IN_END_TAG,STATE.IN_END_TAG,ACTION.IGNORE," \n\t\r"),this.FillTT(STATE.IN_END_TAG,STATE.IN_END_TAG_WORD,ACTION.NOTHING,ALPHA),this.FillTT(STATE.IN_END_TAG,BASE_STATE.ERROR,ACTION.NOTHING,DIGIT),this.TT[STATE.IN_END_TAG][getCharCode(">")]=STATE.IN_TAG_TEXT|ACTION.STORE_TOKEN_INCLUDE,this.TT[STATE.IN_END_TAG][BASE_STATE.OTHERS]=BASE_STATE.ERROR,this.FillTT(STATE.IN_END_TAG_WORD,STATE.IN_END_TAG_WORD,ACTION.NOTHING,ALPHA),this.FillTT(STATE.IN_END_TAG_WORD,STATE.IN_END_TAG_WORD,ACTION.NOTHING,DIGIT),this.FillTT(STATE.IN_END_TAG_WORD,STATE.IN_END_TAG,ACTION.STORE_TOKEN_EXCLUDE|ACTION.IGNORE," \n\t\r"),this.TT[STATE.IN_END_TAG_WORD][getCharCode(">")]=STATE.IN_TAG_TEXT|ACTION.STORE_TOKEN_EXCLUDE|ACTION.STORE_TOKEN_INCLUDE,this.TT[STATE.IN_END_TAG_WORD][getCharCode("/")]=STATE.WAIT_FOR_RIGHT_BRACKET|ACTION.STORE_TOKEN_EXCLUDE,this.TT[STATE.IN_END_TAG_WORD][BASE_STATE.OTHERS]=BASE_STATE.ERROR,this.FillTT(STATE.WAIT_FOR_RIGHT_BRACKET,STATE.IN_TAG_WORD,ACTION.STORE_TOKEN_EXCLUDE,ALPHA),this.TT[STATE.WAIT_FOR_RIGHT_BRACKET][getCharCode(">")]=STATE.IN_TAG_TEXT|ACTION.STORE_TOKEN_INCLUDE,this.TT[STATE.WAIT_FOR_RIGHT_BRACKET][BASE_STATE.OTHERS]=BASE_STATE.ERROR,this.FillTT_attr_string(STATE.IN_TAG_ATTR_VALUE_STRING,STATE.IN_TAG_ATTR_WORD,'"'),this.FillTT_attr_string(STATE.IN_TAG_ATTR_VALUE_STRING_SINGLE,STATE.IN_TAG_ATTR_WORD,"'"),this.TT[STATE.IN_WXS][getCharCode("<")]=STATE.WXS_END_STEP,this.TT[STATE.IN_WXS][getCharCode('"')]=STATE.IN_WXS_STRING|ACTION.STORE_TOKEN_EXCLUDE,this.TT[STATE.IN_WXS][getCharCode("'")]=STATE.IN_WXS_STRING_SINGLE|ACTION.STORE_TOKEN_EXCLUDE,this.FillTT_attr_string(STATE.IN_WXS_STRING,STATE.IN_WXS,'"'),this.FillTT_attr_string(STATE.IN_WXS_STRING_SINGLE,STATE.IN_WXS,"'"),this.TT[STATE.IN_WXS][BASE_STATE.OTHERS]=STATE.IN_WXS,this.TT[STATE.WXS_END_STEP][getCharCode("/")]=STATE.IN_END_TAG|ACTION.STORE_TOKEN_INCLUDE,this.TT[STATE.WXS_END_STEP][BASE_STATE.OTHERS]=STATE.IN_WXS,this.TT[STATE.IN_TEXT][getCharCode("<")]=STATE.TAG_START|ACTION.STORE_TOKEN_EXCLUDE,this.TT[STATE.IN_TEXT][BASE_STATE.OTHERS]=STATE.IN_TEXT,this.TT[STATE.IN_TEXT][getCharCode("{")]=STATE.WAIT_TEMPLATE_START|ACTION.STORE_STATE_BEFORE}}class Tokenizer{constructor(T,E){this.machine=new Machine(E,T),this.m_pSrc=T,this.path=E}generateTokens(){if(this.machine.Reset(),0===this.m_pSrc.length)return[];try{for(let T=0;T<this.m_pSrc.length;T++){const E=this.m_pSrc[T];this.machine.Feed(E)}this.machine.Feed("\0")}catch(T){throw new Error(`${T.line}:${T.col}:${T.message}`)}return this.machine.getTokens()}}function generateWXMLFromTokens(T,E={collapseWhitespace:!0,conservativeCollapse:!1,preserveLineBreaks:!1}){const{collapseWhitespace:_,conservativeCollapse:A,preserveLineBreaks:S}=E,t=[];for(let E=0;E<T.length;E++){const e=T[E];let N=e.value;const R=e.type;if(R===TokenType.ATTR&&(N=" "+N),R===TokenType.TAG_TEXT_VALUE){S||(N=N.replace(/\n/g," ")),_&&(N=N.replace(/([ \t])+/g," "));const t=T[E-1];t&&t.type!==TokenType.RIGHT_ANGLE_BRACKET&&t.type!==TokenType.SELF_CLOSE||_&&!A&&(N=trimStringLeft(N,!1)),(null==t?void 0:t.type)===TokenType.TAG_TEXT_VALUE&&((null==t?void 0:t.value.endsWith(" "))||(null==t?void 0:t.value.endsWith("\n")))&&_&&(N=trimStringLeft(N,!1))}if(R===TokenType.LEFT_ANGLE_BRACKET||R===TokenType.END_LEFT_ANGLE_BRACKET){const S=T[E-1];if((null==S?void 0:S.type)===TokenType.TAG_TEXT_VALUE&&_&&!A){const T=t.pop()||"";t.push(trimStringRight(T,!1))}}t.push(N)}return t.join("")}async function minifyWXML(T){const{filePath:E,root:_=""}=T,A=T.code instanceof Buffer?T.code.toString():T.code,S=Object.assign({collapseWhitespace:!0,conservativeCollapse:!1,preserveLineBreaks:!1},T.setting),t=path_1.default.posix.join(_,E);if(A.length>0)try{const T=new Tokenizer(A.replace(/\r\n/g,"\n"),t);return{error:null,code:generateWXMLFromTokens(T.generateTokens(),S)}}catch(T){return log.error("minifywxml error @ "+t),log.error(T.message),{error:{code:config_1.MINIFY_WXML_ERR,path:t,message:T.message}}}return{error:null,code:A.replace(/\r\n/g,"\n")}}exports.minifyWXML=minifyWXML;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.getWorkerManager=exports.AbortEvent=void 0;const tslib_1=require("tslib"),path_1=tslib_1.__importDefault(require("path")),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.getWorkerManager=exports.AbortEvent=void 0;const tslib_1=require("tslib"),path_1=tslib_1.__importDefault(require("path")),events_1=tslib_1.__importDefault(require("events")),log=tslib_1.__importStar(require("../../../../utils/log")),logger_1=require("../utils/logger"),env_1=require("../utils/env"),child_process_1=require("child_process"),call_func_1=require("./task/call_func"),config_1=require("./config"),getWorkerPoolSize_1=tslib_1.__importDefault(require("./getWorkerPoolSize")),cpus=(0,getWorkerPoolSize_1.default)(),WORKER_PATH=path_1.default.posix.join(__dirname,"./worker.js"),FORK_PATH=path_1.default.posix.join(__dirname,"./fork.js"),WEB_FORK_PATH="https://webidebackend.asdf.com/webide-dist/workermanagerentry.js",MAX_TASK_TRY_TIME=2;let envIsDevtools=!1;function getCurrentScriptPath(){const e=path_1.default.posix.relative(process.cwd(),__filename);return process.cwd()===__dirname?`.${path_1.default.posix.resolve}${e}`:e}const supportWebWorkerThread="undefined"!=typeof WEBIDE_WEBPECK_DEFINE_PLUGIN;let Worker,workerManagerInstance,supportWorkerThread=!1;try{Worker=require("worker_threads").Worker,supportWorkerThread=!0}catch(e){supportWorkerThread=!1}exports.AbortEvent="WorkerTaskAborted";class WorkerInstance extends events_1.default{constructor(){super(),this.status=config_1.EWorkerStatus.free,this.threadId=-1,this._suicideTime=config_1.SUICIDE_TIME["miniprogram-ci"],this._postMessage=()=>{}}async init(){envIsDevtools&&(this._suicideTime=config_1.SUICIDE_TIME.devtools);const e={NODE_PATH:path_1.default.posix.join(getCurrentScriptPath(),"../../../node_modules"),isDevtools:String(envIsDevtools)};supportWebWorkerThread||(supportWorkerThread?(logger_1.logger.info("create worker start"),this._instance=new Worker(WORKER_PATH,{env:Object.assign(Object.assign({},e),{cpprocessEnv:"workerthread"}),stdout:!0}),this.threadId=this._instance.threadId,this._postMessage=this._instance.postMessage.bind(this._instance)):(this._instance=(0,child_process_1.fork)(FORK_PATH,[""],{env:Object.assign(Object.assign({},e),{cpprocessEnv:"workerprocess"})}),this.threadId=this._instance.pid,this._postMessage=this._instance.send.bind(this._instance)));const t=e=>{const{command:t,data:s}=e;t===config_1.COMMAND.TASK_DONE&&this.onTaskDone(s),t===config_1.COMMAND.SEND_LOG&&logger_1.logger.send(s.level,s.args),t===config_1.COMMAND.CALL_FUNC&&call_func_1.call.apply(null,[s.funcName,...s.args]).then(e=>{this._postMessage({command:config_1.COMMAND.CALL_FUNC_RESULT,data:{id:s.id,result:e}})}).catch(e=>{this._postMessage({command:config_1.COMMAND.CALL_FUNC_RESULT,data:{id:s.id,error:e.toString()}})})},s=e=>{0!==e&&1!==e&&log.error(`worker thread: ${this.threadId}, status: ${this.status}, exit with code: ${e}`),this.emit("exit",{code:e,status:this.status,task:this._task,threadId:this.threadId})};supportWebWorkerThread?(this._instance.onMsg(t),this._instance.onError(s)):(this._instance.on("message",t),this._instance.on("exit",s))}on(e,t){return super.on(e,t)}onTaskDone(e){var t;this.status=config_1.EWorkerStatus.free,(null===(t=this._task)||void 0===t?void 0:t.resolve)&&(this._task.onStatusUpdate(config_1.ETaskStatus.done),this._task.resolve(e)),this._task=void 0,this.emit("taskDone",this.threadId),env_1.summerProcess&&env_1.nativeProcess||this.setUpSuicideTimer()}setUpSuicideTimer(){this._suicideTimer=setTimeout(()=>{clearTimeout(this._suicideTimer),this.status===config_1.EWorkerStatus.free?(this.status=config_1.EWorkerStatus.dying,supportWebWorkerThread?this._instance.kill():supportWorkerThread?this._instance.terminate():this._instance.kill("SIGTERM")):this._suicideTimer||this.setUpSuicideTimer()},this._suicideTime)}runTask(e){clearTimeout(this._suicideTimer),this.status=config_1.EWorkerStatus.busy,this._task=e,this._task.onStatusUpdate(config_1.ETaskStatus.progress),this._postMessage({command:config_1.COMMAND.RUN_TASK,data:{taskName:e.name,data:e.data}})}}class WorkerManager{constructor(e,t=!1){this._taskQueue=[],this._workerPool={},this._max_pool_size=4,this.onWorkerExit=async e=>{const{code:t,status:s,task:r,threadId:i}=e;delete this._workerPool[i],s===config_1.EWorkerStatus.busy&&(r.retryTimes+=1,r.retryTimes<=2?(log.error(`worker thread: ${i} exit with code: ${t} when it is busy, retry ${r.retryTimes} times`),this._taskQueue.push(r)):r.reject(`worker thread exit with code: ${t} when it is busy`)),await this._run()},this._actualWorkerPoolSize=1,this._doneThreadSet=new Set,this.onTaskDone=async e=>{this._doneThreadSet.add(e),this._actualWorkerPoolSize=Math.min(howManyWorker(this._doneThreadSet.size),this._max_pool_size),await this._run()},this._max_pool_size=e>8?8:e,envIsDevtools=t}runTask(e,t,s=(()=>{})){return new Promise((r,i)=>{const o={name:e,data:t,resolve:r,reject:i,retryTimes:0,onStatusUpdate:s};s(config_1.ETaskStatus.waiting),this._taskQueue.push(o),this._run()})}abort(e){const t=[],s=[];this._taskQueue.forEach(r=>{r.name!==e?s.push(r):t.push(r)}),t.forEach(e=>{e.reject(exports.AbortEvent)}),this._taskQueue=s}async _run(){let e=this._taskQueue[0];for(;e;){const t=this.getFreeWorker();if(!t)return;this._taskQueue.shift(),t.runTask(e),e=this._taskQueue[0]}}getFreeWorker(){for(const e in this._workerPool){const t=this._workerPool[e];if(t.status===config_1.EWorkerStatus.free)return t}return this.allocWorker(),null}async allocWorker(){if(this.workerCount()<this._max_pool_size){const e=new WorkerInstance;return await e.init(),e.on("taskDone",this.onTaskDone),e.on("exit",this.onWorkerExit),this._workerPool[e.threadId]=e,this._run(),e}return null}workerCount(){return Object.keys(this._workerPool).length}}function howManyWorker(e){switch(e){case 1:return 4;case 2:return 6;default:return 8}}const getWorkerManager=function(e=!1){return workerManagerInstance||(workerManagerInstance=new WorkerManager(cpus,e)),workerManagerInstance};exports.getWorkerManager=getWorkerManager;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.messageHandler=exports.onMessage=exports.destroy=exports.initHandler=void 0;const summerCPProject_1=require("../../project/summerCPProject"),index_1=require("../precompiler/index"),progressRecorder_1=require("../../utils/progressRecorder"),index_2=require("./original/index"),summer_1=require("./summer/summer"),debug_1=require("../../utils/debug");let summercompileManager,summerProject,preCompiler,precompileProject,inited=!1;function processSend(e){(0,debug_1.shouldRunInMainProcess)()?emiter.emit("message",e):
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.messageHandler=exports.onMessage=exports.destroy=exports.initHandler=void 0;const summerCPProject_1=require("../../project/summerCPProject"),index_1=require("../precompiler/index"),progressRecorder_1=require("../../utils/progressRecorder"),index_2=require("./original/index"),summer_1=require("./summer/summer"),debug_1=require("../../utils/debug"),getProcess_1=require("../../utils/subprocess/getProcess");let summercompileManager,summerProject,preCompiler,precompileProject,inited=!1;function processSend(e){(0,debug_1.shouldRunInMainProcess)()?emiter.emit("message",e):(0,getProcess_1.getProcess)().send(e)}async function initHandler(e){const{passData:r,projectInfo:o,options:t}=e.data;if(inited)return;summerProject=new summerCPProject_1.SummerCPProject(o),await summerProject.ready();const{targetPlatform:s,targetPlatformDefines:a}=o;preCompiler=new index_1.PreCompiler(summerProject,{showBuildLog:(e,r,o)=>{processSend({type:"log",id:e,status:r,text:o})}},void 0),precompileProject=await preCompiler.getPreCompileProject({targetPlatform:s,targetPlatformDefines:a,runEnv:"summer cp"});const{cachePath:i}=r;summercompileManager=new summer_1.SummerCompiler(precompileProject,i,t),inited=!0}async function getCodeFiles(e,r,o){let t={};"getDevCodeByFileList"===e?t=await r.run("getDevCodeByFileList-"+o.graphId,()=>summercompileManager.getDevCodeByFileList(o,r)):"getCode"===e&&(t=await r.run(`getCode-${o.graphId}-${o.package}`,()=>summercompileManager.getCode(o,r)));const{cacheMd5:s}=o;for(const e of Object.keys(s)){const r=t[e];r?"error"in r||r.md5!==s[e]||delete t[e]:t[e]={path:e,md5:"",code:""}}for(const e of Object.values(t))"error"in e&&e.error instanceof Error&&(e.error={code:e.error.code||-1,message:e.error.message,stack:e.error.stack,path:e.path});return t}async function destroy(){null==summercompileManager||summercompileManager.destroy(),summercompileManager=void 0,inited=!1,preCompiler=void 0,summerProject=void 0,precompileProject=void 0}exports.initHandler=initHandler,exports.destroy=destroy;const emiter=function(){const e={};return{on:(r,o)=>{e.hasOwnProperty(r)||(e[r]=[]),e[r].push(o)},off:(r,o)=>{var t;e[r]=(null===(t=e[r])||void 0===t?void 0:t.filter(e=>e!==o))||[]},emit:(r,...o)=>{const t=e[r];if((null==t?void 0:t.length)>0)for(const e of t)try{e(...o)}catch(e){}}}}(),onMessage=e=>{emiter.on("message",e)};async function messageHandler(e){if("event"===e.type)if("fileChange"===e.name){const{type:r,targetPath:o}=e.data;summerProject.onFileChange(r,o)}else if("updateOptions"===e.name){const r=e.data;summerProject.updateOptions(r),summercompileManager.updateOptions(r)}else if("precompileOptionsChange"===e.name){const r=e.data;precompileProject.updateConditionCompileOptions(r)}if("request"===e.type){const{id:r,name:o,data:t}=e,s=r,a=new progressRecorder_1.Recorder((e,r,o)=>{processSend({type:"progress",id:e,taskId:s,status:r,message:o})});try{let e;if("getCode"===o||"getDevCodeByFileList"===o)e=await getCodeFiles(o,a,t);else if("getPackageFiles"===o)e=await summercompileManager.getPackageFiles(t,a);else if("getConf"===o)e=await summercompileManager.getConf(t,a);else if("getLocalFileList"===o)e=await summercompileManager.getLocalFileList(t);else if("compile"===o)e=await summercompileManager.compile(t,a);else if("compileNewLogic"===o)e=await summercompileManager.compileNewLogic(t,a);else if("compileSingleCode"===o)e=await summercompileManager.compileSingleCode(t,a);else if("setLocale"===o)(0,index_2.setLocale)(t);else if("clearCache"===o)summercompileManager.clearCache();else{if("loadStatus"!==o)throw new Error("unknown command "+o);e=summercompileManager.getStatus()}processSend({type:"response",id:r,data:e})}catch(e){processSend({type:"response",id:r,data:null,error:{code:e.code||-1,message:e.message,stack:e.stack,path:e.path||""}})}}}exports.onMessage=onMessage,exports.messageHandler=messageHandler;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const tslib_1=require("tslib"),postcss_1=tslib_1.__importDefault(require("postcss")),autoprefixer_1=tslib_1.__importDefault(require("autoprefixer")),cssnano_1=tslib_1.__importDefault(require("cssnano")),tools_1=require("../../../../../utils/tools"),config_1=require("../../../../../config/config"),customError_1=require("../../../../../utils/customError");process.env.BROWSERSLIST=process.env.BROWSERSLIST||"iOS >= 8, Chrome >= 37";const MAX_LINE_SHOW_LENGTH=45;function shortString(r,e,t=-1){const s=r.length;if(s<=e)return{result:r,marker:t};const o=Math.floor(e/2);return-1===t||t<=o?{result:r.substr(0,e-3)+"...",marker:t}:t+o>=s?{result:"..."+r.substr(s-e+3,e-3),marker:Math.min(e,e-(s-t))}:{result:`...${r.substr(t-o+3,e-6)}...`,marker:o}}function formatPostcssError(r,e){try{const t=e.line-1,s=e.column-1,o=r.replace(/\r\n/g,"\n").split("\n"),n=[],i=Math.max(0,t-1),u=Math.min(t+2,o.length);for(let r=i;r<u;r++){const e=shortString(o[r],45,s);r===t?n.push(`> ${r+1} | ${e.result.substr(0,e.marker)}${e.result.substr(e.marker)}`):n.push(`> ${r+1} | ${e.result}`)}return`${e.message}\n${n.join("\n")}`}catch(r){}return e.message}function default_1(r,e){const{autoPrefix:t=!0,minify:s=!0}=e||{},o=["iOS >= 8","Chrome >= 37"];return{name:"summer-wxss",workerMethods:{async doOptimize(r,e){try{const n=[];t&&n.push((0,autoprefixer_1.default)({overrideBrowserslist:o,remove:!1})),s&&n.push((0,cssnano_1.default)({preset:["default",{reduceTransforms:!1,calc:!1,minifySelectors:!1,normalizeUrl:!1}]}));return{error:null,content:(await(0,postcss_1.default)(n).process(e,{from:(0,tools_1.leading)(r,"/")})).css.replace(/\r\n/g,"\n")}}catch(t){return{error:(0,customError_1.makeCustomError)(formatPostcssError(e,t),config_1.POST_WXSS_ERR,r)}}}},async optimize(r,e){if("dev"===e.resultType||!r.targetPath.endsWith(".wxss")||!t&&!s)return r;const o=Date.now(),n=await this.runWorkerMethod("doOptimize",r.targetPath,r.target.code);if(n.error)throw n.error;return Object.assign(Object.assign({},r),{target:Object.assign(Object.assign({},r.target),{code:n.content}),process:[...r.process,{cost:Date.now()-o,pluginName:"summer-wxss",action:"optimize"}]})}}}exports.default=default_1;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const tslib_1=require("tslib"),postcss_1=tslib_1.__importDefault(require("postcss")),autoprefixer_1=tslib_1.__importDefault(require("autoprefixer")),cssnano_1=tslib_1.__importDefault(require("cssnano")),tools_1=require("../../../../../utils/tools"),config_1=require("../../../../../config/config"),customError_1=require("../../../../../utils/customError");"undefined"!=typeof process&&process.env&&(process.env.BROWSERSLIST=process.env.BROWSERSLIST||"iOS >= 8, Chrome >= 37");const MAX_LINE_SHOW_LENGTH=45;function shortString(r,e,t=-1){const s=r.length;if(s<=e)return{result:r,marker:t};const o=Math.floor(e/2);return-1===t||t<=o?{result:r.substr(0,e-3)+"...",marker:t}:t+o>=s?{result:"..."+r.substr(s-e+3,e-3),marker:Math.min(e,e-(s-t))}:{result:`...${r.substr(t-o+3,e-6)}...`,marker:o}}function formatPostcssError(r,e){try{const t=e.line-1,s=e.column-1,o=r.replace(/\r\n/g,"\n").split("\n"),n=[],i=Math.max(0,t-1),u=Math.min(t+2,o.length);for(let r=i;r<u;r++){const e=shortString(o[r],45,s);r===t?n.push(`> ${r+1} | ${e.result.substr(0,e.marker)}${e.result.substr(e.marker)}`):n.push(`> ${r+1} | ${e.result}`)}return`${e.message}\n${n.join("\n")}`}catch(r){}return e.message}function default_1(r,e){const{autoPrefix:t=!0,minify:s=!0}=e||{},o=["iOS >= 8","Chrome >= 37"];return{name:"summer-wxss",workerMethods:{async doOptimize(r,e){try{const n=[];t&&n.push((0,autoprefixer_1.default)({overrideBrowserslist:o,remove:!1})),s&&n.push((0,cssnano_1.default)({preset:["default",{reduceTransforms:!1,calc:!1,minifySelectors:!1,normalizeUrl:!1}]}));return{error:null,content:(await(0,postcss_1.default)(n).process(e,{from:(0,tools_1.leading)(r,"/")})).css.replace(/\r\n/g,"\n")}}catch(t){return{error:(0,customError_1.makeCustomError)(formatPostcssError(e,t),config_1.POST_WXSS_ERR,r)}}}},async optimize(r,e){if("dev"===e.resultType||!r.targetPath.endsWith(".wxss")||!t&&!s)return r;const o=Date.now(),n=await this.runWorkerMethod("doOptimize",r.targetPath,r.target.code);if(n.error)throw n.error;return Object.assign(Object.assign({},r),{target:Object.assign(Object.assign({},r.target),{code:n.content}),process:[...r.process,{cost:Date.now()-o,pluginName:"summer-wxss",action:"optimize"}]})}}}exports.default=default_1;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const typescript=()=>require("./typescript"),sass=()=>require("./sass"),less=()=>require("./less"),enhance=()=>require("./enhance"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const typescript=()=>require("./typescript"),sass=()=>require("./sass"),less=()=>require("./less"),enhance=()=>require("./enhance"),terser=()=>require("./terser"),javascript=()=>require("./base/javascript"),wxss=()=>require("./base/wxss"),es6module=()=>require("./base/es6module"),minifywxml=()=>require("./minifywxml"),worklet=()=>require("./worklet"),swc=()=>require("./base/swc"),plugins={typescript:typescript,javascript:javascript,es6module:es6module,less:less,sass:sass,wxss:wxss,enhance:enhance,terser:terser,minifywxml:minifywxml,worklet:worklet,swc:swc};exports.default={load:e=>e in plugins?plugins[e]().default:null};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.importWxssCssReg=exports.importWxssReg=void 0;const tslib_1=require("tslib"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.importWxssCssReg=exports.importWxssReg=void 0;const tslib_1=require("tslib"),tools_1=require("../../../../utils/tools"),customError_1=require("../../../../utils/customError"),path_1=tslib_1.__importDefault(require("path")),less=()=>require("less");function default_1(s,e){return{name:"summer-less",resolveExt:{wxss:"less"},async load(t,r){var o;if(r.endsWith(".less")){const a=Date.now(),i=(0,tools_1.pathRelative)(s.projectPath,r);let l=s.getFile("",i).toString();if(i!==s.getTargetPath(s.miniprogramRoot,"app")+".less"&&s.exists(s.miniprogramRoot,"app.less")){const e=(0,tools_1.pathRelative)(s.miniprogramRoot,path_1.default.dirname(i))||".";l=`@import (optional, reference) '${"."===e?".":(0,tools_1.pathRelative)(e,"./")}/app.less';\n${l}`}const p=[];l=l.replace(exports.importWxssReg,(s,e,t)=>(p.push(t),s.replace(t,t+"?css")));try{const i=await require("less").render(l,{sourceMap:{outputSourceFiles:!0},paths:this.rootPath?[this.rootPath]:[],filename:r,globalVars:null!==(o=null==e?void 0:e.globalVars)&&void 0!==o?o:{}}),u=i.css.replace(exports.importWxssCssReg,(s,e,t)=>{const r=t.slice(0,-4);return p.includes(r)?s.replace(t,r):s});if(i.imports.length)for(const s of i.imports)this.addWatchFile(s);let c=void 0;return i.map&&(c=JSON.parse(i.map),c.sources=c.sources.map(e=>path_1.default.posix.relative(s.projectPath,e))),{targetPath:t,source:{sourceCode:u,inputMap:c},process:[{cost:Date.now()-a,pluginName:"summer-less",action:"load"}]}}catch(s){throw(0,customError_1.makeCustomError)(s,customError_1.CustomErrors.SUMMER_PLUGIN_CODE_ERR)}}}}}exports.importWxssReg=/(?:^|\s)?(?:@import)(?:\s*)?(["'])([^"']+.wxss)\1(?:\s*);/g,exports.importWxssCssReg=/(?:^|\s)?(?:@import)(?:\s*)?(["'])([^"']+.wxss\?css)\1(?:\s*);/g,exports.default=default_1;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.random=void 0;const tslib_1=require("tslib"),path_1=tslib_1.__importDefault(require("path")),tools_1=require("../../../../utils/tools"),customError_1=require("../../../../utils/customError"),debug_1=require("../../../../utils/debug"),sass=(0,debug_1.shouldRunInMainProcess)()?()=>{process.versions.electron="0.54.0";const s=require("sass");return delete process.versions.electron,s}:()=>require("sass");function random(){return(0,tools_1.generateMD5)(`${Math.random()}${Date.now()}`)}exports.random=random;const importWxssReg=/(?:^|\s)?(?:@import)(?:\s*)?(["'])([^"']+.wxss)\1(?:\s*);/g,importCssReg=/(?:^|\s)?(?:@import)(?:\s*)?(["'])([^"']+.css)\1(?:\s*);/g;function default_1(s){return{name:"summer-sass",resolveExt:{wxss:["sass","scss"]},async load(t
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.random=void 0;const tslib_1=require("tslib"),path_1=tslib_1.__importDefault(require("path")),tools_1=require("../../../../utils/tools"),customError_1=require("../../../../utils/customError"),debug_1=require("../../../../utils/debug"),sass=(0,debug_1.shouldRunInMainProcess)()?()=>{process.versions.electron="0.54.0";const s=require("sass");return delete process.versions.electron,s}:()=>require("sass");function random(){return(0,tools_1.generateMD5)(`${Math.random()}${Date.now()}`)}exports.random=random;const importWxssReg=/(?:^|\s)?(?:@import)(?:\s*)?(["'])([^"']+.wxss)\1(?:\s*);/g,importCssReg=/(?:^|\s)?(?:@import)(?:\s*)?(["'])([^"']+.css)\1(?:\s*);/g;async function sassRender(s,e){"undefined"!=typeof WEBIDE_WEBPECK_DEFINE_PLUGIN||sass().render(s,e)}function default_1(s){return{name:"summer-sass",resolveExt:{wxss:["sass","scss"]},async load(e,t){if(t.endsWith(".scss")||t.endsWith(".sass")){const o=(0,tools_1.pathRelative)(s.projectPath,t);let r=s.getFile("",o).toString();const a=s.getTargetPath(s.miniprogramRoot,"global");if(o!==a+".scss"&&o!==a+".sass"){let e=path_1.default.extname(o);const t=(0,tools_1.pathRelative)(s.miniprogramRoot,path_1.default.dirname(o))||".";s.exists(s.miniprogramRoot,"global"+e)||(e=".sass"===e?".scss":".sass"),s.exists(s.miniprogramRoot,"global"+e)&&(r=".sass"===e?`@use '${"."===t?".":(0,tools_1.pathRelative)(t,"./")}/global${e}'\n${r}`:`@use '${"."===t?".":(0,tools_1.pathRelative)(t,"./")}/global${e}';\n${r}`)}const i=[];r=r.replace(importWxssReg,(s,e,t)=>(i.push(t),s.replace(t,t.slice(0,-4)+"css")));const n=path_1.default.posix.dirname((0,tools_1.pathRelative)(s.projectPath,t));return new Promise((s,o)=>{const a=Date.now();sassRender({file:t,data:r,sourceMap:!0,sourceMapContents:!0,omitSourceMapUrl:!0,outFile:t.slice(0,-5)+".wxss",includePaths:this.rootPath?[this.rootPath]:[]},(r,l)=>{if(r){const s=(0,customError_1.makeCustomError)(r,customError_1.CustomErrors.SUMMER_PLUGIN_CODE_ERR);return void o(s)}if(!l)return void o(new Error("no result"));const u=l.css.toString("utf-8").replace(importCssReg,(s,e,t)=>{const o=t.slice(0,-3)+"wxss";return i.includes(o)?s.replace(t,o):s});if(l.stats.includedFiles.length>0)for(const s of l.stats.includedFiles)s!==t&&this.addWatchFile(s);const c=l.map?JSON.parse(l.map.toString("utf-8")):void 0;c&&(c.sourceRoot=n),s({targetPath:e,source:{sourceCode:u,inputMap:c},process:[{cost:Date.now()-a,pluginName:"summer-sass",action:"load"}]})})})}}}}exports.default=default_1;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const tslib_1=require("tslib"),path_1=tslib_1.__importDefault(require("path")),customError_1=require("../../../../utils/customError"),config_1=require("../../../../config/config"),pluginconfig_1=require("../pluginconfig"),babel7=()=>require("@babel/core"),pluginTransformTypescript=()=>require("@babel/plugin-transform-typescript"),pluginReplaceTsExportAssignment=e=>{const t=e.template("\n module.exports = ASSIGNMENT;\n ");return{name:"replace-ts-export-assignment",visitor:{TSExportAssignment(e){e.replaceWith(t({ASSIGNMENT:e.node.expression}))}}}},pluginReplaceTsImportEqualsDeclaration=e=>{const t=e.template("\n const ID = require(SOURCE);\n ");return{name:"replace-ts-import-equals-declaration",visitor:{TSImportEqualsDeclaration(e){e.replaceWith(t({ID:e.node.id,SOURCE:e.node.moduleReference.expression}))}}}};function default_1(e){return{name:"summer-typescript",resolveExt:{js:"ts"},workerMethods:{doLoad(e,t,r){let o;try{o=require("@babel/core").transform(e,{babelrc:!1,plugins:[[pluginReplaceTsImportEqualsDeclaration,{}],[pluginReplaceTsExportAssignment,{}],[require("@babel/plugin-transform-typescript"),{}]],sourceFileName:t,sourceMaps:!1,ast:!0,configFile:!1,code:!1})}catch(e){throw(0,customError_1.makeCustomError)(e,customError_1.CustomErrors.SUMMER_PLUGIN_CODE_ERR,t)}return{sourceCode:e,inputMap:r,astInfo:{ast:o.ast,type:config_1.AstType.Babel}}}},async load(t,r){if(!(0,pluginconfig_1.couldUseSWCMode)(e.setting)&&r.endsWith(".ts")){const o=Date.now(),s=path_1.default.relative(e.projectPath,r),i=e.getFile("",s).toString(),n=e.stat("",s),a=await this.runWorkerMethod("doLoad",i,r);return{targetPath:t,source:Object.assign(Object.assign({},a),{mtime:null==n?void 0:n.mtimeMs}),process:[{cost:Date.now()-o,pluginName:"summer-typescript",action:"load"}]}}}}}exports.default=default_1;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const tslib_1=require("tslib"),path_1=tslib_1.__importDefault(require("path")),customError_1=require("../../../../utils/customError"),config_1=require("../../../../config/config"),pluginconfig_1=require("../pluginconfig"),babel7=()=>require("@babel/core"),pluginTransformTypescript=()=>require("@babel/plugin-transform-typescript"),pluginReplaceTsExportAssignment=e=>{const t=e.template("\n module.exports = ASSIGNMENT;\n ");return{name:"replace-ts-export-assignment",visitor:{TSExportAssignment(e){e.replaceWith(t({ASSIGNMENT:e.node.expression}))}}}},pluginReplaceTsImportEqualsDeclaration=e=>{const t=e.template("\n const ID = require(SOURCE);\n ");return{name:"replace-ts-import-equals-declaration",visitor:{TSImportEqualsDeclaration(e){e.replaceWith(t({ID:e.node.id,SOURCE:e.node.moduleReference.expression}))}}}};function default_1(e){return{name:"summer-typescript",resolveExt:{js:"ts"},workerMethods:{doLoad(e,t,r){let o;console.log("[backend] summer-typescript workerMethod");try{o=require("@babel/core").transform(e,{babelrc:!1,plugins:[[pluginReplaceTsImportEqualsDeclaration,{}],[pluginReplaceTsExportAssignment,{}],[require("@babel/plugin-transform-typescript"),{}]],sourceFileName:t,sourceMaps:!1,ast:!0,configFile:!1,code:!1})}catch(e){throw(0,customError_1.makeCustomError)(e,customError_1.CustomErrors.SUMMER_PLUGIN_CODE_ERR,t)}return{sourceCode:e,inputMap:r,astInfo:{ast:o.ast,type:config_1.AstType.Babel}}}},async load(t,r){if(!(0,pluginconfig_1.couldUseSWCMode)(e.setting)&&r.endsWith(".ts")){const o=Date.now(),s=path_1.default.relative(e.projectPath,r),i=e.getFile("",s).toString(),n=e.stat("",s),a=await this.runWorkerMethod("doLoad",i,r);return{targetPath:t,source:Object.assign(Object.assign({},a),{mtime:null==n?void 0:n.mtimeMs}),process:[{cost:Date.now()-o,pluginName:"summer-typescript",action:"load"}]}}}}}exports.default=default_1;
|