5htp 0.2.2 → 0.2.3-1
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/package.json +2 -4
- package/skeleton/src/client/components/LoginModal.tsx +1 -1
- package/skeleton/src/client/pages/app/index.tsx +2 -2
- package/src/commands/dev.ts +0 -1
- package/src/compiler/client/index.ts +3 -1
- package/src/compiler/common/babel/index.ts +3 -6
- package/src/compiler/common/babel/routes/imports.ts +1 -1
- package/src/compiler/common/babel/routes/routes.ts +3 -3
- package/src/compiler/index.ts +3 -3
- package/src/compiler/server/index.ts +4 -2
- package/src/index.ts +1 -0
- package/src/paths.ts +2 -3
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "5htp",
|
|
3
3
|
"description": "Convenient TypeScript framework designed for Performance and Productivity.",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.3-1",
|
|
5
5
|
"author": "Gaetan Le Gac (https://github.com/gaetanlegac)",
|
|
6
6
|
"repository": "git://github.com/gaetanlegac/5htp.git",
|
|
7
7
|
"license": "MIT",
|
|
@@ -22,7 +22,6 @@
|
|
|
22
22
|
"@babel/plugin-proposal-private-methods": "^7.14.5",
|
|
23
23
|
"@babel/plugin-proposal-private-property-in-object": "^7.15.4",
|
|
24
24
|
"@babel/plugin-transform-react-constant-elements": "^7.14.5",
|
|
25
|
-
"@babel/plugin-transform-react-jsx-self": "^7.14.9",
|
|
26
25
|
"@babel/preset-env": "^7.15.6",
|
|
27
26
|
"@babel/preset-react": "^7.14.5",
|
|
28
27
|
"@babel/preset-typescript": "^7.15.0",
|
|
@@ -72,7 +71,7 @@
|
|
|
72
71
|
"replace-once": "^1.0.0",
|
|
73
72
|
"speed-measure-webpack-plugin": "^1.5.0",
|
|
74
73
|
"terser-webpack-plugin": "^5.2.4",
|
|
75
|
-
"ts-alias": "^0.0.
|
|
74
|
+
"ts-alias": "^0.0.7",
|
|
76
75
|
"ts-node": "^10.9.1",
|
|
77
76
|
"tslog": "^3.3.4",
|
|
78
77
|
"webfont": "^11.2.26",
|
|
@@ -85,7 +84,6 @@
|
|
|
85
84
|
"webpack-virtual-modules": "^0.4.3"
|
|
86
85
|
},
|
|
87
86
|
"devDependencies": {
|
|
88
|
-
"@babel/plugin-transform-react-jsx-source": "^7.19.6",
|
|
89
87
|
"@types/favicons": "^6.2.2",
|
|
90
88
|
"@types/fs-extra": "^9.0.12",
|
|
91
89
|
"@types/node": "^16.9.1",
|
|
@@ -22,7 +22,7 @@ route.page('/app', { }, ({}, { api }) => ({
|
|
|
22
22
|
|
|
23
23
|
// Get data from your API here
|
|
24
24
|
|
|
25
|
-
}), ({ }, { api,
|
|
25
|
+
}), ({ }, { api, router, user, socket }) => {
|
|
26
26
|
|
|
27
27
|
/*----------------------------------
|
|
28
28
|
- INIT
|
|
@@ -42,7 +42,7 @@ route.page('/app', { }, ({}, { api }) => ({
|
|
|
42
42
|
/*----------------------------------
|
|
43
43
|
- ACTIONS
|
|
44
44
|
----------------------------------*/
|
|
45
|
-
const logout = () => api.post('/auth/logout').then(() =>
|
|
45
|
+
const logout = () => api.post('/auth/logout').then(() => router.go('/'))
|
|
46
46
|
|
|
47
47
|
/*----------------------------------
|
|
48
48
|
- RENDER
|
package/src/commands/dev.ts
CHANGED
|
@@ -29,6 +29,8 @@ import cli from '../..';
|
|
|
29
29
|
// Type
|
|
30
30
|
import type App from '../../app';
|
|
31
31
|
|
|
32
|
+
const debug = false;
|
|
33
|
+
|
|
32
34
|
/*----------------------------------
|
|
33
35
|
- CONFIG
|
|
34
36
|
----------------------------------*/
|
|
@@ -59,7 +61,7 @@ export default function createCompiler( app: App, mode: TCompileMode ): webpack.
|
|
|
59
61
|
delete aliases["@server"];
|
|
60
62
|
delete aliases["@/server"];
|
|
61
63
|
|
|
62
|
-
console.log("client aliases", aliases);
|
|
64
|
+
debug && console.log("client aliases", aliases);
|
|
63
65
|
const config: webpack.Configuration = {
|
|
64
66
|
|
|
65
67
|
...commonConfig,
|
|
@@ -76,6 +76,7 @@ module.exports = (app: App, side: TAppSide, dev: boolean): webpack.RuleSetRule[]
|
|
|
76
76
|
// https://github.com/babel/babel/tree/master/packages/babel-preset-react
|
|
77
77
|
[require('@babel/preset-react'), {
|
|
78
78
|
//pragma: "h"
|
|
79
|
+
development: dev
|
|
79
80
|
}],
|
|
80
81
|
|
|
81
82
|
],
|
|
@@ -96,11 +97,7 @@ module.exports = (app: App, side: TAppSide, dev: boolean): webpack.RuleSetRule[]
|
|
|
96
97
|
...(dev ? [
|
|
97
98
|
|
|
98
99
|
...(side === 'client' ? [
|
|
99
|
-
|
|
100
|
-
[require("@babel/plugin-transform-react-jsx-source"), {}],
|
|
101
|
-
|
|
102
|
-
// HMR Preact avec support des hooks
|
|
103
|
-
//['@prefresh/babel-plugin'],
|
|
100
|
+
|
|
104
101
|
|
|
105
102
|
] : [])
|
|
106
103
|
|
|
@@ -127,7 +124,7 @@ module.exports = (app: App, side: TAppSide, dev: boolean): webpack.RuleSetRule[]
|
|
|
127
124
|
|
|
128
125
|
//require("./plugins/pages")({ side }),
|
|
129
126
|
|
|
130
|
-
require('./routes/routes')({ side, app }),
|
|
127
|
+
require('./routes/routes')({ side, app, debug: false }),
|
|
131
128
|
|
|
132
129
|
...(side === 'client' ? [] : [
|
|
133
130
|
|
|
@@ -17,19 +17,19 @@ import App, { TAppSide } from '../../../../app';
|
|
|
17
17
|
|
|
18
18
|
type TOptions = {
|
|
19
19
|
side: TAppSide,
|
|
20
|
-
app: App
|
|
20
|
+
app: App,
|
|
21
|
+
debug?: boolean
|
|
21
22
|
}
|
|
22
23
|
|
|
23
24
|
module.exports = (options: TOptions) => (
|
|
24
25
|
[Plugin, options]
|
|
25
26
|
)
|
|
26
27
|
|
|
27
|
-
const debug = true;
|
|
28
28
|
|
|
29
29
|
/*----------------------------------
|
|
30
30
|
- PLUGIN
|
|
31
31
|
----------------------------------*/
|
|
32
|
-
function Plugin(babel, { app, side }: TOptions) {
|
|
32
|
+
function Plugin(babel, { app, side, debug }: TOptions) {
|
|
33
33
|
|
|
34
34
|
const t = babel.types as typeof types;
|
|
35
35
|
|
package/src/compiler/index.ts
CHANGED
|
@@ -86,7 +86,7 @@ export default async function createCompilers(
|
|
|
86
86
|
compiling[name] = new Promise((resolve) => finished = resolve);
|
|
87
87
|
|
|
88
88
|
timeStart = new Date();
|
|
89
|
-
console.info(`[${name}]
|
|
89
|
+
console.info(`[${name}] Compiling ...`);
|
|
90
90
|
});
|
|
91
91
|
|
|
92
92
|
/* TODO: Ne pas résoudre la promise tant que la recompilation des données indexées (icones, identité, ...)
|
|
@@ -100,7 +100,7 @@ export default async function createCompilers(
|
|
|
100
100
|
const timeEnd = new Date();
|
|
101
101
|
const time = timeEnd.getTime() - timeStart.getTime();
|
|
102
102
|
if (stats.hasErrors()) {
|
|
103
|
-
console.error(
|
|
103
|
+
console.error(`[${name}] Failed to compile after ${time} ms`);
|
|
104
104
|
|
|
105
105
|
// Exit process with code 0, so the CI container can understand building failed
|
|
106
106
|
// Only in prod, because in dev, we want the compiler watcher continue running
|
|
@@ -108,7 +108,7 @@ export default async function createCompilers(
|
|
|
108
108
|
process.exit(0);
|
|
109
109
|
|
|
110
110
|
} else {
|
|
111
|
-
console.info(
|
|
111
|
+
console.info(`[${name}] Finished compilation after ${time} ms`);
|
|
112
112
|
}
|
|
113
113
|
|
|
114
114
|
// Mark as finished
|
|
@@ -34,12 +34,14 @@ const getCorePluginsList = (app: App,) => {
|
|
|
34
34
|
return corePlugins;
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
+
const debug = false;
|
|
38
|
+
|
|
37
39
|
/*----------------------------------
|
|
38
40
|
- CONFIG
|
|
39
41
|
----------------------------------*/
|
|
40
42
|
export default function createCompiler( app: App, mode: TCompileMode ): webpack.Configuration {
|
|
41
43
|
|
|
42
|
-
console.info(`Creating compiler for server (${mode}).`);
|
|
44
|
+
debug && console.info(`Creating compiler for server (${mode}).`);
|
|
43
45
|
const dev = mode === 'dev';
|
|
44
46
|
|
|
45
47
|
const commonConfig = createCommonConfig(app, 'server', mode);
|
|
@@ -51,7 +53,7 @@ export default function createCompiler( app: App, mode: TCompileMode ): webpack.
|
|
|
51
53
|
delete aliases["@client/services"];
|
|
52
54
|
delete aliases["@/client/services"];
|
|
53
55
|
|
|
54
|
-
console.log(`[${mode}] node_modules dirs:`, commonConfig.resolveLoader?.modules,
|
|
56
|
+
debug && console.log(`[${mode}] node_modules dirs:`, commonConfig.resolveLoader?.modules,
|
|
55
57
|
'\nModule aliases for webpack:', aliases);
|
|
56
58
|
const config: webpack.Configuration = {
|
|
57
59
|
|
package/src/index.ts
CHANGED
|
@@ -37,6 +37,7 @@ export class CLI {
|
|
|
37
37
|
public constructor(
|
|
38
38
|
public paths = new Paths( process.cwd() )
|
|
39
39
|
) {
|
|
40
|
+
console.log(`[cli] 5HTP CLI`, process.env.npm_package_version);
|
|
40
41
|
console.log(`[cli] Start debugger ...`);
|
|
41
42
|
new Logger({ name: "cli", overwriteConsole: true });
|
|
42
43
|
|
package/src/paths.ts
CHANGED
|
@@ -132,7 +132,7 @@ export default class Paths {
|
|
|
132
132
|
const filepath = infos.relative;
|
|
133
133
|
|
|
134
134
|
// Before: /home/.../src/client/pages/landing/index.tsx
|
|
135
|
-
// After:
|
|
135
|
+
// After: landing
|
|
136
136
|
let chunkId = filenameToImportName(filepath);
|
|
137
137
|
|
|
138
138
|
// nsure it's non-empty
|
|
@@ -149,8 +149,7 @@ export default class Paths {
|
|
|
149
149
|
rootDir: this.core.cli
|
|
150
150
|
});
|
|
151
151
|
|
|
152
|
-
console.log('Applying Aliases ...', aliases);
|
|
153
|
-
|
|
152
|
+
//console.log('Applying Aliases ...', aliases);
|
|
154
153
|
moduleAlias.addAliases( aliases.forModuleAlias() );
|
|
155
154
|
|
|
156
155
|
}
|