lupine.api 1.1.58 → 1.1.60

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.
Files changed (137) hide show
  1. package/README.md +3 -3
  2. package/admin/admin-about.tsx +12 -16
  3. package/admin/admin-config.tsx +47 -44
  4. package/admin/admin-css.tsx +3 -3
  5. package/admin/admin-db.tsx +75 -75
  6. package/admin/admin-frame-helper.tsx +364 -364
  7. package/admin/admin-frame.tsx +164 -164
  8. package/admin/admin-index.tsx +65 -65
  9. package/admin/admin-login.tsx +111 -111
  10. package/admin/admin-menu-edit.tsx +637 -637
  11. package/admin/admin-menu-list.tsx +87 -87
  12. package/admin/admin-page-edit.tsx +564 -564
  13. package/admin/admin-page-list.tsx +83 -83
  14. package/admin/admin-performance.tsx +28 -28
  15. package/admin/admin-release.tsx +427 -426
  16. package/admin/admin-resources.tsx +382 -382
  17. package/admin/admin-shell.tsx +89 -89
  18. package/admin/admin-table-data.tsx +146 -146
  19. package/admin/admin-table-list.tsx +230 -230
  20. package/admin/admin-test-animations.tsx +395 -395
  21. package/admin/admin-test-component.tsx +823 -808
  22. package/admin/admin-test-edit.tsx +319 -319
  23. package/admin/admin-test-themes.tsx +56 -56
  24. package/admin/admin-tokens.tsx +338 -338
  25. package/admin/design/admin-design.tsx +174 -174
  26. package/admin/design/block-grid.tsx +36 -36
  27. package/admin/design/block-grid1.tsx +21 -21
  28. package/admin/design/block-paragraph.tsx +19 -19
  29. package/admin/design/block-title.tsx +19 -19
  30. package/admin/design/design-block-box.tsx +140 -140
  31. package/admin/design/drag-data.tsx +24 -24
  32. package/admin/index.ts +9 -9
  33. package/admin/package.json +15 -15
  34. package/admin/tsconfig.json +127 -127
  35. package/dev/copy-folder.js +32 -32
  36. package/dev/cp-index-html.js +69 -69
  37. package/dev/file-utils.js +12 -12
  38. package/dev/index.js +18 -19
  39. package/dev/package.json +12 -12
  40. package/dev/plugin-ifelse.js +168 -168
  41. package/dev/plugin-ifelse.test.js +37 -37
  42. package/dev/run-cmd.js +14 -14
  43. package/dev/send-request.js +12 -12
  44. package/package.json +55 -55
  45. package/src/admin-api/admin-api-helper.ts +210 -205
  46. package/src/admin-api/admin-api.ts +65 -65
  47. package/src/admin-api/admin-auth.ts +152 -146
  48. package/src/admin-api/admin-config.ts +94 -84
  49. package/src/admin-api/admin-csv.ts +94 -94
  50. package/src/admin-api/admin-db.ts +269 -269
  51. package/src/admin-api/admin-menu.ts +135 -135
  52. package/src/admin-api/admin-page.ts +135 -135
  53. package/src/admin-api/admin-performance.ts +128 -128
  54. package/src/admin-api/admin-release.ts +706 -700
  55. package/src/admin-api/admin-resources.ts +318 -318
  56. package/src/admin-api/admin-token-helper.ts +82 -79
  57. package/src/admin-api/admin-tokens.ts +90 -90
  58. package/src/admin-api/index.ts +2 -2
  59. package/src/admin-api/web-config-api.ts +19 -19
  60. package/src/api/api-cache.ts +103 -103
  61. package/src/api/api-helper.ts +44 -44
  62. package/src/api/api-module.ts +67 -60
  63. package/src/api/api-router.ts +177 -177
  64. package/src/api/api-shared-storage.ts +64 -64
  65. package/src/api/async-storage.ts +5 -5
  66. package/src/api/debug-service.ts +56 -56
  67. package/src/api/encode-html.ts +27 -27
  68. package/src/api/handle-status.ts +75 -75
  69. package/src/api/index.ts +15 -16
  70. package/src/api/mini-web-socket.ts +270 -270
  71. package/src/api/server-content-type.ts +82 -82
  72. package/src/api/server-render.ts +235 -215
  73. package/src/api/shell-service.ts +74 -74
  74. package/src/api/simple-storage.ts +80 -80
  75. package/src/api/static-server.ts +128 -125
  76. package/src/api/to-client-delivery.ts +26 -26
  77. package/src/app/app-cache.ts +55 -55
  78. package/src/app/app-helper.ts +62 -62
  79. package/src/app/app-message.ts +109 -109
  80. package/src/app/app-shared-storage.ts +363 -363
  81. package/src/app/app-start.ts +136 -136
  82. package/src/app/cleanup-exit.ts +16 -16
  83. package/src/app/host-to-path.ts +38 -38
  84. package/src/app/index.ts +11 -11
  85. package/src/app/process-dev-requests.ts +130 -130
  86. package/src/app/web-listener.ts +294 -294
  87. package/src/app/web-processor.ts +47 -42
  88. package/src/app/web-server.ts +100 -100
  89. package/src/common-js/web-env.js +104 -104
  90. package/src/index.ts +7 -7
  91. package/src/lang/api-lang-en.ts +26 -26
  92. package/src/lang/api-lang-zh-cn.ts +27 -27
  93. package/src/lang/index.ts +2 -2
  94. package/src/lang/lang-helper.ts +76 -76
  95. package/src/lang/lang-props.ts +6 -6
  96. package/src/lib/db/db-helper.ts +23 -23
  97. package/src/lib/db/db-mysql.ts +249 -250
  98. package/src/lib/db/db-sqlite.ts +101 -101
  99. package/src/lib/db/db.spec.ts +28 -28
  100. package/src/lib/db/db.ts +325 -325
  101. package/src/lib/db/index.ts +5 -5
  102. package/src/lib/index.ts +3 -3
  103. package/src/lib/logger.spec.ts +214 -214
  104. package/src/lib/logger.ts +281 -281
  105. package/src/lib/runtime-require.ts +37 -37
  106. package/src/lib/utils/cookie-util.ts +34 -34
  107. package/src/lib/utils/crypto.ts +58 -58
  108. package/src/lib/utils/date-utils.ts +317 -317
  109. package/src/lib/utils/deep-merge.ts +37 -37
  110. package/src/lib/utils/delay.ts +12 -12
  111. package/src/lib/utils/file-setting.ts +55 -55
  112. package/src/lib/utils/format-bytes.ts +11 -11
  113. package/src/lib/utils/fs-utils.ts +158 -158
  114. package/src/lib/utils/get-env.ts +27 -27
  115. package/src/lib/utils/index.ts +12 -12
  116. package/src/lib/utils/is-type.ts +48 -48
  117. package/src/lib/utils/load-env.ts +14 -14
  118. package/src/lib/utils/pad.ts +6 -6
  119. package/src/models/api-base.ts +5 -5
  120. package/src/models/api-module-props.ts +10 -11
  121. package/src/models/api-router-props.ts +26 -26
  122. package/src/models/app-cache-props.ts +33 -33
  123. package/src/models/app-data-props.ts +10 -10
  124. package/src/models/app-helper-props.ts +6 -6
  125. package/src/models/app-shared-storage-props.ts +38 -38
  126. package/src/models/app-start-props.ts +18 -18
  127. package/src/models/async-storage-props.ts +13 -13
  128. package/src/models/db-config.ts +30 -30
  129. package/src/models/host-to-path-props.ts +12 -12
  130. package/src/models/index.ts +16 -16
  131. package/src/models/json-object.ts +8 -8
  132. package/src/models/locals-props.ts +36 -36
  133. package/src/models/logger-props.ts +84 -84
  134. package/src/models/simple-storage-props.ts +13 -14
  135. package/src/models/to-client-delivery-props.ts +6 -6
  136. package/tsconfig.json +115 -115
  137. package/dev/plugin-gen-versions.js +0 -20
@@ -1,127 +1,127 @@
1
- {
2
- // "compileOnSave": false,
3
- "compilerOptions": {
4
- /* Visit https://aka.ms/tsconfig to read more about this file */
5
-
6
- /* Projects */
7
- // "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */
8
- "composite": true /* Enable constraints that allow a TypeScript project to be used with project references. */,
9
- // "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */
10
- // "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */
11
- // "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
12
- // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
13
-
14
- /* Language and Environment */
15
- "target": "es2017" /* es2016, es6 Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */,
16
- "lib": [
17
- "es2016",
18
- "es6",
19
- "dom"
20
- ] /* Specify a set of bundled library declaration files that describe the target runtime environment. */,
21
- "jsx": "react-jsx" /* Specify what JSX code is generated. */,
22
- "experimentalDecorators": true /* Enable experimental support for TC39 stage 2 draft decorators. */,
23
- "emitDecoratorMetadata": true /* Emit design-type metadata for decorated declarations in source files. */,
24
- // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */
25
- // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */
26
- "jsxImportSource": "lupine.web" /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */,
27
- // "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */
28
- // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
29
- // "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
30
- // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */
31
-
32
- /* Modules */
33
- // "module": "commonjs", amd, es2015 /* Specify what module code is generated. */,
34
- "module": "amd" /* Specify what module code is generated. */,
35
- // "rootDir": "./" /* Specify the root folder within your source files. */,
36
- "moduleResolution": "node" /* Specify how TypeScript looks up a file from a given module specifier. */,
37
- // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
38
- // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
39
- // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
40
- // "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */
41
- // "types": [], /* Specify type package names to be included without being referenced in a source file. */
42
- "types": ["node", "lupine.web"],
43
- // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
44
- // "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */
45
- // "resolveJsonModule": true /* Enable importing .json files. */,
46
- // "noResolve": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */
47
-
48
- /* JavaScript Support */
49
- "allowJs": true /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */,
50
- // "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */
51
- // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */
52
-
53
- /* Emit */
54
- "declaration": true /* Generate .d.ts files from TypeScript and JavaScript files in your project. */,
55
- // "declarationMap": true, /* Create sourcemaps for d.ts files. */
56
- // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
57
- "sourceMap": true /* Create source map files for emitted JavaScript files. */,
58
- // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
59
- "outFile": "../dist/build.js",
60
- "outDir": "../dist" /* Specify an output folder for all emitted files. */,
61
- // "removeComments": true, /* Disable emitting comments. */
62
- // "noEmit": true, /* Disable emitting files from a compilation. */
63
- // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
64
- // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */
65
- "downlevelIteration": true /* Emit more compliant, but verbose and less performant JavaScript for iteration. */,
66
- // "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */
67
- // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
68
- // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
69
- // "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */
70
- // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */
71
- // "newLine": "crlf", /* Set the newline character for emitting files. */
72
- // "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */
73
- // "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */
74
- // "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */
75
- // "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */
76
- // "declarationDir": "./", /* Specify the output directory for generated declaration files. */
77
- // "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */
78
-
79
- /* Interop Constraints */
80
- // "isolatedModules": true /* Ensure that each file can be safely transpiled without relying on other imports. */,
81
- // "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
82
- "esModuleInterop": true /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */,
83
- // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
84
- "forceConsistentCasingInFileNames": true /* Ensure that casing is correct in imports. */,
85
-
86
- /* Type Checking */
87
- "strict": true /* Enable all strict type-checking options. */,
88
- // "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */
89
- // "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */
90
- // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
91
- // "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */
92
- // "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
93
- // "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */
94
- // "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */
95
- // "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
96
- // "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */
97
- // "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */
98
- // "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
99
- // "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
100
- // "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
101
- // "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */
102
- // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
103
- // "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */
104
- // "allowUnusedLabels": true, /* Disable error reporting for unused labels. */
105
- // "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */
106
-
107
- /* Completeness */
108
- // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
109
- "skipLibCheck": true /* Skip type checking all .d.ts files. */
110
- },
111
- // "paths": {
112
- // "lupine.web": ["../../lupine.web/src"]
113
- // },
114
- // "exports": {
115
- // "./src/routes/index.ts": "r-index.ts",
116
- // "./src/routes/route2.ts": "r-route2.ts",
117
- // },
118
- "include": [
119
- "**/*.ts",
120
- "**/*.tsx"
121
- // "../../lupine.web/src/**/*.ts",
122
- // "../../lupine.web/src/**/*.tsx",
123
- // "../../lupine.web/jsx-runtime/src/**/*.ts",
124
- // "../../lupine.web/jsx-runtime/src/**/*.tsx",
125
- ]
126
- // "exclude": ["node_modules"]
127
- }
1
+ {
2
+ // "compileOnSave": false,
3
+ "compilerOptions": {
4
+ /* Visit https://aka.ms/tsconfig to read more about this file */
5
+
6
+ /* Projects */
7
+ // "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */
8
+ "composite": true /* Enable constraints that allow a TypeScript project to be used with project references. */,
9
+ // "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */
10
+ // "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */
11
+ // "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
12
+ // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
13
+
14
+ /* Language and Environment */
15
+ "target": "es2017" /* es2016, es6 Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */,
16
+ "lib": [
17
+ "es2016",
18
+ "es6",
19
+ "dom"
20
+ ] /* Specify a set of bundled library declaration files that describe the target runtime environment. */,
21
+ "jsx": "react-jsx" /* Specify what JSX code is generated. */,
22
+ "experimentalDecorators": true /* Enable experimental support for TC39 stage 2 draft decorators. */,
23
+ "emitDecoratorMetadata": true /* Emit design-type metadata for decorated declarations in source files. */,
24
+ // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */
25
+ // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */
26
+ "jsxImportSource": "lupine.web" /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */,
27
+ // "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */
28
+ // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
29
+ // "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
30
+ // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */
31
+
32
+ /* Modules */
33
+ // "module": "commonjs", amd, es2015 /* Specify what module code is generated. */,
34
+ "module": "amd" /* Specify what module code is generated. */,
35
+ // "rootDir": "./" /* Specify the root folder within your source files. */,
36
+ "moduleResolution": "node" /* Specify how TypeScript looks up a file from a given module specifier. */,
37
+ // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
38
+ // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
39
+ // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
40
+ // "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */
41
+ // "types": [], /* Specify type package names to be included without being referenced in a source file. */
42
+ "types": ["node", "lupine.web"],
43
+ // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
44
+ // "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */
45
+ // "resolveJsonModule": true /* Enable importing .json files. */,
46
+ // "noResolve": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */
47
+
48
+ /* JavaScript Support */
49
+ "allowJs": true /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */,
50
+ // "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */
51
+ // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */
52
+
53
+ /* Emit */
54
+ "declaration": true /* Generate .d.ts files from TypeScript and JavaScript files in your project. */,
55
+ // "declarationMap": true, /* Create sourcemaps for d.ts files. */
56
+ // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
57
+ "sourceMap": true /* Create source map files for emitted JavaScript files. */,
58
+ // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
59
+ "outFile": "../dist/build.js",
60
+ "outDir": "../dist" /* Specify an output folder for all emitted files. */,
61
+ // "removeComments": true, /* Disable emitting comments. */
62
+ // "noEmit": true, /* Disable emitting files from a compilation. */
63
+ // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
64
+ // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */
65
+ "downlevelIteration": true /* Emit more compliant, but verbose and less performant JavaScript for iteration. */,
66
+ // "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */
67
+ // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
68
+ // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
69
+ // "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */
70
+ // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */
71
+ // "newLine": "crlf", /* Set the newline character for emitting files. */
72
+ // "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */
73
+ // "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */
74
+ // "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */
75
+ // "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */
76
+ // "declarationDir": "./", /* Specify the output directory for generated declaration files. */
77
+ // "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */
78
+
79
+ /* Interop Constraints */
80
+ // "isolatedModules": true /* Ensure that each file can be safely transpiled without relying on other imports. */,
81
+ // "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
82
+ "esModuleInterop": true /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */,
83
+ // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
84
+ "forceConsistentCasingInFileNames": true /* Ensure that casing is correct in imports. */,
85
+
86
+ /* Type Checking */
87
+ "strict": true /* Enable all strict type-checking options. */,
88
+ // "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */
89
+ // "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */
90
+ // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
91
+ // "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */
92
+ // "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
93
+ // "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */
94
+ // "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */
95
+ // "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
96
+ // "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */
97
+ // "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */
98
+ // "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
99
+ // "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
100
+ // "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
101
+ // "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */
102
+ // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
103
+ // "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */
104
+ // "allowUnusedLabels": true, /* Disable error reporting for unused labels. */
105
+ // "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */
106
+
107
+ /* Completeness */
108
+ // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
109
+ "skipLibCheck": true /* Skip type checking all .d.ts files. */
110
+ },
111
+ // "paths": {
112
+ // "lupine.web": ["../../lupine.web/src"]
113
+ // },
114
+ // "exports": {
115
+ // "./src/routes/index.ts": "r-index.ts",
116
+ // "./src/routes/route2.ts": "r-route2.ts",
117
+ // },
118
+ "include": [
119
+ "**/*.ts",
120
+ "**/*.tsx"
121
+ // "../../lupine.web/src/**/*.ts",
122
+ // "../../lupine.web/src/**/*.tsx",
123
+ // "../../lupine.web/jsx-runtime/src/**/*.ts",
124
+ // "../../lupine.web/jsx-runtime/src/**/*.tsx",
125
+ ]
126
+ // "exclude": ["node_modules"]
127
+ }
@@ -1,32 +1,32 @@
1
- const fs = require('fs/promises');
2
- const path = require('path');
3
- const esbuild = require('esbuild');
4
-
5
- exports.copyFolder = async (copyCache, src, dest, isDev) => {
6
- const stat = await fs.stat(src);
7
- if (stat.isDirectory()) {
8
- await fs.mkdir(dest, { recursive: true });
9
- (await fs.readdir(src)).forEach(async (childItemName) => {
10
- await exports.copyFolder(copyCache, path.join(src, childItemName), path.join(dest, childItemName));
11
- });
12
- } else if (stat.isFile()) {
13
- const statDest = copyCache.get(src);
14
- if (!statDest || stat.size !== statDest.size || stat.mtime.getTime() !== statDest.mtime.getTime()) {
15
- try {
16
- if (isDev && src.endsWith('.css')) {
17
- const css = await fs.readFile(src, 'utf-8');
18
- const newCss = (await esbuild.transform(css, { loader: 'css', minify: true })).code;
19
- await fs.writeFile(dest, newCss, 'utf-8');
20
- } else {
21
- await fs.copyFile(src, dest);
22
- }
23
- copyCache.set(src, stat);
24
- // utimes is not accurate
25
- // await fs.utimes(dest, stat.atime, stat.mtime);
26
- console.log(`copy from [${src}] to [${dest}]`);
27
- } catch (err) {
28
- console.log(`error when copy from ${src} to ${dest}`, err);
29
- }
30
- }
31
- }
32
- };
1
+ const fs = require('fs/promises');
2
+ const path = require('path');
3
+ const esbuild = require('esbuild');
4
+
5
+ exports.copyFolder = async (copyCache, src, dest, isDev) => {
6
+ const stat = await fs.stat(src);
7
+ if (stat.isDirectory()) {
8
+ await fs.mkdir(dest, { recursive: true });
9
+ (await fs.readdir(src)).forEach(async (childItemName) => {
10
+ await exports.copyFolder(copyCache, path.join(src, childItemName), path.join(dest, childItemName));
11
+ });
12
+ } else if (stat.isFile()) {
13
+ const statDest = copyCache.get(src);
14
+ if (!statDest || stat.size !== statDest.size || stat.mtime.getTime() !== statDest.mtime.getTime()) {
15
+ try {
16
+ if (isDev && src.endsWith('.css')) {
17
+ const css = await fs.readFile(src, 'utf-8');
18
+ const newCss = (await esbuild.transform(css, { loader: 'css', minify: true })).code;
19
+ await fs.writeFile(dest, newCss, 'utf-8');
20
+ } else {
21
+ await fs.copyFile(src, dest);
22
+ }
23
+ copyCache.set(src, stat);
24
+ // utimes is not accurate
25
+ // await fs.utimes(dest, stat.atime, stat.mtime);
26
+ console.log(`copy from [${src}] to [${dest}]`);
27
+ } catch (err) {
28
+ console.log(`error when copy from ${src} to ${dest}`, err);
29
+ }
30
+ }
31
+ }
32
+ };
@@ -1,69 +1,69 @@
1
- const path = require('path');
2
- const fs = require('fs/promises');
3
- const webEnv = require('../src/common-js/web-env.js');
4
- const fileUtils = require('./file-utils.js');
5
-
6
- const fileSizeAndTime = async (filename) => {
7
- try {
8
- var stats = await fs.stat(filename);
9
- return { size: stats.size, mtime: stats.mtime };
10
- } catch (e) {
11
- return false;
12
- }
13
- };
14
- const fileUpdateTime = async (filename, time) => {
15
- fs.utimes(filename, time, time);
16
- };
17
-
18
- const readWebConfig = async (outdirData) => {
19
- let tempPath = path.join(outdirData, 'config.json');
20
- if (!(await fileUtils.pathExists(tempPath))) {
21
- tempPath = path.join(outdirData, 'resources', 'config_default.json');
22
- }
23
-
24
- // file should exist
25
- const data = await fs.readFile(tempPath, 'utf-8');
26
- const json = JSON.parse(data || {});
27
- return webEnv.getWebConfig(json);
28
- };
29
-
30
- const metaTextStart = '<!--META-ENV-START-->';
31
- const metaTextEnd = '<!--META-ENV-END-->';
32
- exports.cpIndexHtml = async (htmlFile, outputFile, appName, isMobile, defaultThemeName, outdirData) => {
33
- const f1 = await fileSizeAndTime(htmlFile);
34
- const f2 = await fileSizeAndTime(outputFile);
35
-
36
- // once isMobile is changed, then index.html file needs to be rebuilt
37
- // if isMobile=true, then the last number is 1, or if isMobile=false, the last is 2
38
- const chgTime = Math.trunc(f1.mtime.getTime() / 10) * 10 + (isMobile ? 1 : 2);
39
-
40
- // when it's isMobile, need to update env and configs => no configs as mobile app fetches it from api
41
- if (!f2 || f2.mtime.getTime() !== chgTime || isMobile) {
42
- const inHtml = await fs.readFile(htmlFile, 'utf-8');
43
- let outStr = inHtml.replace(/{hash}/gi, new Date().getTime().toString(36));
44
- if (isMobile) {
45
- // const outStr = inHtml.replace(/{hash}/gi, new Date().getTime().toString(36)).replace('\<\!--META-ENV--\>', JSON.stringify(envWeb));
46
- // env is replaced here for the mobile app. And the env is replaced again for the web app at each startup
47
-
48
- const metaIndexStart = inHtml.indexOf(metaTextStart);
49
- const metaIndexEnd = inHtml.indexOf(metaTextEnd);
50
-
51
- // const webConfig = await readWebConfig(outdirData);
52
- const webEnvData = webEnv.getWebEnv(appName);
53
-
54
- outStr =
55
- outStr.substring(0, metaIndexStart).replace('<!--META-THEME-->', defaultThemeName) +
56
- '<script id="web-env" type="application/json">' +
57
- JSON.stringify(webEnvData) +
58
- '</script>\r\n' +
59
- // '<script id="web-setting" type="application/json">' +
60
- // JSON.stringify(webConfig) +
61
- // '</script>' +
62
- outStr.substring(metaIndexEnd + metaTextEnd.length);
63
- // outStr = webEnv.replaceWebEnv(inHtml, appName, true);
64
- }
65
- await fs.mkdir(path.dirname(outputFile), { recursive: true });
66
- await fs.writeFile(outputFile, outStr);
67
- await fileUpdateTime(outputFile, new Date(chgTime));
68
- }
69
- };
1
+ const path = require('path');
2
+ const fs = require('fs/promises');
3
+ const webEnv = require('../src/common-js/web-env.js');
4
+ const fileUtils = require('./file-utils.js');
5
+
6
+ const fileSizeAndTime = async (filename) => {
7
+ try {
8
+ var stats = await fs.stat(filename);
9
+ return { size: stats.size, mtime: stats.mtime };
10
+ } catch (e) {
11
+ return false;
12
+ }
13
+ };
14
+ const fileUpdateTime = async (filename, time) => {
15
+ fs.utimes(filename, time, time);
16
+ };
17
+
18
+ const readWebConfig = async (outdirData) => {
19
+ let tempPath = path.join(outdirData, 'config.json');
20
+ if (!(await fileUtils.pathExists(tempPath))) {
21
+ tempPath = path.join(outdirData, 'resources', 'config_default.json');
22
+ }
23
+
24
+ // file should exist
25
+ const data = await fs.readFile(tempPath, 'utf-8');
26
+ const json = JSON.parse(data || {});
27
+ return webEnv.getWebConfig(json);
28
+ };
29
+
30
+ const metaTextStart = '<!--META-ENV-START-->';
31
+ const metaTextEnd = '<!--META-ENV-END-->';
32
+ exports.cpIndexHtml = async (htmlFile, outputFile, appName, isMobile, defaultThemeName, outdirData) => {
33
+ const f1 = await fileSizeAndTime(htmlFile);
34
+ const f2 = await fileSizeAndTime(outputFile);
35
+
36
+ // once isMobile is changed, then index.html file needs to be rebuilt
37
+ // if isMobile=true, then the last number is 1, or if isMobile=false, the last is 2
38
+ const chgTime = Math.trunc(f1.mtime.getTime() / 10) * 10 + (isMobile ? 1 : 2);
39
+
40
+ // when it's isMobile, need to update env and configs => no configs as mobile app fetches it from api
41
+ if (!f2 || f2.mtime.getTime() !== chgTime || isMobile) {
42
+ const inHtml = await fs.readFile(htmlFile, 'utf-8');
43
+ let outStr = inHtml.replace(/{hash}/gi, new Date().getTime().toString(36));
44
+ if (isMobile) {
45
+ // const outStr = inHtml.replace(/{hash}/gi, new Date().getTime().toString(36)).replace('\<\!--META-ENV--\>', JSON.stringify(envWeb));
46
+ // env is replaced here for the mobile app. And the env is replaced again for the web app at each startup
47
+
48
+ const metaIndexStart = inHtml.indexOf(metaTextStart);
49
+ const metaIndexEnd = inHtml.indexOf(metaTextEnd);
50
+
51
+ // const webConfig = await readWebConfig(outdirData);
52
+ const webEnvData = webEnv.getWebEnv(appName);
53
+
54
+ outStr =
55
+ outStr.substring(0, metaIndexStart).replace('<!--META-THEME-->', defaultThemeName) +
56
+ '<script id="web-env" type="application/json">' +
57
+ JSON.stringify(webEnvData) +
58
+ '</script>\r\n' +
59
+ // '<script id="web-setting" type="application/json">' +
60
+ // JSON.stringify(webConfig) +
61
+ // '</script>' +
62
+ outStr.substring(metaIndexEnd + metaTextEnd.length);
63
+ // outStr = webEnv.replaceWebEnv(inHtml, appName, true);
64
+ }
65
+ await fs.mkdir(path.dirname(outputFile), { recursive: true });
66
+ await fs.writeFile(outputFile, outStr);
67
+ await fileUpdateTime(outputFile, new Date(chgTime));
68
+ }
69
+ };
package/dev/file-utils.js CHANGED
@@ -1,12 +1,12 @@
1
- const fs = require('fs/promises');
2
-
3
- exports.readJson = async (filename) => {
4
- return JSON.parse((await fs.readFile(filename)).toString());
5
- };
6
-
7
- exports.pathExists = async (path) => {
8
- return await fs
9
- .access(path)
10
- .then(() => true)
11
- .catch(() => false);
12
- };
1
+ const fs = require('fs/promises');
2
+
3
+ exports.readJson = async (filename) => {
4
+ return JSON.parse((await fs.readFile(filename)).toString());
5
+ };
6
+
7
+ exports.pathExists = async (path) => {
8
+ return await fs
9
+ .access(path)
10
+ .then(() => true)
11
+ .catch(() => false);
12
+ };
package/dev/index.js CHANGED
@@ -1,19 +1,18 @@
1
- const { copyFolder } = require('./copy-folder.js');
2
- const { cpIndexHtml } = require('./cp-index-html.js');
3
- const fileUtils = require('./file-utils.js');
4
- const webEnv = require('../src/common-js/web-env.js');
5
- const { runCmd } = require('./run-cmd.js');
6
- const { sendRequest } = require('./send-request.js');
7
- module.exports = {
8
- copyFolder,
9
- cpIndexHtml,
10
- runCmd,
11
- sendRequest,
12
- readJson: fileUtils.readJson,
13
- pathExists: fileUtils.pathExists,
14
- parseEnv: webEnv.parseEnv,
15
- loadEnv: webEnv.loadEnv,
16
- getWebConfig: webEnv.getWebConfig,
17
- pluginIfelse: require('./plugin-ifelse.js'),
18
- genVersions: require('./plugin-gen-versions.js'),
19
- };
1
+ const { copyFolder } = require('./copy-folder.js');
2
+ const { cpIndexHtml } = require('./cp-index-html.js');
3
+ const fileUtils = require('./file-utils.js');
4
+ const webEnv = require('../src/common-js/web-env.js');
5
+ const { runCmd } = require('./run-cmd.js');
6
+ const { sendRequest } = require('./send-request.js');
7
+ module.exports = {
8
+ copyFolder,
9
+ cpIndexHtml,
10
+ runCmd,
11
+ sendRequest,
12
+ readJson: fileUtils.readJson,
13
+ pathExists: fileUtils.pathExists,
14
+ parseEnv: webEnv.parseEnv,
15
+ loadEnv: webEnv.loadEnv,
16
+ getWebConfig: webEnv.getWebConfig,
17
+ pluginIfelse: require('./plugin-ifelse.js'),
18
+ };
package/dev/package.json CHANGED
@@ -1,12 +1,12 @@
1
- {
2
- "name": "lupine.api-dev",
3
- "version": "1.0.0",
4
- "private": true,
5
- "description": "dev tools for lupine.api",
6
- "main": "index.js",
7
- "module": "index.js",
8
- "umd:main": "index.js",
9
- "source": "index.js",
10
- "types": "index.js",
11
- "license": "MIT"
12
- }
1
+ {
2
+ "name": "lupine.api-dev",
3
+ "version": "1.0.0",
4
+ "private": true,
5
+ "description": "dev tools for lupine.api",
6
+ "main": "index.js",
7
+ "module": "index.js",
8
+ "umd:main": "index.js",
9
+ "source": "index.js",
10
+ "types": "index.js",
11
+ "license": "MIT"
12
+ }