hotstaq 0.5.3
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/.dockerignore +123 -0
- package/.eslintignore +17 -0
- package/.eslintrc.js +11 -0
- package/.vscode/launch.json +201 -0
- package/.vscode/settings.json +2 -0
- package/.vscode/tasks.json +88 -0
- package/CONTRIBUTING.md +157 -0
- package/LICENSE +21 -0
- package/README.md +128 -0
- package/bin/hotstaq +3 -0
- package/bin/hotstaq.cmd +1 -0
- package/build/src/Hot.d.ts +167 -0
- package/build/src/Hot.d.ts.map +1 -0
- package/build/src/Hot.js +365 -0
- package/build/src/Hot.js.map +1 -0
- package/build/src/HotAPI.d.ts +137 -0
- package/build/src/HotAPI.d.ts.map +1 -0
- package/build/src/HotAPI.js +353 -0
- package/build/src/HotAPI.js.map +1 -0
- package/build/src/HotAgentAPI.d.ts +22 -0
- package/build/src/HotAgentAPI.d.ts.map +1 -0
- package/build/src/HotAgentAPI.js +85 -0
- package/build/src/HotAgentAPI.js.map +1 -0
- package/build/src/HotAgentRoute.d.ts +17 -0
- package/build/src/HotAgentRoute.d.ts.map +1 -0
- package/build/src/HotAgentRoute.js +109 -0
- package/build/src/HotAgentRoute.js.map +1 -0
- package/build/src/HotBuilder.d.ts +52 -0
- package/build/src/HotBuilder.d.ts.map +1 -0
- package/build/src/HotBuilder.js +242 -0
- package/build/src/HotBuilder.js.map +1 -0
- package/build/src/HotClient.d.ts +31 -0
- package/build/src/HotClient.d.ts.map +1 -0
- package/build/src/HotClient.js +19 -0
- package/build/src/HotClient.js.map +1 -0
- package/build/src/HotComponent.d.ts +118 -0
- package/build/src/HotComponent.d.ts.map +1 -0
- package/build/src/HotComponent.js +89 -0
- package/build/src/HotComponent.js.map +1 -0
- package/build/src/HotCreator.d.ts +88 -0
- package/build/src/HotCreator.d.ts.map +1 -0
- package/build/src/HotCreator.js +445 -0
- package/build/src/HotCreator.js.map +1 -0
- package/build/src/HotDB.d.ts +69 -0
- package/build/src/HotDB.d.ts.map +1 -0
- package/build/src/HotDB.js +29 -0
- package/build/src/HotDB.js.map +1 -0
- package/build/src/HotDBConnectionInterface.d.ts +40 -0
- package/build/src/HotDBConnectionInterface.d.ts.map +1 -0
- package/build/src/HotDBConnectionInterface.js +3 -0
- package/build/src/HotDBConnectionInterface.js.map +1 -0
- package/build/src/HotFile.d.ts +134 -0
- package/build/src/HotFile.d.ts.map +1 -0
- package/build/src/HotFile.js +454 -0
- package/build/src/HotFile.js.map +1 -0
- package/build/src/HotGenerator.d.ts +80 -0
- package/build/src/HotGenerator.d.ts.map +1 -0
- package/build/src/HotGenerator.js +342 -0
- package/build/src/HotGenerator.js.map +1 -0
- package/build/src/HotHTTPServer.d.ts +162 -0
- package/build/src/HotHTTPServer.d.ts.map +1 -0
- package/build/src/HotHTTPServer.js +863 -0
- package/build/src/HotHTTPServer.js.map +1 -0
- package/build/src/HotIO.d.ts +47 -0
- package/build/src/HotIO.d.ts.map +1 -0
- package/build/src/HotIO.js +232 -0
- package/build/src/HotIO.js.map +1 -0
- package/build/src/HotLog.d.ts +60 -0
- package/build/src/HotLog.d.ts.map +1 -0
- package/build/src/HotLog.js +126 -0
- package/build/src/HotLog.js.map +1 -0
- package/build/src/HotPage.d.ts +125 -0
- package/build/src/HotPage.d.ts.map +1 -0
- package/build/src/HotPage.js +178 -0
- package/build/src/HotPage.js.map +1 -0
- package/build/src/HotRoute.d.ts +82 -0
- package/build/src/HotRoute.d.ts.map +1 -0
- package/build/src/HotRoute.js +83 -0
- package/build/src/HotRoute.js.map +1 -0
- package/build/src/HotRouteMethod.d.ts +129 -0
- package/build/src/HotRouteMethod.d.ts.map +1 -0
- package/build/src/HotRouteMethod.js +84 -0
- package/build/src/HotRouteMethod.js.map +1 -0
- package/build/src/HotServer.d.ts +152 -0
- package/build/src/HotServer.d.ts.map +1 -0
- package/build/src/HotServer.js +109 -0
- package/build/src/HotServer.js.map +1 -0
- package/build/src/HotSetAsWeb.d.ts +2 -0
- package/build/src/HotSetAsWeb.d.ts.map +1 -0
- package/build/src/HotSetAsWeb.js +5 -0
- package/build/src/HotSetAsWeb.js.map +1 -0
- package/build/src/HotStaq.d.ts +603 -0
- package/build/src/HotStaq.d.ts.map +1 -0
- package/build/src/HotStaq.js +1260 -0
- package/build/src/HotStaq.js.map +1 -0
- package/build/src/HotStaqWeb.d.ts +18 -0
- package/build/src/HotStaqWeb.d.ts.map +1 -0
- package/build/src/HotStaqWeb.js +44 -0
- package/build/src/HotStaqWeb.js.map +1 -0
- package/build/src/HotTestDriver.d.ts +63 -0
- package/build/src/HotTestDriver.d.ts.map +1 -0
- package/build/src/HotTestDriver.js +187 -0
- package/build/src/HotTestDriver.js.map +1 -0
- package/build/src/HotTestElement.d.ts +71 -0
- package/build/src/HotTestElement.d.ts.map +1 -0
- package/build/src/HotTestElement.js +37 -0
- package/build/src/HotTestElement.js.map +1 -0
- package/build/src/HotTestMap.d.ts +83 -0
- package/build/src/HotTestMap.d.ts.map +1 -0
- package/build/src/HotTestMap.js +58 -0
- package/build/src/HotTestMap.js.map +1 -0
- package/build/src/HotTestSeleniumDriver.d.ts +86 -0
- package/build/src/HotTestSeleniumDriver.d.ts.map +1 -0
- package/build/src/HotTestSeleniumDriver.js +400 -0
- package/build/src/HotTestSeleniumDriver.js.map +1 -0
- package/build/src/HotTester.d.ts +188 -0
- package/build/src/HotTester.d.ts.map +1 -0
- package/build/src/HotTester.js +622 -0
- package/build/src/HotTester.js.map +1 -0
- package/build/src/HotTesterAPI.d.ts +15 -0
- package/build/src/HotTesterAPI.d.ts.map +1 -0
- package/build/src/HotTesterAPI.js +161 -0
- package/build/src/HotTesterAPI.js.map +1 -0
- package/build/src/HotTesterMocha.d.ts +50 -0
- package/build/src/HotTesterMocha.d.ts.map +1 -0
- package/build/src/HotTesterMocha.js +205 -0
- package/build/src/HotTesterMocha.js.map +1 -0
- package/build/src/HotTesterMochaSelenium.d.ts +70 -0
- package/build/src/HotTesterMochaSelenium.d.ts.map +1 -0
- package/build/src/HotTesterMochaSelenium.js +257 -0
- package/build/src/HotTesterMochaSelenium.js.map +1 -0
- package/build/src/HotTesterServer.d.ts +114 -0
- package/build/src/HotTesterServer.d.ts.map +1 -0
- package/build/src/HotTesterServer.js +575 -0
- package/build/src/HotTesterServer.js.map +1 -0
- package/build/src/api copy.d.ts +2 -0
- package/build/src/api copy.d.ts.map +1 -0
- package/build/src/api copy.js +153 -0
- package/build/src/api copy.js.map +1 -0
- package/build/src/api-web.d.ts +2 -0
- package/build/src/api-web.d.ts.map +1 -0
- package/build/src/api-web.js +45 -0
- package/build/src/api-web.js.map +1 -0
- package/build/src/api.d.ts +33 -0
- package/build/src/api.d.ts.map +1 -0
- package/build/src/api.js +78 -0
- package/build/src/api.js.map +1 -0
- package/build/src/cli.d.ts +2 -0
- package/build/src/cli.d.ts.map +1 -0
- package/build/src/cli.js +1040 -0
- package/build/src/cli.js.map +1 -0
- package/build/src/schemas/HotDBInflux.d.ts +63 -0
- package/build/src/schemas/HotDBInflux.d.ts.map +1 -0
- package/build/src/schemas/HotDBInflux.js +239 -0
- package/build/src/schemas/HotDBInflux.js.map +1 -0
- package/build/src/schemas/HotDBMigration.d.ts +19 -0
- package/build/src/schemas/HotDBMigration.d.ts.map +1 -0
- package/build/src/schemas/HotDBMigration.js +15 -0
- package/build/src/schemas/HotDBMigration.js.map +1 -0
- package/build/src/schemas/HotDBMySQL.d.ts +65 -0
- package/build/src/schemas/HotDBMySQL.d.ts.map +1 -0
- package/build/src/schemas/HotDBMySQL.js +387 -0
- package/build/src/schemas/HotDBMySQL.js.map +1 -0
- package/build/src/schemas/HotDBSchema.d.ts +15 -0
- package/build/src/schemas/HotDBSchema.d.ts.map +1 -0
- package/build/src/schemas/HotDBSchema.js +19 -0
- package/build/src/schemas/HotDBSchema.js.map +1 -0
- package/build/src/schemas/influx/InfluxSchema.d.ts +14 -0
- package/build/src/schemas/influx/InfluxSchema.d.ts.map +1 -0
- package/build/src/schemas/influx/InfluxSchema.js +33 -0
- package/build/src/schemas/influx/InfluxSchema.js.map +1 -0
- package/build/src/schemas/mysql/MySQLSchema.d.ts +39 -0
- package/build/src/schemas/mysql/MySQLSchema.d.ts.map +1 -0
- package/build/src/schemas/mysql/MySQLSchema.js +151 -0
- package/build/src/schemas/mysql/MySQLSchema.js.map +1 -0
- package/build/src/schemas/mysql/MySQLSchemaField.d.ts +168 -0
- package/build/src/schemas/mysql/MySQLSchemaField.d.ts.map +1 -0
- package/build/src/schemas/mysql/MySQLSchemaField.js +260 -0
- package/build/src/schemas/mysql/MySQLSchemaField.js.map +1 -0
- package/build/src/schemas/mysql/MySQLSchemaTable.d.ts +49 -0
- package/build/src/schemas/mysql/MySQLSchemaTable.d.ts.map +1 -0
- package/build/src/schemas/mysql/MySQLSchemaTable.js +310 -0
- package/build/src/schemas/mysql/MySQLSchemaTable.js.map +1 -0
- package/build-web/HotStaq.js +2 -0
- package/build-web/HotStaq.min.js +119 -0
- package/build-web/HotStaqTests_HelloWorldAPI.js +133 -0
- package/builder/docker/Dockerfile.linux.gen +42 -0
- package/builder/docker/README.md +36 -0
- package/builder/docker/app/start.sh +8 -0
- package/builder/docker/dockerignore +3 -0
- package/builder/docker/scripts/build.bat +11 -0
- package/builder/docker/scripts/build.sh +11 -0
- package/builder/docker/scripts/start-app.bat +7 -0
- package/builder/docker/scripts/start-app.sh +7 -0
- package/builder/docker/scripts/stop-app.bat +5 -0
- package/builder/docker/scripts/stop-app.sh +5 -0
- package/builder/docker-compose/docker-compose.gen.yaml +41 -0
- package/builder/docker-compose/env-skeleton +4 -0
- package/creator/project/.vscode/launch.json +59 -0
- package/creator/project/README.md +20 -0
- package/creator/project/gitignore +118 -0
- package/creator/project/npmignore +118 -0
- package/creator/public/api-test.hott +28 -0
- package/creator/public/index.hott +12 -0
- package/creator/ts/src/AppAPI.ts +30 -0
- package/creator/ts/src/HelloWorld.ts +39 -0
- package/creator/ts/src/WebExport.ts +7 -0
- package/creator/ts/tsconfig-web.json +73 -0
- package/creator/ts/tsconfig.json +73 -0
- package/creator/ts/webpack-api.config.js +57 -0
- package/dbstart.sh +19 -0
- package/dbstop.sh +4 -0
- package/docs/.nojekyll +1 -0
- package/docs/README.md +130 -0
- package/docs/classes/Hot.md +477 -0
- package/docs/classes/HotAPI.md +369 -0
- package/docs/classes/HotClient.md +95 -0
- package/docs/classes/HotComponent.md +279 -0
- package/docs/classes/HotDB.md +247 -0
- package/docs/classes/HotDBInflux.md +404 -0
- package/docs/classes/HotDBMigration.md +80 -0
- package/docs/classes/HotDBMySQL.md +310 -0
- package/docs/classes/HotDBSchema.md +51 -0
- package/docs/classes/HotFile.md +353 -0
- package/docs/classes/HotHTTPServer.md +700 -0
- package/docs/classes/HotLog.md +162 -0
- package/docs/classes/HotPage.md +357 -0
- package/docs/classes/HotRoute.md +312 -0
- package/docs/classes/HotRouteMethod.md +271 -0
- package/docs/classes/HotServer.md +311 -0
- package/docs/classes/HotStaq.md +1155 -0
- package/docs/classes/HotTestDestination.md +58 -0
- package/docs/classes/HotTestDriver.md +332 -0
- package/docs/classes/HotTestElement.md +88 -0
- package/docs/classes/HotTestElementOptions.md +71 -0
- package/docs/classes/HotTestMap.md +92 -0
- package/docs/classes/HotTestSeleniumDriver.md +542 -0
- package/docs/classes/HotTester.md +653 -0
- package/docs/classes/HotTesterAPI.md +493 -0
- package/docs/classes/HotTesterMocha.md +843 -0
- package/docs/classes/HotTesterMochaSelenium.md +896 -0
- package/docs/classes/HotTesterServer.md +633 -0
- package/docs/classes/InfluxSchema.md +74 -0
- package/docs/classes/MySQLSchema.md +199 -0
- package/docs/classes/MySQLSchemaField.md +330 -0
- package/docs/classes/MySQLSchemaTable.md +176 -0
- package/docs/enums/ConnectionStatus.md +43 -0
- package/docs/enums/DeveloperMode.md +38 -0
- package/docs/enums/EventExecutionType.md +43 -0
- package/docs/enums/HTTPMethod.md +32 -0
- package/docs/enums/HotDBGenerationType.md +30 -0
- package/docs/enums/HotLogLevel.md +88 -0
- package/docs/interfaces/HotDBConnectionInterface.md +116 -0
- package/docs/interfaces/HotDestination.md +62 -0
- package/docs/interfaces/HotSite.md +187 -0
- package/docs/interfaces/HotSiteMapPath.md +37 -0
- package/docs/interfaces/HotSiteRoute.md +79 -0
- package/docs/interfaces/HotStartOptions.md +115 -0
- package/docs/interfaces/HotTestPage.md +44 -0
- package/docs/interfaces/HotTestStop.md +62 -0
- package/docs/interfaces/IHotComponent.md +135 -0
- package/docs/interfaces/IHotStaq.md +118 -0
- package/docs/interfaces/IHotTestElement.md +54 -0
- package/docs/interfaces/IHotTestElementOptions.md +43 -0
- package/docs/interfaces/MySQLResults.md +43 -0
- package/docs/interfaces/MySQLSchemaFieldResult.md +75 -0
- package/docs/modules.md +182 -0
- package/package.json +65 -0
- package/selenium-start.sh +7 -0
- package/selenium-stop.sh +3 -0
- package/src/Hot.ts +319 -0
- package/src/HotAPI.ts +386 -0
- package/src/HotAgentAPI.ts +43 -0
- package/src/HotAgentRoute.ts +44 -0
- package/src/HotBuilder.ts +221 -0
- package/src/HotClient.ts +40 -0
- package/src/HotComponent.ts +158 -0
- package/src/HotCreator.ts +470 -0
- package/src/HotDB.ts +79 -0
- package/src/HotDBConnectionInterface.ts +40 -0
- package/src/HotFile.ts +617 -0
- package/src/HotGenerator.ts +446 -0
- package/src/HotHTTPServer.ts +954 -0
- package/src/HotIO.ts +160 -0
- package/src/HotLog.ts +158 -0
- package/src/HotPage.ts +206 -0
- package/src/HotRoute.ts +137 -0
- package/src/HotRouteMethod.ts +216 -0
- package/src/HotServer.ts +211 -0
- package/src/HotSetAsWeb.ts +3 -0
- package/src/HotStaq.ts +1881 -0
- package/src/HotTestDriver.ts +171 -0
- package/src/HotTestElement.ts +97 -0
- package/src/HotTestMap.ts +130 -0
- package/src/HotTestSeleniumDriver.ts +381 -0
- package/src/HotTester.ts +696 -0
- package/src/HotTesterAPI.ts +126 -0
- package/src/HotTesterMocha.ts +133 -0
- package/src/HotTesterMochaSelenium.ts +189 -0
- package/src/HotTesterServer.ts +551 -0
- package/src/api-web.ts +48 -0
- package/src/api.ts +103 -0
- package/src/cli.ts +1225 -0
- package/src/schemas/HotDBInflux.ts +211 -0
- package/src/schemas/HotDBMigration.ts +24 -0
- package/src/schemas/HotDBMySQL.ts +312 -0
- package/src/schemas/HotDBSchema.ts +21 -0
- package/src/schemas/influx/InfluxSchema.ts +19 -0
- package/src/schemas/mysql/MySQLSchema.ts +90 -0
- package/src/schemas/mysql/MySQLSchemaField.ts +408 -0
- package/src/schemas/mysql/MySQLSchemaTable.ts +353 -0
- package/temp/HotStaqWeb.ts +59 -0
- package/tsconfig-generator.json +17 -0
- package/tsconfig-web.json +74 -0
- package/tsconfig.json +73 -0
- package/webpack.config.generator.js +41 -0
- package/webpack.config.js +53 -0
- package/webpack.config.tests.js +56 -0
package/README.md
ADDED
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
# HotStaq
|
|
2
|
+
HotStaq is a frontend/backend app framework that plays nicely with DevOps.
|
|
3
|
+
|
|
4
|
+
More specifically, it's a client-side HTML preprocessor, with a design similar to that of PHP. Tech stacks have grown in size significantly over the years, and it can be hard for small teams to efficiently utilize all the different tech stacks properly. HotStaq helps reduce the headache of maintaining all the various tech while ensuring the application's security and quality.
|
|
5
|
+
|
|
6
|
+
Developers can quickly create their frontend and backends securely while adding their unit tests along the way in code During development, HotStaq developers know they can generate Dockerfiles to easily deploy their application to Kubernetes or Docker Swarm.
|
|
7
|
+
|
|
8
|
+
For more information, please visit: [HotStaq](https://hotstaq.com)
|
|
9
|
+
|
|
10
|
+
## Getting started
|
|
11
|
+
First you gotta install like so:
|
|
12
|
+
```console
|
|
13
|
+
npm -g install hotstaq
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Now you can create your project by entering:
|
|
17
|
+
```console
|
|
18
|
+
hotstaq create my-app
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Run the development web server:
|
|
22
|
+
|
|
23
|
+
```console
|
|
24
|
+
cd my-app
|
|
25
|
+
|
|
26
|
+
hotstaq start
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Your site starts at `http://localhost:8080`.
|
|
30
|
+
|
|
31
|
+
Open `public/index.hott` and change your landing page. Refresh your browser to see your changes immediately.
|
|
32
|
+
|
|
33
|
+
That's it!
|
|
34
|
+
|
|
35
|
+
## Running database tests
|
|
36
|
+
Make sure you have Docker installed, then do:
|
|
37
|
+
```console
|
|
38
|
+
./dbstart.sh
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
This will launch the temporary MariaDB and InfluxDB databases.
|
|
42
|
+
|
|
43
|
+
After testing/debugging you can stop them by entering:
|
|
44
|
+
```console
|
|
45
|
+
./dbstop.sh
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Environment Variables
|
|
49
|
+
You can configure how HotStaq starts by using:
|
|
50
|
+
* DATABASE_TYPE
|
|
51
|
+
* Type: string
|
|
52
|
+
* Description: The type of database to use.
|
|
53
|
+
* Accepted values:
|
|
54
|
+
* mysql
|
|
55
|
+
* influx
|
|
56
|
+
* DATABASE_SERVER
|
|
57
|
+
* Type: string
|
|
58
|
+
* Description: The url to the database server to connect to.
|
|
59
|
+
* Accepted values:
|
|
60
|
+
* MySql example: 127.0.0.1
|
|
61
|
+
* Influx example: http://127.0.0.1:8086
|
|
62
|
+
* DATABASE_PORT
|
|
63
|
+
* Type: number
|
|
64
|
+
* Description: The database port to use.
|
|
65
|
+
* Accepted values:
|
|
66
|
+
* Any integer.
|
|
67
|
+
* DATABASE_USERNAME
|
|
68
|
+
* Type: string
|
|
69
|
+
* Description: The database username to use.
|
|
70
|
+
* Accepted values:
|
|
71
|
+
* Any string.
|
|
72
|
+
* DATABASE_PASSWORD
|
|
73
|
+
* Type: string
|
|
74
|
+
* Description: The database password to use.
|
|
75
|
+
* Accepted values:
|
|
76
|
+
* Any string.
|
|
77
|
+
* DATABASE_ORG
|
|
78
|
+
* Type: string
|
|
79
|
+
* Description: The organization that contains the database. For Influx use.
|
|
80
|
+
* Accepted values:
|
|
81
|
+
* Any string.
|
|
82
|
+
* DATABASE_TOKEN
|
|
83
|
+
* Type: string
|
|
84
|
+
* Description: The database token to use. For Influx use.
|
|
85
|
+
* Accepted values:
|
|
86
|
+
* Any string.
|
|
87
|
+
* DATABASE_SCHEMA
|
|
88
|
+
* Type: string
|
|
89
|
+
* Description: The database schema (or bucket) to use.
|
|
90
|
+
* Accepted values:
|
|
91
|
+
* Any string.
|
|
92
|
+
* SELENIUM_REMOTE_SERVER
|
|
93
|
+
* Type: string
|
|
94
|
+
* Description: The remote selenium server to do web browser tests with.
|
|
95
|
+
* Accepted values:
|
|
96
|
+
* Any valid url.
|
|
97
|
+
* SELENIUM_WINDOW_WIDTH
|
|
98
|
+
* Type: number
|
|
99
|
+
* Description: The width of the new browser window.
|
|
100
|
+
* Accepted values:
|
|
101
|
+
* Any integer.
|
|
102
|
+
* SELENIUM_WINDOW_HEIGHT
|
|
103
|
+
* Type: number
|
|
104
|
+
* Description: The height of the new browser window.
|
|
105
|
+
* Accepted values:
|
|
106
|
+
* Any integer.
|
|
107
|
+
* TESTING_DEVTOOLS
|
|
108
|
+
* Type: number
|
|
109
|
+
* Description: Set to 1 if you want chrome to open the dev tools as browser tests start. This is only for testing.
|
|
110
|
+
* Accepted values:
|
|
111
|
+
* 0
|
|
112
|
+
* 1
|
|
113
|
+
* TESTING_REMOTE_SERVER
|
|
114
|
+
* Type: string
|
|
115
|
+
* Description: The remote server to use during browser tests.
|
|
116
|
+
* Accepted values:
|
|
117
|
+
* Any valid url.
|
|
118
|
+
|
|
119
|
+
## Developing
|
|
120
|
+
To get started developing you'll need to install:
|
|
121
|
+
```console
|
|
122
|
+
npm -g install typescript webpack-cli@4 typedoc
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
To run browser tests, you'll need to have the correct version of [chromedriver](https://chromedriver.chromium.org/) installed for the version of Chrome you are running on your machine.
|
|
126
|
+
|
|
127
|
+
## Possible Future Compiler
|
|
128
|
+
I'd like to create a CLI tool that compresses the entire public html directory into a zip file which can be downloaded and unzipped during runtime by the client's web browser then display the pages. During the compilation phase it would look for vulnerabilities and report them; for example when embedding JS files, if integrity hashes are missing, it would complain.
|
package/bin/hotstaq
ADDED
package/bin/hotstaq.cmd
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
node ../build/src/cli.js %*
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import { HotFile } from "./HotFile";
|
|
2
|
+
import { HotPage } from "./HotPage";
|
|
3
|
+
import { HotAPI } from "./HotAPI";
|
|
4
|
+
import { HotTestElement } from "./HotTestElement";
|
|
5
|
+
import Cookies from "js-cookie";
|
|
6
|
+
/**
|
|
7
|
+
* The available developer modes.
|
|
8
|
+
*/
|
|
9
|
+
export declare enum DeveloperMode {
|
|
10
|
+
/**
|
|
11
|
+
* The default developer mode. No tests will be executed and
|
|
12
|
+
* any test related data will be ignored.
|
|
13
|
+
*/
|
|
14
|
+
Production = 0,
|
|
15
|
+
/**
|
|
16
|
+
* For use during development/debugging. All test data will
|
|
17
|
+
* be collected and executed if necessary.
|
|
18
|
+
*/
|
|
19
|
+
Development = 1
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* A CSS object to embed.
|
|
23
|
+
*/
|
|
24
|
+
export interface CSSObject {
|
|
25
|
+
/**
|
|
26
|
+
* The url to the CSS file to embed.
|
|
27
|
+
*/
|
|
28
|
+
url: string;
|
|
29
|
+
/**
|
|
30
|
+
* The integrity hash to generate during initial compilation.
|
|
31
|
+
*/
|
|
32
|
+
integrityHash: string;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* The api used during processing.
|
|
36
|
+
*/
|
|
37
|
+
export declare class Hot {
|
|
38
|
+
/**
|
|
39
|
+
* The currently generated page being displayed. This is cleared between every file processed.
|
|
40
|
+
*/
|
|
41
|
+
static CurrentPage: HotPage;
|
|
42
|
+
/**
|
|
43
|
+
* The arguments passed.
|
|
44
|
+
*/
|
|
45
|
+
static Arguments: any;
|
|
46
|
+
/**
|
|
47
|
+
* The mode in which this application is running. If it's set to development mode, all testing
|
|
48
|
+
* related data will be collected, parsed, and executed if necessary.
|
|
49
|
+
*/
|
|
50
|
+
static DeveloperMode: typeof DeveloperMode;
|
|
51
|
+
/**
|
|
52
|
+
* The mode in which this application is running. If it's set to development mode, all testing
|
|
53
|
+
* related data will be collected, parsed, and executed if necessary.
|
|
54
|
+
*/
|
|
55
|
+
static HotTestElement: typeof HotTestElement;
|
|
56
|
+
/**
|
|
57
|
+
* The mode in which this application is running. If it's set to development mode, all testing
|
|
58
|
+
* related data will be collected, parsed, and executed if necessary.
|
|
59
|
+
*/
|
|
60
|
+
static Mode: DeveloperMode;
|
|
61
|
+
/**
|
|
62
|
+
*The current API used on this page. This is cleared between every file processed.
|
|
63
|
+
*/
|
|
64
|
+
static API: HotAPI;
|
|
65
|
+
/**
|
|
66
|
+
* The API being used by the tester.
|
|
67
|
+
*/
|
|
68
|
+
static TesterAPI: HotAPI;
|
|
69
|
+
/**
|
|
70
|
+
* Contains the buffer to output. This is cleared between every file processed.
|
|
71
|
+
*/
|
|
72
|
+
static Output: string;
|
|
73
|
+
/**
|
|
74
|
+
* The data to share across all the different files and pages. This data will be public.
|
|
75
|
+
*/
|
|
76
|
+
static Data: any;
|
|
77
|
+
/**
|
|
78
|
+
* The cookies to use between pages.
|
|
79
|
+
*/
|
|
80
|
+
static Cookies: Cookies.CookiesStatic;
|
|
81
|
+
/**
|
|
82
|
+
* Any secrets that can be shown publicly. These can be passed from HotSite.json.
|
|
83
|
+
*/
|
|
84
|
+
static PublicSecrets: any;
|
|
85
|
+
/**
|
|
86
|
+
* The CSS string to use when echoing out the CSS files.
|
|
87
|
+
*/
|
|
88
|
+
static cssStr: string;
|
|
89
|
+
/**
|
|
90
|
+
* The CSS files to use in the current page being generated.
|
|
91
|
+
*
|
|
92
|
+
* @todo Make this a "string | CSSObject" data type so it can also include
|
|
93
|
+
* the integrity hashes as well.
|
|
94
|
+
*/
|
|
95
|
+
static CSS: string[];
|
|
96
|
+
/**
|
|
97
|
+
* The JavaScript files to use in the current page being generated.
|
|
98
|
+
*
|
|
99
|
+
* @todo Make this a "string | JSFileObject" data type so it can also include
|
|
100
|
+
* the integrity hashes as well.
|
|
101
|
+
*/
|
|
102
|
+
static JSFiles: any[];
|
|
103
|
+
/**
|
|
104
|
+
* The JavaScript inline code to use in the current page being generated.
|
|
105
|
+
*/
|
|
106
|
+
static JSScripts: any[];
|
|
107
|
+
/**
|
|
108
|
+
* The JavaScript string to use when echoing out the Scripts files.
|
|
109
|
+
*/
|
|
110
|
+
static jsFileStr: string;
|
|
111
|
+
/**
|
|
112
|
+
* The JavaScript string to use when echoing out the Scripts files.
|
|
113
|
+
*/
|
|
114
|
+
static jsScriptsStr: string;
|
|
115
|
+
/**
|
|
116
|
+
* Retrieve a file and echo out it's contents.
|
|
117
|
+
*/
|
|
118
|
+
static include(file: HotFile | string, args?: any[]): Promise<void>;
|
|
119
|
+
/**
|
|
120
|
+
* Run an already loaded file and echo out it's contents.
|
|
121
|
+
*/
|
|
122
|
+
static runFile(fileName: string, args?: any[]): Promise<void>;
|
|
123
|
+
/**
|
|
124
|
+
* Get the content of a file.
|
|
125
|
+
*/
|
|
126
|
+
static getFile(path: HotFile | string, args?: any[]): Promise<string>;
|
|
127
|
+
/**
|
|
128
|
+
* Make an api call.
|
|
129
|
+
*/
|
|
130
|
+
static apiCall(route: string, data?: any, httpMethod?: string): Promise<any>;
|
|
131
|
+
/**
|
|
132
|
+
* Make a HTTP JSON request.
|
|
133
|
+
*
|
|
134
|
+
* @param url The full url to make the HTTP call.
|
|
135
|
+
* @param data The data to JSON.stringify and send.
|
|
136
|
+
* @param httpMethod The HTTP method to use to send the data.
|
|
137
|
+
*
|
|
138
|
+
* @returns The parsed JSON object.
|
|
139
|
+
*/
|
|
140
|
+
static jsonRequest(url: string, data?: any, httpMethod?: string): Promise<any>;
|
|
141
|
+
/**
|
|
142
|
+
* Make a HTTP request. This is basically just a wrapper for fetch.
|
|
143
|
+
*
|
|
144
|
+
* @param url The full url to make the HTTP call.
|
|
145
|
+
* @param requestInit The request parameters to send.
|
|
146
|
+
*
|
|
147
|
+
* @returns The HTTP response.
|
|
148
|
+
*/
|
|
149
|
+
static httpRequest(url: string, requestInit?: RequestInit): Promise<Response>;
|
|
150
|
+
/**
|
|
151
|
+
* Echo out some output.
|
|
152
|
+
*/
|
|
153
|
+
static echo(message: string): void;
|
|
154
|
+
/**
|
|
155
|
+
* Echo out the CSS for the current page being generated.
|
|
156
|
+
*/
|
|
157
|
+
static displayCSS(): void;
|
|
158
|
+
/**
|
|
159
|
+
* Echo out the JS files for the current page being generated.
|
|
160
|
+
*/
|
|
161
|
+
static displayJSFiles(): void;
|
|
162
|
+
/**
|
|
163
|
+
* Echo out the JS scripts for the current page being generated.
|
|
164
|
+
*/
|
|
165
|
+
static displayJSScripts(): void;
|
|
166
|
+
}
|
|
167
|
+
//# sourceMappingURL=Hot.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Hot.d.ts","sourceRoot":"","sources":["../../src/Hot.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,OAAO,OAAO,MAAM,WAAW,CAAC;AAGhC;;GAEG;AACH,oBAAY,aAAa;IAExB;;;OAGG;IACH,UAAU,IAAA;IACV;;;OAGG;IACH,WAAW,IAAA;CACX;AAED;;GAEG;AACH,MAAM,WAAW,SAAS;IAEzB;;OAEG;IACH,GAAG,EAAE,MAAM,CAAC;IACZ;;OAEG;IACH,aAAa,EAAE,MAAM,CAAC;CACtB;AAED;;GAEG;AACH,qBAAa,GAAG;IAEf;;OAEG;IACH,MAAM,CAAC,WAAW,EAAE,O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GAAG,EAAS,GAAG,OAAO,CAAC,MAAM,CAAC;IAwBlF;;OAEG;WACU,OAAO,CAAE,KAAK,EAAE,MAAM,EAAE,IAAI,GAAE,GAAU,EAAE,UAAU,GAAE,MAAe,GAAG,OAAO,CAAC,GAAG,CAAC;IAmBjG;;;;;;;;OAQG;WACU,WAAW,CAAE,GAAG,EAAE,MAAM,EAAE,IAAI,GAAE,GAAU,EAAE,UAAU,GAAE,MAAe,GAAG,OAAO,CAAC,GAAG,CAAC;IA0BnG;;;;;;;OAOG;WACU,WAAW,CAAE,GAAG,EAAE,MAAM,EAAE,WAAW,GAAE,WAAuB,GAAG,OAAO,CAAC,QAAQ,CAAC;IAO/F;;OAEG;IACH,MAAM,CAAC,IAAI,CAAE,OAAO,EAAE,MAAM,GAAG,IAAI;IAKnC;;OAEG;IACH,MAAM,CAAC,UAAU,IAAK,IAAI;IAa1B;;OAEG;IACH,MAAM,CAAC,cAAc,IAAK,IAAI;IAa9B;;OAEG;IACH,MAAM,CAAC,gBAAgB,IAAK,IAAI;CAYhC"}
|
package/build/src/Hot.js
ADDED
|
@@ -0,0 +1,365 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (_) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
39
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
40
|
+
};
|
|
41
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
+
exports.Hot = exports.DeveloperMode = void 0;
|
|
43
|
+
var HotFile_1 = require("./HotFile");
|
|
44
|
+
var HotStaq_1 = require("./HotStaq");
|
|
45
|
+
var HotTestElement_1 = require("./HotTestElement");
|
|
46
|
+
var js_cookie_1 = __importDefault(require("js-cookie"));
|
|
47
|
+
var cross_fetch_1 = __importDefault(require("cross-fetch"));
|
|
48
|
+
/**
|
|
49
|
+
* The available developer modes.
|
|
50
|
+
*/
|
|
51
|
+
var DeveloperMode;
|
|
52
|
+
(function (DeveloperMode) {
|
|
53
|
+
/**
|
|
54
|
+
* The default developer mode. No tests will be executed and
|
|
55
|
+
* any test related data will be ignored.
|
|
56
|
+
*/
|
|
57
|
+
DeveloperMode[DeveloperMode["Production"] = 0] = "Production";
|
|
58
|
+
/**
|
|
59
|
+
* For use during development/debugging. All test data will
|
|
60
|
+
* be collected and executed if necessary.
|
|
61
|
+
*/
|
|
62
|
+
DeveloperMode[DeveloperMode["Development"] = 1] = "Development";
|
|
63
|
+
})(DeveloperMode = exports.DeveloperMode || (exports.DeveloperMode = {}));
|
|
64
|
+
/**
|
|
65
|
+
* The api used during processing.
|
|
66
|
+
*/
|
|
67
|
+
var Hot = /** @class */ (function () {
|
|
68
|
+
function Hot() {
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Retrieve a file and echo out it's contents.
|
|
72
|
+
*/
|
|
73
|
+
Hot.include = function (file, args) {
|
|
74
|
+
if (args === void 0) { args = null; }
|
|
75
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
76
|
+
var lowerFile, _a, _b;
|
|
77
|
+
return __generator(this, function (_c) {
|
|
78
|
+
switch (_c.label) {
|
|
79
|
+
case 0:
|
|
80
|
+
if (HotStaq_1.HotStaq.isWeb === true) {
|
|
81
|
+
if (typeof (file) === "string") {
|
|
82
|
+
lowerFile = file.toLowerCase();
|
|
83
|
+
// If the file to be included does not have a nahfam, add it. This
|
|
84
|
+
// will ensure the server sends only the file content.
|
|
85
|
+
if (lowerFile.indexOf(".hott") > -1) {
|
|
86
|
+
if (lowerFile.indexOf("nahfam") < 0)
|
|
87
|
+
file += "?hpserve=nahfam";
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
_b = (_a = Hot).echo;
|
|
92
|
+
return [4 /*yield*/, Hot.getFile(file, args)];
|
|
93
|
+
case 1:
|
|
94
|
+
_b.apply(_a, [_c.sent()]);
|
|
95
|
+
return [2 /*return*/];
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
});
|
|
99
|
+
};
|
|
100
|
+
/**
|
|
101
|
+
* Run an already loaded file and echo out it's contents.
|
|
102
|
+
*/
|
|
103
|
+
Hot.runFile = function (fileName, args) {
|
|
104
|
+
if (args === void 0) { args = null; }
|
|
105
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
106
|
+
var file, tempFile, content;
|
|
107
|
+
return __generator(this, function (_a) {
|
|
108
|
+
switch (_a.label) {
|
|
109
|
+
case 0:
|
|
110
|
+
file = Hot.CurrentPage.processor.getFile(fileName);
|
|
111
|
+
tempFile = file;
|
|
112
|
+
tempFile.page = this.CurrentPage;
|
|
113
|
+
return [4 /*yield*/, tempFile.process(args)];
|
|
114
|
+
case 1:
|
|
115
|
+
content = _a.sent();
|
|
116
|
+
Hot.echo(content);
|
|
117
|
+
return [2 /*return*/];
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
});
|
|
121
|
+
};
|
|
122
|
+
/**
|
|
123
|
+
* Get the content of a file.
|
|
124
|
+
*/
|
|
125
|
+
Hot.getFile = function (path, args) {
|
|
126
|
+
if (args === void 0) { args = null; }
|
|
127
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
128
|
+
var tempFile, content;
|
|
129
|
+
return __generator(this, function (_a) {
|
|
130
|
+
switch (_a.label) {
|
|
131
|
+
case 0:
|
|
132
|
+
tempFile = null;
|
|
133
|
+
if (typeof (path) === "string") {
|
|
134
|
+
tempFile = new HotFile_1.HotFile();
|
|
135
|
+
if (HotStaq_1.HotStaq.isWeb === true)
|
|
136
|
+
tempFile.url = path;
|
|
137
|
+
else
|
|
138
|
+
tempFile.localFile = path;
|
|
139
|
+
}
|
|
140
|
+
else
|
|
141
|
+
tempFile = path;
|
|
142
|
+
return [4 /*yield*/, tempFile.load()];
|
|
143
|
+
case 1:
|
|
144
|
+
_a.sent();
|
|
145
|
+
tempFile.page = this.CurrentPage;
|
|
146
|
+
return [4 /*yield*/, tempFile.process(args)];
|
|
147
|
+
case 2:
|
|
148
|
+
content = _a.sent();
|
|
149
|
+
return [2 /*return*/, (content)];
|
|
150
|
+
}
|
|
151
|
+
});
|
|
152
|
+
});
|
|
153
|
+
};
|
|
154
|
+
/**
|
|
155
|
+
* Make an api call.
|
|
156
|
+
*/
|
|
157
|
+
Hot.apiCall = function (route, data, httpMethod) {
|
|
158
|
+
if (data === void 0) { data = null; }
|
|
159
|
+
if (httpMethod === void 0) { httpMethod = "POST"; }
|
|
160
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
161
|
+
var result;
|
|
162
|
+
return __generator(this, function (_a) {
|
|
163
|
+
switch (_a.label) {
|
|
164
|
+
case 0:
|
|
165
|
+
result = null;
|
|
166
|
+
if (Hot.CurrentPage == null)
|
|
167
|
+
throw new Error("Current page is null!");
|
|
168
|
+
if (Hot.CurrentPage.processor == null)
|
|
169
|
+
throw new Error("Current page's processor is null!");
|
|
170
|
+
if (Hot.CurrentPage.processor.api == null)
|
|
171
|
+
throw new Error("Current page's processor api is null!");
|
|
172
|
+
if (!(Hot.CurrentPage.processor.api != null)) return [3 /*break*/, 2];
|
|
173
|
+
return [4 /*yield*/, Hot.CurrentPage.processor.api.makeCall(route, data, httpMethod)];
|
|
174
|
+
case 1:
|
|
175
|
+
result = _a.sent();
|
|
176
|
+
_a.label = 2;
|
|
177
|
+
case 2: return [2 /*return*/, (result)];
|
|
178
|
+
}
|
|
179
|
+
});
|
|
180
|
+
});
|
|
181
|
+
};
|
|
182
|
+
/**
|
|
183
|
+
* Make a HTTP JSON request.
|
|
184
|
+
*
|
|
185
|
+
* @param url The full url to make the HTTP call.
|
|
186
|
+
* @param data The data to JSON.stringify and send.
|
|
187
|
+
* @param httpMethod The HTTP method to use to send the data.
|
|
188
|
+
*
|
|
189
|
+
* @returns The parsed JSON object.
|
|
190
|
+
*/
|
|
191
|
+
Hot.jsonRequest = function (url, data, httpMethod) {
|
|
192
|
+
if (data === void 0) { data = null; }
|
|
193
|
+
if (httpMethod === void 0) { httpMethod = "POST"; }
|
|
194
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
195
|
+
var res, result, ex_1;
|
|
196
|
+
return __generator(this, function (_a) {
|
|
197
|
+
switch (_a.label) {
|
|
198
|
+
case 0:
|
|
199
|
+
_a.trys.push([0, 3, , 4]);
|
|
200
|
+
return [4 /*yield*/, (0, cross_fetch_1.default)(url, {
|
|
201
|
+
"method": httpMethod,
|
|
202
|
+
"headers": {
|
|
203
|
+
"Accept": "application/json",
|
|
204
|
+
"Content-Type": "application/json"
|
|
205
|
+
},
|
|
206
|
+
"body": JSON.stringify(data)
|
|
207
|
+
})];
|
|
208
|
+
case 1:
|
|
209
|
+
res = _a.sent();
|
|
210
|
+
if (res.ok === false)
|
|
211
|
+
throw new Error("".concat(res.status, ": ").concat(res.statusText));
|
|
212
|
+
return [4 /*yield*/, res.json()];
|
|
213
|
+
case 2:
|
|
214
|
+
result = _a.sent();
|
|
215
|
+
return [2 /*return*/, (result)];
|
|
216
|
+
case 3:
|
|
217
|
+
ex_1 = _a.sent();
|
|
218
|
+
return [2 /*return*/, (JSON.stringify({ "error": "".concat(ex_1.message, " - Could not fetch ").concat(url) }))];
|
|
219
|
+
case 4: return [2 /*return*/];
|
|
220
|
+
}
|
|
221
|
+
});
|
|
222
|
+
});
|
|
223
|
+
};
|
|
224
|
+
/**
|
|
225
|
+
* Make a HTTP request. This is basically just a wrapper for fetch.
|
|
226
|
+
*
|
|
227
|
+
* @param url The full url to make the HTTP call.
|
|
228
|
+
* @param requestInit The request parameters to send.
|
|
229
|
+
*
|
|
230
|
+
* @returns The HTTP response.
|
|
231
|
+
*/
|
|
232
|
+
Hot.httpRequest = function (url, requestInit) {
|
|
233
|
+
if (requestInit === void 0) { requestInit = undefined; }
|
|
234
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
235
|
+
var res;
|
|
236
|
+
return __generator(this, function (_a) {
|
|
237
|
+
switch (_a.label) {
|
|
238
|
+
case 0: return [4 /*yield*/, (0, cross_fetch_1.default)(url, requestInit)];
|
|
239
|
+
case 1:
|
|
240
|
+
res = _a.sent();
|
|
241
|
+
return [2 /*return*/, (res)];
|
|
242
|
+
}
|
|
243
|
+
});
|
|
244
|
+
});
|
|
245
|
+
};
|
|
246
|
+
/**
|
|
247
|
+
* Echo out some output.
|
|
248
|
+
*/
|
|
249
|
+
Hot.echo = function (message) {
|
|
250
|
+
Hot.Output += message;
|
|
251
|
+
};
|
|
252
|
+
/**
|
|
253
|
+
* Echo out the CSS for the current page being generated.
|
|
254
|
+
*/
|
|
255
|
+
Hot.displayCSS = function () {
|
|
256
|
+
for (var iIdx = 0; iIdx < Hot.CSS.length; iIdx++) {
|
|
257
|
+
var cssFile = Hot.CSS[iIdx];
|
|
258
|
+
var cssOut = Hot.cssStr;
|
|
259
|
+
cssOut = cssOut.replace(/\%CSS_FILE\%/g, cssFile);
|
|
260
|
+
Hot.echo(cssOut);
|
|
261
|
+
}
|
|
262
|
+
};
|
|
263
|
+
/**
|
|
264
|
+
* Echo out the JS files for the current page being generated.
|
|
265
|
+
*/
|
|
266
|
+
Hot.displayJSFiles = function () {
|
|
267
|
+
for (var iIdx = 0; iIdx < Hot.JSFiles.length; iIdx++) {
|
|
268
|
+
var jsFile = Hot.JSFiles[iIdx];
|
|
269
|
+
var jsFileOut = Hot.jsFileStr;
|
|
270
|
+
jsFileOut = jsFileOut.replace(/\%JS_FILE\%/g, jsFile);
|
|
271
|
+
Hot.echo(jsFileOut);
|
|
272
|
+
}
|
|
273
|
+
};
|
|
274
|
+
/**
|
|
275
|
+
* Echo out the JS scripts for the current page being generated.
|
|
276
|
+
*/
|
|
277
|
+
Hot.displayJSScripts = function () {
|
|
278
|
+
for (var iIdx = 0; iIdx < Hot.JSScripts.length; iIdx++) {
|
|
279
|
+
var jsScript = Hot.JSScripts[iIdx];
|
|
280
|
+
var jsScriptOut = Hot.jsScriptsStr;
|
|
281
|
+
jsScriptOut = jsScriptOut.replace(/\%JS_CODE\%/g, jsScript);
|
|
282
|
+
Hot.echo(jsScriptOut);
|
|
283
|
+
}
|
|
284
|
+
};
|
|
285
|
+
/**
|
|
286
|
+
* The currently generated page being displayed. This is cleared between every file processed.
|
|
287
|
+
*/
|
|
288
|
+
Hot.CurrentPage = null;
|
|
289
|
+
/**
|
|
290
|
+
* The arguments passed.
|
|
291
|
+
*/
|
|
292
|
+
Hot.Arguments = null;
|
|
293
|
+
/**
|
|
294
|
+
* The mode in which this application is running. If it's set to development mode, all testing
|
|
295
|
+
* related data will be collected, parsed, and executed if necessary.
|
|
296
|
+
*/
|
|
297
|
+
Hot.DeveloperMode = DeveloperMode;
|
|
298
|
+
/**
|
|
299
|
+
* The mode in which this application is running. If it's set to development mode, all testing
|
|
300
|
+
* related data will be collected, parsed, and executed if necessary.
|
|
301
|
+
*/
|
|
302
|
+
Hot.HotTestElement = HotTestElement_1.HotTestElement;
|
|
303
|
+
/**
|
|
304
|
+
* The mode in which this application is running. If it's set to development mode, all testing
|
|
305
|
+
* related data will be collected, parsed, and executed if necessary.
|
|
306
|
+
*/
|
|
307
|
+
Hot.Mode = DeveloperMode.Production;
|
|
308
|
+
/**
|
|
309
|
+
*The current API used on this page. This is cleared between every file processed.
|
|
310
|
+
*/
|
|
311
|
+
Hot.API = null;
|
|
312
|
+
/**
|
|
313
|
+
* The API being used by the tester.
|
|
314
|
+
*/
|
|
315
|
+
Hot.TesterAPI = null;
|
|
316
|
+
/**
|
|
317
|
+
* Contains the buffer to output. This is cleared between every file processed.
|
|
318
|
+
*/
|
|
319
|
+
Hot.Output = "";
|
|
320
|
+
/**
|
|
321
|
+
* The data to share across all the different files and pages. This data will be public.
|
|
322
|
+
*/
|
|
323
|
+
Hot.Data = {};
|
|
324
|
+
/**
|
|
325
|
+
* The cookies to use between pages.
|
|
326
|
+
*/
|
|
327
|
+
Hot.Cookies = js_cookie_1.default;
|
|
328
|
+
/**
|
|
329
|
+
* Any secrets that can be shown publicly. These can be passed from HotSite.json.
|
|
330
|
+
*/
|
|
331
|
+
Hot.PublicSecrets = {};
|
|
332
|
+
/**
|
|
333
|
+
* The CSS string to use when echoing out the CSS files.
|
|
334
|
+
*/
|
|
335
|
+
Hot.cssStr = "<link rel = \"stylesheet\" href = \"%CSS_FILE%\" />";
|
|
336
|
+
/**
|
|
337
|
+
* The CSS files to use in the current page being generated.
|
|
338
|
+
*
|
|
339
|
+
* @todo Make this a "string | CSSObject" data type so it can also include
|
|
340
|
+
* the integrity hashes as well.
|
|
341
|
+
*/
|
|
342
|
+
Hot.CSS = [];
|
|
343
|
+
/**
|
|
344
|
+
* The JavaScript files to use in the current page being generated.
|
|
345
|
+
*
|
|
346
|
+
* @todo Make this a "string | JSFileObject" data type so it can also include
|
|
347
|
+
* the integrity hashes as well.
|
|
348
|
+
*/
|
|
349
|
+
Hot.JSFiles = [];
|
|
350
|
+
/**
|
|
351
|
+
* The JavaScript inline code to use in the current page being generated.
|
|
352
|
+
*/
|
|
353
|
+
Hot.JSScripts = [];
|
|
354
|
+
/**
|
|
355
|
+
* The JavaScript string to use when echoing out the Scripts files.
|
|
356
|
+
*/
|
|
357
|
+
Hot.jsFileStr = "<script type = \"text/javascript\" src = \"%JS_FILE%\"></script>";
|
|
358
|
+
/**
|
|
359
|
+
* The JavaScript string to use when echoing out the Scripts files.
|
|
360
|
+
*/
|
|
361
|
+
Hot.jsScriptsStr = "<script type = \"text/javascript\">%JS_CODE%</script>";
|
|
362
|
+
return Hot;
|
|
363
|
+
}());
|
|
364
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