5htp 0.4.6 → 0.5.9
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/{src/app → app}/config.ts +7 -7
- package/app/index.ts +196 -0
- package/{src/commands → commands}/dev.ts +2 -2
- package/{src/commands → commands}/init.ts +1 -1
- package/{src/compiler → compiler}/client/identite.ts +1 -1
- package/{src/compiler → compiler}/client/index.ts +6 -6
- package/{src/compiler → compiler}/common/babel/index.ts +20 -2
- package/{src/compiler → compiler}/common/babel/plugins/injection-dependances/index.ts +2 -2
- package/{src/compiler → compiler}/common/babel/plugins/queries/index.ts +1 -1
- package/compiler/common/babel/plugins/services.ts +247 -0
- package/{src/compiler → compiler}/common/babel/routes/imports.ts +1 -1
- package/{src/compiler → compiler}/common/babel/routes/routes.ts +148 -39
- package/{src/compiler → compiler}/common/files/style.ts +3 -3
- package/{src/compiler → compiler}/common/plugins/indexage/icones-svg/index.ts +2 -2
- package/{src/compiler → compiler}/index.ts +150 -37
- package/{src/compiler → compiler}/server/index.ts +18 -11
- package/package.json +7 -5
- package/{src/paths.ts → paths.ts} +3 -4
- package/tsconfig.json +3 -2
- package/src/app/index.ts +0 -111
- package/src/compiler/common/babel/plugins/services.ts +0 -209
- /package/{src/commands → commands}/build.ts +0 -0
- /package/{src/commands → commands}/deploy/app.ts +0 -0
- /package/{src/commands → commands}/deploy/web.ts +0 -0
- /package/{src/compiler → compiler}/common/babel/plugins/form.ts +0 -0
- /package/{src/compiler → compiler}/common/babel/plugins/icones-svg.ts +0 -0
- /package/{src/compiler → compiler}/common/babel/plugins/index.ts +0 -0
- /package/{src/compiler → compiler}/common/babel/plugins/injection-dependances/remplacerFonction.ts +0 -0
- /package/{src/compiler → compiler}/common/files/autres.ts +0 -0
- /package/{src/compiler → compiler}/common/files/images.ts +0 -0
- /package/{src/compiler → compiler}/common/index.ts +0 -0
- /package/{src/compiler → compiler}/common/plugins/indexage/_utils/Stringify.ts +0 -0
- /package/{src/compiler → compiler}/common/plugins/indexage/_utils/annotations.ts +0 -0
- /package/{src/compiler → compiler}/common/plugins/indexage/_utils/iterateur.ts +0 -0
- /package/{src/compiler → compiler}/common/plugins/indexage/index.ts +0 -0
- /package/{src/compiler → compiler}/common/plugins/indexage/indexeur.ts +0 -0
- /package/{src/compiler → compiler}/common/plugins/indexage/injection-dependances/index.ts +0 -0
- /package/{src/index.ts → index.ts} +0 -0
- /package/{src/print.ts → print.ts} +0 -0
- /package/{src/utils → utils}/index.ts +0 -0
- /package/{src/utils → utils}/keyboard.ts +0 -0
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "5htp",
|
|
3
3
|
"description": "Convenient TypeScript framework designed for Performance and Productivity.",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.5.9",
|
|
5
5
|
"author": "Gaetan Le Gac (https://github.com/gaetanlegac)",
|
|
6
6
|
"repository": "git://github.com/gaetanlegac/5htp.git",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"bin": {
|
|
9
|
-
"5htp": "
|
|
9
|
+
"5htp": "index.ts"
|
|
10
10
|
},
|
|
11
11
|
"engines": {
|
|
12
12
|
"node": ">=16.1.0",
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"@babel/cli": "^7.15.4",
|
|
20
20
|
"@babel/plugin-proposal-class-properties": "^7.14.5",
|
|
21
|
+
"@babel/plugin-proposal-decorators": "^7.25.9",
|
|
21
22
|
"@babel/plugin-proposal-private-methods": "^7.14.5",
|
|
22
23
|
"@babel/plugin-proposal-private-property-in-object": "^7.15.4",
|
|
23
24
|
"@babel/plugin-transform-react-constant-elements": "^7.14.5",
|
|
@@ -39,6 +40,7 @@
|
|
|
39
40
|
"@types/universal-analytics": "^0.4.5",
|
|
40
41
|
"@types/webpack-env": "^1.16.2",
|
|
41
42
|
"@types/ws": "^7.4.7",
|
|
43
|
+
"babel-loader": "^10.0.0",
|
|
42
44
|
"babel-plugin-glob-import": "^0.0.9-1",
|
|
43
45
|
"babel-plugin-transform-imports": "^2.0.0",
|
|
44
46
|
"babel-plugin-transform-react-remove-prop-types": "^0.4.24",
|
|
@@ -50,7 +52,7 @@
|
|
|
50
52
|
"css-loader": "^6.2.0",
|
|
51
53
|
"css-minimizer-webpack-plugin": "^4.1.0",
|
|
52
54
|
"dayjs": "^1.11.5",
|
|
53
|
-
"favicons": "^
|
|
55
|
+
"favicons": "^7.2.0",
|
|
54
56
|
"filesize": "^8.0.3",
|
|
55
57
|
"image-minimizer-webpack-plugin": "^2.2.0",
|
|
56
58
|
"imagemin": "^8.0.1",
|
|
@@ -68,6 +70,7 @@
|
|
|
68
70
|
"prompts": "^2.4.2",
|
|
69
71
|
"react-dev-utils": "^11.0.4",
|
|
70
72
|
"replace-once": "^1.0.0",
|
|
73
|
+
"serialize-javascript": "^6.0.2",
|
|
71
74
|
"speed-measure-webpack-plugin": "^1.5.0",
|
|
72
75
|
"terser-webpack-plugin": "^5.2.4",
|
|
73
76
|
"ts-alias": "^0.0.7",
|
|
@@ -88,7 +91,6 @@
|
|
|
88
91
|
"@types/node": "^16.9.1",
|
|
89
92
|
"@types/nodemailer": "^6.4.4",
|
|
90
93
|
"@types/prompts": "^2.0.14",
|
|
91
|
-
"@types/webpack-env": "^1.16.2"
|
|
92
|
-
"babel-loader": "^10.0.0"
|
|
94
|
+
"@types/webpack-env": "^1.16.2"
|
|
93
95
|
}
|
|
94
96
|
}
|
|
@@ -64,10 +64,9 @@ export default class Paths {
|
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
public core = {
|
|
67
|
-
cli: path.resolve(__dirname, '
|
|
67
|
+
cli: path.resolve(__dirname, '.'),
|
|
68
68
|
root: this.coreRoot,
|
|
69
|
-
|
|
70
|
-
pages: this.coreRoot + '/src/client/pages',
|
|
69
|
+
pages: this.coreRoot + '/client/pages',
|
|
71
70
|
}
|
|
72
71
|
|
|
73
72
|
/*----------------------------------
|
|
@@ -149,7 +148,7 @@ export default class Paths {
|
|
|
149
148
|
rootDir: this.core.cli
|
|
150
149
|
});
|
|
151
150
|
|
|
152
|
-
|
|
151
|
+
console.log('Applying Aliases ...', aliases.forModuleAlias());
|
|
153
152
|
moduleAlias.addAliases( aliases.forModuleAlias() );
|
|
154
153
|
|
|
155
154
|
}
|
package/tsconfig.json
CHANGED
|
@@ -20,11 +20,12 @@
|
|
|
20
20
|
"strictPropertyInitialization": true,
|
|
21
21
|
"strictNullChecks": true,
|
|
22
22
|
|
|
23
|
-
"baseUrl": "./
|
|
23
|
+
"baseUrl": "./",
|
|
24
24
|
"outDir": "./bin",
|
|
25
25
|
|
|
26
26
|
"paths": {
|
|
27
27
|
"@cli/*": [ "./*" ],
|
|
28
|
+
"@cli/app": [ "./app" ],
|
|
28
29
|
"@cli": [ "./" ]
|
|
29
30
|
},
|
|
30
31
|
},
|
|
@@ -33,5 +34,5 @@
|
|
|
33
34
|
"transpileOnly": true,
|
|
34
35
|
},
|
|
35
36
|
|
|
36
|
-
"include": ["./
|
|
37
|
+
"include": ["./"]
|
|
37
38
|
}
|
package/src/app/index.ts
DELETED
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
/*----------------------------------
|
|
2
|
-
- DEPENDANCES
|
|
3
|
-
----------------------------------*/
|
|
4
|
-
|
|
5
|
-
// npm
|
|
6
|
-
import path from 'path';
|
|
7
|
-
import TsAlias from 'ts-alias';
|
|
8
|
-
import fs from 'fs-extra';
|
|
9
|
-
|
|
10
|
-
// Cre
|
|
11
|
-
import cli from '..';
|
|
12
|
-
|
|
13
|
-
// Specific
|
|
14
|
-
import ConfigParser from './config';
|
|
15
|
-
import type { TEnvConfig } from '../../../core/src/server/app/container/config';
|
|
16
|
-
|
|
17
|
-
/*----------------------------------
|
|
18
|
-
- TYPES
|
|
19
|
-
----------------------------------*/
|
|
20
|
-
|
|
21
|
-
export type TAppSide = 'server' | 'client'
|
|
22
|
-
|
|
23
|
-
/*----------------------------------
|
|
24
|
-
- SERVICE
|
|
25
|
-
----------------------------------*/
|
|
26
|
-
export class App {
|
|
27
|
-
|
|
28
|
-
// config
|
|
29
|
-
// WARNING: High level config files (env and services) shouldn't be loaded from the CLI
|
|
30
|
-
// The CLI will be run on CircleCI, and no env file should be sent to this service
|
|
31
|
-
public identity: Config.Identity;
|
|
32
|
-
|
|
33
|
-
public env: TEnvConfig;
|
|
34
|
-
|
|
35
|
-
public packageJson: {[key: string]: any};
|
|
36
|
-
|
|
37
|
-
public paths = {
|
|
38
|
-
|
|
39
|
-
root: cli.paths.appRoot,
|
|
40
|
-
src: path.join( cli.paths.appRoot, 'src'),
|
|
41
|
-
bin: path.join( cli.paths.appRoot, 'bin'),
|
|
42
|
-
data: path.join( cli.paths.appRoot, 'var', 'data'),
|
|
43
|
-
public: path.join( cli.paths.appRoot, 'public'),
|
|
44
|
-
pages: path.join( cli.paths.appRoot, 'src', 'client', 'pages'),
|
|
45
|
-
cache: path.join( cli.paths.appRoot, 'src', '.cache'),
|
|
46
|
-
|
|
47
|
-
client: {
|
|
48
|
-
generated: path.join( cli.paths.appRoot, 'src', 'client', '.generated')
|
|
49
|
-
},
|
|
50
|
-
server: {
|
|
51
|
-
generated: path.join( cli.paths.appRoot, 'src', 'server', '.generated'),
|
|
52
|
-
configs: path.join( cli.paths.appRoot, 'src', 'server', 'app')
|
|
53
|
-
},
|
|
54
|
-
|
|
55
|
-
withAlias: (filename: string, side: TAppSide) =>
|
|
56
|
-
this.aliases[side].apply(filename),
|
|
57
|
-
|
|
58
|
-
withoutAlias: (filename: string, side: TAppSide) =>
|
|
59
|
-
this.aliases[side].realpath(filename),
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
public containerServices = [
|
|
63
|
-
'Services',
|
|
64
|
-
'Environment',
|
|
65
|
-
'Identity',
|
|
66
|
-
/*'Application',
|
|
67
|
-
'Path',
|
|
68
|
-
'Event'*/
|
|
69
|
-
]
|
|
70
|
-
|
|
71
|
-
public constructor() {
|
|
72
|
-
|
|
73
|
-
cli.debug && console.log(`[cli] Loading app config ...`);
|
|
74
|
-
const configParser = new ConfigParser( cli.paths.appRoot );
|
|
75
|
-
this.identity = configParser.identity();
|
|
76
|
-
this.env = configParser.env();
|
|
77
|
-
this.packageJson = this.loadPkg();
|
|
78
|
-
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
/*----------------------------------
|
|
82
|
-
- ALIAS
|
|
83
|
-
----------------------------------*/
|
|
84
|
-
|
|
85
|
-
public aliases = {
|
|
86
|
-
client: new TsAlias({
|
|
87
|
-
rootDir: this.paths.root + '/src/client',
|
|
88
|
-
modulesDir: [
|
|
89
|
-
cli.paths.appRoot + '/node_modules',
|
|
90
|
-
cli.paths.coreRoot + '/node_modules'
|
|
91
|
-
],
|
|
92
|
-
debug: false
|
|
93
|
-
}),
|
|
94
|
-
server: new TsAlias({
|
|
95
|
-
rootDir: this.paths.root + '/src/server',
|
|
96
|
-
modulesDir: [
|
|
97
|
-
cli.paths.appRoot + '/node_modules',
|
|
98
|
-
cli.paths.coreRoot + '/node_modules'
|
|
99
|
-
],
|
|
100
|
-
debug: false
|
|
101
|
-
}),
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
private loadPkg() {
|
|
105
|
-
return fs.readJSONSync(this.paths.root + '/package.json');
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
export const app = new App
|
|
110
|
-
|
|
111
|
-
export default app
|
|
@@ -1,209 +0,0 @@
|
|
|
1
|
-
/*----------------------------------
|
|
2
|
-
- DEPENDANCES
|
|
3
|
-
----------------------------------*/
|
|
4
|
-
|
|
5
|
-
// Npm
|
|
6
|
-
import * as types from '@babel/types'
|
|
7
|
-
import type { PluginObj } from '@babel/core';
|
|
8
|
-
|
|
9
|
-
// Core
|
|
10
|
-
import cli from '@cli';
|
|
11
|
-
import { App, TAppSide } from '../../../../app';
|
|
12
|
-
|
|
13
|
-
/*----------------------------------
|
|
14
|
-
- WEBPACK RULE
|
|
15
|
-
----------------------------------*/
|
|
16
|
-
|
|
17
|
-
type TOptions = {
|
|
18
|
-
side: TAppSide,
|
|
19
|
-
app: App,
|
|
20
|
-
debug?: boolean
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
type TImportSource = 'container' | 'application';
|
|
24
|
-
|
|
25
|
-
module.exports = (options: TOptions) => (
|
|
26
|
-
[Plugin, options]
|
|
27
|
-
)
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
/*----------------------------------
|
|
31
|
-
- PLUGIN
|
|
32
|
-
----------------------------------*/
|
|
33
|
-
function Plugin(babel, { app, side, debug }: TOptions) {
|
|
34
|
-
|
|
35
|
-
const t = babel.types as typeof types;
|
|
36
|
-
|
|
37
|
-
/*
|
|
38
|
-
Transforms:
|
|
39
|
-
import { MyService, Environment } from '@app';
|
|
40
|
-
...
|
|
41
|
-
MyService.method()
|
|
42
|
-
Environment.name
|
|
43
|
-
|
|
44
|
-
To:
|
|
45
|
-
import app from '@app';
|
|
46
|
-
import Container from '@server/app/container';
|
|
47
|
-
...
|
|
48
|
-
app.services.MyService.method()
|
|
49
|
-
Container.Environment.name
|
|
50
|
-
|
|
51
|
-
Processed files:
|
|
52
|
-
@/server/config
|
|
53
|
-
@/server/routes
|
|
54
|
-
@/server/services
|
|
55
|
-
*/
|
|
56
|
-
|
|
57
|
-
const plugin: PluginObj<{
|
|
58
|
-
|
|
59
|
-
debug: boolean,
|
|
60
|
-
|
|
61
|
-
filename: string,
|
|
62
|
-
processFile: boolean,
|
|
63
|
-
|
|
64
|
-
// Identifier => Name
|
|
65
|
-
importedServicesCount: number,
|
|
66
|
-
importedServices: {
|
|
67
|
-
[local: string]: {
|
|
68
|
-
imported: string,
|
|
69
|
-
bindings: any, // TODO: Scope.Binding[] type
|
|
70
|
-
source: TImportSource
|
|
71
|
-
}
|
|
72
|
-
},
|
|
73
|
-
bySource: {[importSource in TImportSource] : number}
|
|
74
|
-
}> = {
|
|
75
|
-
pre(state) {
|
|
76
|
-
|
|
77
|
-
this.filename = state.opts.filename as string;
|
|
78
|
-
this.processFile = (
|
|
79
|
-
this.filename.startsWith( cli.paths.appRoot + '/src/server/config' )
|
|
80
|
-
||
|
|
81
|
-
this.filename.startsWith( cli.paths.appRoot + '/src/server/routes' )
|
|
82
|
-
||
|
|
83
|
-
this.filename.startsWith( cli.paths.appRoot + '/src/server/services' )
|
|
84
|
-
)
|
|
85
|
-
|
|
86
|
-
this.importedServices = {}
|
|
87
|
-
this.bySource = {
|
|
88
|
-
container: 0,
|
|
89
|
-
application: 0
|
|
90
|
-
}
|
|
91
|
-
this.importedServicesCount = 0
|
|
92
|
-
this.debug = debug || false;
|
|
93
|
-
|
|
94
|
-
},
|
|
95
|
-
visitor: {
|
|
96
|
-
|
|
97
|
-
// Find @app imports
|
|
98
|
-
// Test: import { router } from '@app';
|
|
99
|
-
// Replace by: nothing
|
|
100
|
-
ImportDeclaration(path) {
|
|
101
|
-
|
|
102
|
-
if (!this.processFile)
|
|
103
|
-
return;
|
|
104
|
-
|
|
105
|
-
if (path.node.source.value !== '@app')
|
|
106
|
-
return;
|
|
107
|
-
|
|
108
|
-
for (const specifier of path.node.specifiers) {
|
|
109
|
-
|
|
110
|
-
if (specifier.type !== 'ImportSpecifier')
|
|
111
|
-
continue;
|
|
112
|
-
|
|
113
|
-
if (specifier.imported.type !== 'Identifier')
|
|
114
|
-
continue;
|
|
115
|
-
|
|
116
|
-
this.importedServicesCount++;
|
|
117
|
-
|
|
118
|
-
let importSource: TImportSource;
|
|
119
|
-
if (app.containerServices.includes(specifier.imported.name))
|
|
120
|
-
importSource = 'container';
|
|
121
|
-
else
|
|
122
|
-
importSource = 'application';
|
|
123
|
-
|
|
124
|
-
this.importedServices[ specifier.local.name ] = {
|
|
125
|
-
imported: specifier.imported.name,
|
|
126
|
-
bindings: path.scope.bindings[ specifier.local.name ].referencePaths,
|
|
127
|
-
source: importSource
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
this.bySource[ importSource ]++;
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
// Replace by simple import
|
|
134
|
-
this.debug && console.log("[babel][services] Replace importation");
|
|
135
|
-
const replaceWith: any[] = []
|
|
136
|
-
|
|
137
|
-
if (this.bySource.container > 0)
|
|
138
|
-
replaceWith.push(
|
|
139
|
-
t.importDeclaration(
|
|
140
|
-
[t.importDefaultSpecifier( t.identifier('container') )],
|
|
141
|
-
t.stringLiteral( cli.paths.core.src + '/server/app/container')
|
|
142
|
-
)
|
|
143
|
-
);
|
|
144
|
-
|
|
145
|
-
// NOTE: Update 20/07: services should be accessed through current service instance
|
|
146
|
-
/*if (this.bySource.application > 0)
|
|
147
|
-
replaceWith.push(
|
|
148
|
-
t.importDeclaration(
|
|
149
|
-
[t.importDefaultSpecifier( t.identifier('application') )],
|
|
150
|
-
t.stringLiteral( cli.paths.core.src + '/server/app/instance')
|
|
151
|
-
)
|
|
152
|
-
);*/
|
|
153
|
-
|
|
154
|
-
path.replaceWithMultiple(replaceWith);
|
|
155
|
-
},
|
|
156
|
-
|
|
157
|
-
Identifier(path) {
|
|
158
|
-
|
|
159
|
-
if (!this.processFile || this.importedServicesCount === 0)
|
|
160
|
-
return;
|
|
161
|
-
|
|
162
|
-
// Get service the identifier makes rfeerence to
|
|
163
|
-
const name = path.node.name;
|
|
164
|
-
const service = this.importedServices[ name ];
|
|
165
|
-
if (service === undefined)
|
|
166
|
-
return;
|
|
167
|
-
|
|
168
|
-
// sometimes not iterable
|
|
169
|
-
if (!service.bindings)
|
|
170
|
-
return;
|
|
171
|
-
|
|
172
|
-
// Replace by app.services.name
|
|
173
|
-
let serviceBinding: any;
|
|
174
|
-
for (const binding of service.bindings) {
|
|
175
|
-
if (binding.replaced !== true && path.getPathLocation() === binding.getPathLocation()) {
|
|
176
|
-
|
|
177
|
-
serviceBinding = binding;
|
|
178
|
-
|
|
179
|
-
break;
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
// This identifier is a binding to a service
|
|
184
|
-
if (serviceBinding === undefined)
|
|
185
|
-
return;
|
|
186
|
-
|
|
187
|
-
// Replace to reference to app.services.serviceName
|
|
188
|
-
path.replaceWith(
|
|
189
|
-
t.memberExpression(
|
|
190
|
-
service.source === 'container'
|
|
191
|
-
// container.Environment
|
|
192
|
-
? t.identifier( service.source )
|
|
193
|
-
// application.services.Disks
|
|
194
|
-
: t.memberExpression(
|
|
195
|
-
t.identifier('this'),
|
|
196
|
-
t.identifier('app'),
|
|
197
|
-
),
|
|
198
|
-
path.node
|
|
199
|
-
)
|
|
200
|
-
);
|
|
201
|
-
|
|
202
|
-
// Avoid circular loop
|
|
203
|
-
serviceBinding.replaced = true;
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
return plugin;
|
|
209
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/{src/compiler → compiler}/common/babel/plugins/injection-dependances/remplacerFonction.ts
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|