proteum 1.0.0 → 1.0.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/AGENTS.md +9 -0
- package/cli/app/config.ts +61 -0
- package/cli/app/index.ts +227 -0
- package/cli/bin.js +35 -0
- package/cli/commands/build.ts +60 -0
- package/cli/commands/deploy/app.ts +29 -0
- package/cli/commands/deploy/web.ts +60 -0
- package/cli/commands/dev.ts +124 -0
- package/cli/commands/init.ts +85 -0
- package/cli/commands/refresh.ts +18 -0
- package/cli/compiler/client/identite.ts +69 -0
- package/cli/compiler/client/index.ts +343 -0
- package/cli/compiler/common/babel/index.ts +173 -0
- package/cli/compiler/common/babel/plugins/index.ts +0 -0
- package/cli/compiler/common/babel/plugins/services.ts +586 -0
- package/cli/compiler/common/babel/routes/imports.ts +127 -0
- package/cli/compiler/common/babel/routes/routes.ts +1170 -0
- package/cli/compiler/common/files/autres.ts +39 -0
- package/cli/compiler/common/files/images.ts +42 -0
- package/cli/compiler/common/files/style.ts +82 -0
- package/cli/compiler/common/index.ts +165 -0
- package/cli/compiler/index.ts +585 -0
- package/cli/compiler/server/index.ts +220 -0
- package/cli/index.ts +213 -0
- package/cli/paths.ts +165 -0
- package/cli/print.ts +12 -0
- package/cli/tsconfig.json +42 -0
- package/cli/utils/index.ts +22 -0
- package/cli/utils/keyboard.ts +78 -0
- package/client/app/index.ts +2 -0
- package/client/components/Dialog/Manager.tsx +3 -49
- package/client/components/Dialog/index.less +3 -1
- package/client/components/index.ts +1 -2
- package/client/services/router/index.tsx +6 -16
- package/common/errors/index.tsx +12 -31
- package/package.json +58 -22
- package/server/app/container/config.ts +20 -1
- package/server/app/container/console/index.ts +1 -1
- package/server/services/auth/index.ts +62 -27
- package/server/services/auth/router/request.ts +17 -6
- package/server/services/router/http/index.ts +3 -3
- package/server/services/router/response/index.ts +1 -1
- package/server/services/schema/request.ts +28 -10
- package/server/utils/slug.ts +0 -3
- package/tsconfig.common.json +2 -1
- package/types/global/constants.d.ts +12 -0
- package/changelog.md +0 -5
- package/client/components/Button.tsx +0 -298
- package/client/components/Dialog/card.tsx +0 -208
- package/client/data/input.ts +0 -32
- package/client/pages/bug.tsx.old +0 -60
- package/templates/composant.tsx +0 -40
- package/templates/form.ts +0 -30
- package/templates/modal.tsx +0 -47
- package/templates/modele.ts +0 -56
- package/templates/page.tsx +0 -74
- package/templates/route.ts +0 -43
- package/templates/service.ts +0 -75
- package/vscode/copyimportationpath/.eslintrc.json +0 -24
- package/vscode/copyimportationpath/.vscodeignore +0 -12
- package/vscode/copyimportationpath/CHANGELOG.md +0 -9
- package/vscode/copyimportationpath/README.md +0 -3
- package/vscode/copyimportationpath/copyimportationpath-0.0.1.vsix +0 -0
- package/vscode/copyimportationpath/out/extension.js +0 -206
- package/vscode/copyimportationpath/out/extension.js.map +0 -1
- package/vscode/copyimportationpath/package-lock.json +0 -4536
- package/vscode/copyimportationpath/package.json +0 -86
- package/vscode/copyimportationpath/src/extension.ts +0 -300
- package/vscode/copyimportationpath/tsconfig.json +0 -22
- package/vscode/copyimportationpath/vsc-extension-quickstart.md +0 -42
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
/*----------------------------------
|
|
2
|
+
- DEPENDANCES
|
|
3
|
+
----------------------------------*/
|
|
4
|
+
|
|
5
|
+
// Npm
|
|
6
|
+
import type { ImportTransformer } from 'babel-plugin-glob-import';
|
|
7
|
+
import * as types from '@babel/types'
|
|
8
|
+
import path from 'path';
|
|
9
|
+
import generate from '@babel/generator';
|
|
10
|
+
|
|
11
|
+
// Core
|
|
12
|
+
import cli from '@cli';
|
|
13
|
+
import type { TAppSide, default as App } from '@cli/app';
|
|
14
|
+
|
|
15
|
+
// Resources
|
|
16
|
+
const routesToPreload = require( cli.paths.appRoot + '/client/pages/preload.json' );
|
|
17
|
+
|
|
18
|
+
/*----------------------------------
|
|
19
|
+
- CONFIG
|
|
20
|
+
----------------------------------*/
|
|
21
|
+
|
|
22
|
+
const alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
|
23
|
+
|
|
24
|
+
/*----------------------------------
|
|
25
|
+
- TRANSFORMER
|
|
26
|
+
----------------------------------*/
|
|
27
|
+
|
|
28
|
+
module.exports = (app: App, side: TAppSide, dev: boolean): ImportTransformer => ({
|
|
29
|
+
|
|
30
|
+
debug: false,
|
|
31
|
+
|
|
32
|
+
test: (request) => (
|
|
33
|
+
side === 'client'
|
|
34
|
+
&&
|
|
35
|
+
(
|
|
36
|
+
request.source === '@client/pages/**/([a-z0-9]*).tsx'
|
|
37
|
+
||
|
|
38
|
+
request.source === '@/client/pages/**/([a-z0-9]*).tsx'
|
|
39
|
+
)
|
|
40
|
+
&&
|
|
41
|
+
request.type === 'import'
|
|
42
|
+
),
|
|
43
|
+
replace: (request, matches, t) => {
|
|
44
|
+
|
|
45
|
+
if (request.imported.type !== 'all')
|
|
46
|
+
return;
|
|
47
|
+
|
|
48
|
+
const imports: types.ImportDeclaration[] = [];
|
|
49
|
+
|
|
50
|
+
// const routes = {
|
|
51
|
+
// <chunkId1>: () => import(/* webpackChunkName: '<chunkId>' */ "<file>"),
|
|
52
|
+
// <chunkId2>: () => require("<file>").default,
|
|
53
|
+
// }
|
|
54
|
+
|
|
55
|
+
const pageLoaders: types.ObjectProperty[] = [];
|
|
56
|
+
for (const file of matches) {
|
|
57
|
+
|
|
58
|
+
// Exclude layouts
|
|
59
|
+
if (file.filename.includes("/_layout/")) {
|
|
60
|
+
//console.log("Exclude", file, 'from pages loaders (its a layout)');
|
|
61
|
+
continue;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// Page config
|
|
65
|
+
const { chunkId } = cli.paths.getPageChunk(app, file.filename);
|
|
66
|
+
const preloadPage = routesToPreload.includes(chunkId);
|
|
67
|
+
|
|
68
|
+
// Preload = use sync import
|
|
69
|
+
if (preloadPage) {
|
|
70
|
+
|
|
71
|
+
// import <chunkId> from "<file>";
|
|
72
|
+
imports.push(
|
|
73
|
+
t.importDeclaration(
|
|
74
|
+
[t.importSpecifier(
|
|
75
|
+
t.identifier(chunkId),
|
|
76
|
+
t.identifier('__register'),
|
|
77
|
+
)],
|
|
78
|
+
t.stringLiteral(file.filename)
|
|
79
|
+
)
|
|
80
|
+
);
|
|
81
|
+
|
|
82
|
+
// { <chunkId>: <chunkId> }
|
|
83
|
+
pageLoaders.push(
|
|
84
|
+
t.objectProperty(
|
|
85
|
+
t.stringLiteral(chunkId),
|
|
86
|
+
t.identifier(chunkId)
|
|
87
|
+
)
|
|
88
|
+
);
|
|
89
|
+
|
|
90
|
+
// Otherwise, use async import + chunk name
|
|
91
|
+
} else {
|
|
92
|
+
|
|
93
|
+
// <chunkId>: () => ...
|
|
94
|
+
pageLoaders.push(
|
|
95
|
+
t.objectProperty(
|
|
96
|
+
|
|
97
|
+
t.stringLiteral(chunkId),
|
|
98
|
+
// () => import(/* webpackChunkName: '<chunkId>' */ "<file>")
|
|
99
|
+
t.arrowFunctionExpression([], t.callExpression(
|
|
100
|
+
|
|
101
|
+
t.import(), [t.addComment(
|
|
102
|
+
t.stringLiteral(file.filename),
|
|
103
|
+
"leading",
|
|
104
|
+
"webpackChunkName: '" + chunkId + "'"
|
|
105
|
+
)]
|
|
106
|
+
))
|
|
107
|
+
)
|
|
108
|
+
)
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/*console.log( generate(t.variableDeclaration("const", [t.variableDeclarator(
|
|
113
|
+
t.identifier(request.imported.name),
|
|
114
|
+
t.objectExpression(pageLoaders)
|
|
115
|
+
)])).code );*/
|
|
116
|
+
|
|
117
|
+
return [
|
|
118
|
+
...imports,
|
|
119
|
+
// const routes = { ... }
|
|
120
|
+
t.variableDeclaration("const", [t.variableDeclarator(
|
|
121
|
+
t.identifier(request.imported.name),
|
|
122
|
+
t.objectExpression(pageLoaders)
|
|
123
|
+
)])
|
|
124
|
+
]
|
|
125
|
+
|
|
126
|
+
}
|
|
127
|
+
})
|