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.
Files changed (70) hide show
  1. package/AGENTS.md +9 -0
  2. package/cli/app/config.ts +61 -0
  3. package/cli/app/index.ts +227 -0
  4. package/cli/bin.js +35 -0
  5. package/cli/commands/build.ts +60 -0
  6. package/cli/commands/deploy/app.ts +29 -0
  7. package/cli/commands/deploy/web.ts +60 -0
  8. package/cli/commands/dev.ts +124 -0
  9. package/cli/commands/init.ts +85 -0
  10. package/cli/commands/refresh.ts +18 -0
  11. package/cli/compiler/client/identite.ts +69 -0
  12. package/cli/compiler/client/index.ts +343 -0
  13. package/cli/compiler/common/babel/index.ts +173 -0
  14. package/cli/compiler/common/babel/plugins/index.ts +0 -0
  15. package/cli/compiler/common/babel/plugins/services.ts +586 -0
  16. package/cli/compiler/common/babel/routes/imports.ts +127 -0
  17. package/cli/compiler/common/babel/routes/routes.ts +1170 -0
  18. package/cli/compiler/common/files/autres.ts +39 -0
  19. package/cli/compiler/common/files/images.ts +42 -0
  20. package/cli/compiler/common/files/style.ts +82 -0
  21. package/cli/compiler/common/index.ts +165 -0
  22. package/cli/compiler/index.ts +585 -0
  23. package/cli/compiler/server/index.ts +220 -0
  24. package/cli/index.ts +213 -0
  25. package/cli/paths.ts +165 -0
  26. package/cli/print.ts +12 -0
  27. package/cli/tsconfig.json +42 -0
  28. package/cli/utils/index.ts +22 -0
  29. package/cli/utils/keyboard.ts +78 -0
  30. package/client/app/index.ts +2 -0
  31. package/client/components/Dialog/Manager.tsx +3 -49
  32. package/client/components/Dialog/index.less +3 -1
  33. package/client/components/index.ts +1 -2
  34. package/client/services/router/index.tsx +6 -16
  35. package/common/errors/index.tsx +12 -31
  36. package/package.json +58 -22
  37. package/server/app/container/config.ts +20 -1
  38. package/server/app/container/console/index.ts +1 -1
  39. package/server/services/auth/index.ts +62 -27
  40. package/server/services/auth/router/request.ts +17 -6
  41. package/server/services/router/http/index.ts +3 -3
  42. package/server/services/router/response/index.ts +1 -1
  43. package/server/services/schema/request.ts +28 -10
  44. package/server/utils/slug.ts +0 -3
  45. package/tsconfig.common.json +2 -1
  46. package/types/global/constants.d.ts +12 -0
  47. package/changelog.md +0 -5
  48. package/client/components/Button.tsx +0 -298
  49. package/client/components/Dialog/card.tsx +0 -208
  50. package/client/data/input.ts +0 -32
  51. package/client/pages/bug.tsx.old +0 -60
  52. package/templates/composant.tsx +0 -40
  53. package/templates/form.ts +0 -30
  54. package/templates/modal.tsx +0 -47
  55. package/templates/modele.ts +0 -56
  56. package/templates/page.tsx +0 -74
  57. package/templates/route.ts +0 -43
  58. package/templates/service.ts +0 -75
  59. package/vscode/copyimportationpath/.eslintrc.json +0 -24
  60. package/vscode/copyimportationpath/.vscodeignore +0 -12
  61. package/vscode/copyimportationpath/CHANGELOG.md +0 -9
  62. package/vscode/copyimportationpath/README.md +0 -3
  63. package/vscode/copyimportationpath/copyimportationpath-0.0.1.vsix +0 -0
  64. package/vscode/copyimportationpath/out/extension.js +0 -206
  65. package/vscode/copyimportationpath/out/extension.js.map +0 -1
  66. package/vscode/copyimportationpath/package-lock.json +0 -4536
  67. package/vscode/copyimportationpath/package.json +0 -86
  68. package/vscode/copyimportationpath/src/extension.ts +0 -300
  69. package/vscode/copyimportationpath/tsconfig.json +0 -22
  70. package/vscode/copyimportationpath/vsc-extension-quickstart.md +0 -42
@@ -1,86 +0,0 @@
1
- {
2
- "name": "copyimportationpath",
3
- "displayName": "CopyImportationPath",
4
- "description": "",
5
- "version": "0.0.1",
6
- "engines": {
7
- "vscode": "^1.57.0"
8
- },
9
- "categories": [
10
- "Other"
11
- ],
12
- "activationEvents": [
13
- "onStartupFinished",
14
- "onCommand:copyimportationpath.copy",
15
- "onCommand:copyimportationpath.copyStatement"
16
- ],
17
- "main": "./out/extension.js",
18
- "contributes": {
19
- "commands": [
20
- {
21
- "command": "copyimportationpath.copy",
22
- "title": "Copy Importation Path"
23
- },
24
- {
25
- "command": "copyimportationpath.copyStatement",
26
- "title": "Copy Importation Statement"
27
- }
28
- ],
29
- "menus": {
30
- "editor/context": [
31
- {
32
- "when": "editorFocus",
33
- "command": "copyimportationpath.copy"
34
- },
35
- {
36
- "when": "editorFocus",
37
- "command": "copyimportationpath.copyStatement"
38
- }
39
- ],
40
- "editor/title/context": [
41
- {
42
- "command": "copyimportationpath.copy"
43
- },
44
- {
45
- "command": "copyimportationpath.copyStatement"
46
- }
47
- ],
48
- "explorer/context": [
49
- {
50
- "command": "copyimportationpath.copy"
51
- },
52
- {
53
- "command": "copyimportationpath.copyStatement"
54
- }
55
- ]
56
- }
57
- },
58
- "scripts": {
59
- "vscode:prepublish": "npm run compile",
60
- "compile": "tsc -p ./",
61
- "watch": "tsc -watch -p ./",
62
- "pretest": "npm run compile && npm run lint",
63
- "lint": "eslint src --ext ts",
64
- "test": "node ./out/test/runTest.js"
65
- },
66
- "devDependencies": {
67
- "@types/glob": "^7.1.3",
68
- "@types/mocha": "^8.2.2",
69
- "@types/node": "14.x",
70
- "@types/vscode": "^1.57.0",
71
- "@typescript-eslint/eslint-plugin": "^4.26.0",
72
- "@typescript-eslint/parser": "^4.26.0",
73
- "eslint": "^7.27.0",
74
- "glob": "^7.1.7",
75
- "mocha": "^8.4.0",
76
- "typescript": "^4.3.2",
77
- "vscode-test": "^1.5.2"
78
- },
79
- "dependencies": {
80
- "json5": "^2.2.0",
81
- "minimatch": "^3.0.4"
82
- },
83
- "__metadata": {
84
- "installedTimestamp": 1644001431526
85
- }
86
- }
@@ -1,300 +0,0 @@
1
- import * as vscode from 'vscode';
2
- const fs = require('fs');
3
- const json5 = require('json5')
4
- const path = require('path');
5
- var minimatch = require("minimatch")
6
-
7
- type TAlias = { alias: string, chemin: string, partiel: boolean }
8
-
9
- export function activate(context: vscode.ExtensionContext) {
10
-
11
- const regEntete = /^\/\/\s+([a-z]+)\:\s+(.+)/i
12
- const templates: {[nom: string]: { glob?: string, regex?: RegExp, content: string }} = {}
13
-
14
- const dossierTemplates = path.join(context.extensionPath, '../..', 'templates');
15
- if (!fs.existsSync( dossierTemplates )){
16
- console.log("Template folder not existing:", dossierTemplates);
17
- return;
18
- }
19
-
20
- //const dossierTemplates = workspace + '/../node_modules/@dopamyn/framework/templates';
21
- fs.readdir(dossierTemplates, (err: Error, files: string[]) => {
22
-
23
- console.log("Lecture de", dossierTemplates, files);
24
-
25
- if (err) return console.error(err);
26
-
27
- for (const file of files) {
28
-
29
- const nom = file.substring(0, file.lastIndexOf('.'));
30
-
31
- let content = fs.readFileSync(dossierTemplates + '/' + file, { encoding: 'utf-8' });
32
- const entete = regEntete.exec(content);
33
- if (!entete) {
34
- console.error(file + `: Entete manquante ou au mauvais format.`);
35
- continue;
36
- }
37
-
38
- console.log('Template', file, nom, entete[1], entete[2]);
39
-
40
- // Retire l'entete de la template
41
- content = content.substring( entete[0].length ).trim()
42
- templates[ nom ] = { content }
43
-
44
- if (entete[1] === 'Glob')
45
- templates[nom].glob = entete[2]
46
- else if (entete[1] === 'Regex')
47
- templates[nom].regex = new RegExp(entete[2])
48
- else
49
- console.error(file + `: Entete inconnue: ` + entete[1]);
50
-
51
- }
52
-
53
- console.log(templates);
54
-
55
- });
56
-
57
- vscode.workspace.onDidCreateFiles(async (e) => {
58
- for (const file of e.files) {
59
-
60
- const importPath = await getImportPath(file.path)
61
- const importName = getImportName(importPath, file.path);
62
-
63
- console.log("Fichier créé:", file.path, importPath);
64
-
65
- // Remplacements
66
- for (const nom in templates) {
67
- const { glob, regex, content } = templates[nom]
68
-
69
- let match: RegExpMatchArray | null | undefined;
70
-
71
- if ((glob && minimatch( file.path, glob )) || (match = regex?.exec( file.path ))) {
72
-
73
- const remplacements: {[cle: string]: string} = {
74
- NAMELOWER: importName.toLowerCase(),
75
- NAME: importName,
76
- ABSPATH: importPath,
77
- ...(match?.groups || {})
78
- }
79
-
80
- console.log("Template:", nom, "Remplacements:", remplacements);
81
-
82
- fs.writeFileSync(file.path, content.replace(
83
- new RegExp( Object.keys(remplacements).join('|'), 'g' ),
84
- (match: string) => remplacements[match]
85
- ));
86
- break;
87
-
88
- }
89
-
90
- }
91
- }
92
- });
93
-
94
-
95
-
96
-
97
-
98
-
99
-
100
-
101
-
102
-
103
-
104
- const readTsConfig = async (chemin: string, workspace: string): Promise<TAlias[]> => {
105
-
106
- console.log('Lecture de ' + chemin);
107
- const rawtsconfig = fs.readFileSync(chemin, { encoding: 'utf-8' })
108
- const tsconfig = json5.parse(rawtsconfig);
109
-
110
- const paths = tsconfig.compilerOptions?.paths;
111
- if (paths !== undefined) {
112
-
113
- // Les plus specifiques en premiers
114
- let retour: TAlias[] = []
115
- for (let alias in paths) {
116
-
117
- let chemin = path.join(workspace, paths[alias][0])
118
- const partiel = chemin.endsWith('*');
119
- if (partiel) {
120
-
121
- // Retire le * à la fin
122
- chemin = chemin.substring(0, chemin.length - 1);
123
- alias = alias.substring(0, alias.length - 1);
124
-
125
- }
126
-
127
- retour.push({
128
- partiel,
129
- alias,
130
- chemin
131
- });
132
-
133
- }
134
-
135
- retour.sort((a, b) => b.chemin.length - a.chemin.length);
136
-
137
- return retour;
138
-
139
- } else if (tsconfig.extends !== undefined)
140
- return await readTsConfig(path.resolve(path.dirname(chemin), tsconfig.extends), workspace);
141
- else
142
- return [];
143
- }
144
-
145
- const removeExtensions = (fichier: string, extensions: string[]) => {
146
-
147
- for (const extension of extensions) {
148
-
149
- console.log(extension, fichier);
150
-
151
- if (fichier.endsWith('.' + extension)) {
152
- fichier = fichier.substring(0, fichier.length - extension.length - 1);
153
- break;
154
- }
155
- }
156
-
157
- if (fichier.endsWith('/index'))
158
- fichier = fichier.substring(0, fichier.length - 6);
159
-
160
- return fichier;
161
- }
162
-
163
- const getListeAlias = async () => {
164
-
165
-
166
- if (!vscode.workspace.workspaceFolders?.length) {
167
- console.error(`Impossible de récupérer le dossier du workspace actuel`);
168
- return []
169
- }
170
- const workspace = vscode.workspace.workspaceFolders[0].uri.path;
171
-
172
- const tsconfigs = await vscode.workspace.findFiles('tsconfig.json');
173
- if (tsconfigs.length === 0)
174
- return []
175
-
176
- return await readTsConfig(tsconfigs[0].path, workspace);
177
- }
178
-
179
- const getImportPath = async (fichier: string) => {
180
-
181
- const listeAlias = await getListeAlias();
182
-
183
- console.log('fichier =', fichier);
184
-
185
- console.log('listeAlias =', listeAlias);
186
-
187
- for (const alias of listeAlias) {
188
-
189
- // Remplacement prefixe
190
- if (alias.partiel) {
191
-
192
- if (fichier.startsWith(alias.chemin)) {
193
- fichier = alias.alias + fichier.substring(alias.chemin.length)
194
- break;
195
- }
196
-
197
- // Remplacement complet
198
- } else {
199
-
200
- if (fichier === alias.chemin) {
201
- fichier = alias.alias
202
- break;
203
- }
204
-
205
- }
206
-
207
- }
208
-
209
- // Vire l'extension
210
- fichier = removeExtensions(fichier, ['tsx', 'ts', 'js', 'jsx']);
211
-
212
- return fichier;
213
- }
214
-
215
- const findImportPath = async (selectedFile: any) => {
216
-
217
- let fichier: string;
218
- if (selectedFile)
219
- fichier = selectedFile.path;
220
- else {
221
- if (!vscode.window.activeTextEditor)
222
- return console.error(`Aucun editeur actif`);
223
- fichier = vscode.window.activeTextEditor.document.uri.path;
224
- }
225
-
226
- return await getImportPath(fichier);
227
- }
228
-
229
- const getImportName = (importPath: string, originalPath: string) => {
230
-
231
- const content = fs.readFileSync(originalPath, { encoding: 'utf-8' });
232
- const exportdefault = /export default\s+(function|class|new)\s+([a-zA-Z]+)/.exec(content);
233
-
234
- let nomModule: string;
235
- if (exportdefault) {
236
- nomModule = exportdefault[2];
237
- } else {
238
- const posSlash = importPath.lastIndexOf('/');
239
- nomModule = importPath.substring(posSlash === -1 ? 0 : posSlash + 1);
240
- nomModule = nomModule[0].toUpperCase() + nomModule.substring(1);
241
- }
242
-
243
- return nomModule;
244
- }
245
-
246
- const copier = (txt: string) => {
247
-
248
- console.log(txt);
249
-
250
- vscode.env.clipboard.writeText(txt);
251
-
252
- //vscode.window.showInformationMessage('Copied ' + txt);
253
- }
254
-
255
-
256
- context.subscriptions.push(
257
- vscode.commands.registerCommand('copyimportationpath.copy', async (selected) => {
258
-
259
- try {
260
-
261
- const fichier = await findImportPath(selected);
262
- if (fichier)
263
- copier(fichier);
264
-
265
- } catch (error) {
266
-
267
- vscode.window.showErrorMessage( error.toString() );
268
-
269
- console.error(error);
270
-
271
- }
272
-
273
- }),
274
-
275
- vscode.commands.registerCommand('copyimportationpath.copyStatement', async (selected) => {
276
-
277
- try {
278
-
279
- const importPath = await findImportPath(selected);
280
- if (importPath) {
281
-
282
- const importName = getImportName(importPath, selected.path);
283
-
284
- copier(`import ${importName} from '${importPath}';`);
285
-
286
- }
287
-
288
- } catch (error) {
289
-
290
- vscode.window.showErrorMessage(error.toString());
291
-
292
- console.error(error);
293
-
294
- }
295
-
296
- })
297
- );
298
- }
299
-
300
- export function deactivate() {}
@@ -1,22 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "module": "commonjs",
4
- "target": "es6",
5
- "outDir": "out",
6
- "lib": [
7
- "es6"
8
- ],
9
- "sourceMap": true,
10
- "rootDir": "src",
11
- "strict": true /* enable all strict type-checking options */
12
- /* Additional Checks */
13
- // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
14
- // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
15
- // "noUnusedParameters": true, /* Report errors on unused parameters. */
16
- },
17
- "exclude": [
18
- "node_modules",
19
- ".vscode-test",
20
- "templates"
21
- ]
22
- }
@@ -1,42 +0,0 @@
1
- # Welcome to your VS Code Extension
2
-
3
- ## What's in the folder
4
-
5
- * This folder contains all of the files necessary for your extension.
6
- * `package.json` - this is the manifest file in which you declare your extension and command.
7
- * The sample plugin registers a command and defines its title and command name. With this information VS Code can show the command in the command palette. It doesn’t yet need to load the plugin.
8
- * `src/extension.ts` - this is the main file where you will provide the implementation of your command.
9
- * The file exports one function, `activate`, which is called the very first time your extension is activated (in this case by executing the command). Inside the `activate` function we call `registerCommand`.
10
- * We pass the function containing the implementation of the command as the second parameter to `registerCommand`.
11
-
12
- ## Get up and running straight away
13
-
14
- * Press `F5` to open a new window with your extension loaded.
15
- * Run your command from the command palette by pressing (`Ctrl+Shift+P` or `Cmd+Shift+P` on Mac) and typing `Hello World`.
16
- * Set breakpoints in your code inside `src/extension.ts` to debug your extension.
17
- * Find output from your extension in the debug console.
18
-
19
- ## Make changes
20
-
21
- * You can relaunch the extension from the debug toolbar after changing code in `src/extension.ts`.
22
- * You can also reload (`Ctrl+R` or `Cmd+R` on Mac) the VS Code window with your extension to load your changes.
23
-
24
-
25
- ## Explore the API
26
-
27
- * You can open the full set of our API when you open the file `node_modules/@types/vscode/index.d.ts`.
28
-
29
- ## Run tests
30
-
31
- * Open the debug viewlet (`Ctrl+Shift+D` or `Cmd+Shift+D` on Mac) and from the launch configuration dropdown pick `Extension Tests`.
32
- * Press `F5` to run the tests in a new window with your extension loaded.
33
- * See the output of the test result in the debug console.
34
- * Make changes to `src/test/suite/extension.test.ts` or create new test files inside the `test/suite` folder.
35
- * The provided test runner will only consider files matching the name pattern `**.test.ts`.
36
- * You can create folders inside the `test` folder to structure your tests any way you want.
37
-
38
- ## Go further
39
-
40
- * Reduce the extension size and improve the startup time by [bundling your extension](https://code.visualstudio.com/api/working-with-extensions/bundling-extension).
41
- * [Publish your extension](https://code.visualstudio.com/api/working-with-extensions/publishing-extension) on the VSCode extension marketplace.
42
- * Automate builds by setting up [Continuous Integration](https://code.visualstudio.com/api/working-with-extensions/continuous-integration).