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
@@ -0,0 +1,39 @@
1
+ import { staticAssetName } from '../../../paths';
2
+
3
+ import type App from '../../../app';
4
+
5
+ module.exports = (app: App, dev: boolean, client: boolean) => ([
6
+
7
+ // Allow to use ?raw at the end of the module path to iport the raw content only
8
+ // Example: import VisualParserSource from './Parsers/visual.js?raw';
9
+ {
10
+ resourceQuery: /raw/,
11
+ type: 'asset/source',
12
+ },
13
+
14
+ // Client uniquement: Retourne le fichier correspondant au fichier dans le dossier public
15
+ {
16
+ test: /\.(xml|ico|wav|mp3)$/,
17
+ //loader: 'file-loader',
18
+ type: 'asset/resource',
19
+ generator: {
20
+ filename: staticAssetName
21
+ }
22
+ },
23
+
24
+ // Texte brut
25
+ {
26
+ type: 'asset/source',
27
+ test: /\.(md|hbs|sql|txt|csv|html)$/,
28
+ },
29
+
30
+ // Polices dans un fichier distinc dans le dossier dédié
31
+ {
32
+ test: /\.(woff(2)?|ttf|eot)(\?v=\d+\.\d+\.\d+)?$/,
33
+ //loader: 'file-loader',
34
+ type: 'asset/resource',
35
+ generator: {
36
+ filename: 'fonts/[name].[ext]'
37
+ }
38
+ }
39
+ ])
@@ -0,0 +1,42 @@
1
+ import { staticAssetName } from '../../../paths';
2
+ import type webpack from 'webpack';
3
+
4
+ module.exports = (app: App, dev: boolean, client: boolean): webpack.RuleSetRule[] => {
5
+
6
+ return [{
7
+ test: /\.(bmp|gif|png|jpe?g|ico|svg|webp)$/i,
8
+ type: 'asset',
9
+ parser: {
10
+ dataUrlCondition: {
11
+ // https://webpack.js.org/guides/asset-modules/#general-asset-type
12
+ // < 4kb = importation inline
13
+ // > 4kb = référence à l'url
14
+ maxSize: 4 * 1024 // 4kb
15
+ }
16
+ }
17
+
18
+ },
19
+
20
+ ...(dev ? [] : [{
21
+ test: /\.(jpg|jpeg|png)$/i,
22
+ type: "javascript/auto",
23
+ use: [{
24
+ loader: "responsive-loader",
25
+ options: {
26
+ sizes: [320, 480, 640, 768, 1024, 1300],
27
+ placeholder: true,
28
+ placeholderSize: 20,
29
+ quality: 100,
30
+ publicPath: '/public',
31
+
32
+ // Triggers error
33
+ // cacheDirectory: true,
34
+ }
35
+ }],
36
+ }]),
37
+
38
+ {
39
+ test: /\.(webm|mp4|avi|mpk|mov|mkv)$/,
40
+ type: 'asset/resource',
41
+ },]
42
+ }
@@ -0,0 +1,82 @@
1
+ // Plugons
2
+ import MiniCssExtractPlugin from "mini-css-extract-plugin";
3
+
4
+ import type { App } from '../../../app';
5
+
6
+ module.exports = (app: App, dev: boolean, client: boolean, buildDev: boolean = false) => {
7
+
8
+ const enableSourceMaps = dev && !buildDev;
9
+
10
+ return [
11
+
12
+ // Apply PostCSS plugins including autoprefixer
13
+ {
14
+ loader: MiniCssExtractPlugin.loader
15
+ },
16
+
17
+ // Process external/third-party styles
18
+ {
19
+ exclude: [app.paths.root],
20
+ loader: 'css-loader',
21
+ options: {
22
+ sourceMap: enableSourceMaps
23
+ },
24
+ },
25
+
26
+ // Process internal/project styles (from root folder)
27
+ {
28
+ include: [app.paths.root],
29
+ loader: 'css-loader',
30
+ options: {
31
+ // CSS Loader https://github.com/webpack/css-loader
32
+ importLoaders: 1, // let postcss run on @imports
33
+ sourceMap: enableSourceMaps
34
+ },
35
+ },
36
+
37
+ // Postcss
38
+ {
39
+ loader: 'postcss-loader',
40
+ options: {
41
+ postcssOptions: {
42
+ plugins: [
43
+ /* Tailwind V4 */require('@tailwindcss/postcss')({
44
+ // Ensure Tailwind scans the application sources even if the build
45
+ // process is launched from another working directory (e.g. Docker).
46
+ base: app.paths.root,
47
+
48
+ // Avoid double-minifying: Webpack already runs CssMinimizerPlugin in prod.
49
+ optimize: false,
50
+ }),
51
+ ///* Tailwind V3 */require('tailwindcss'),
52
+ ...(buildDev ? [] : [
53
+ require('autoprefixer'),
54
+ ]),
55
+ ],
56
+ },
57
+ },
58
+ },
59
+
60
+ {
61
+ test: /\.less$/,
62
+ loader: 'less-loader',
63
+ options: {
64
+ lessOptions: {
65
+ // RAPPEL: Rallonge considéralement le temps de compilation
66
+ // Pour math.random
67
+ //javascriptEnabled: true
68
+
69
+ // Défault = parens-division depuis 4.0.0
70
+ // https://lesscss.org/usage/#less-options-math
71
+ math: 'always',
72
+ },
73
+ }
74
+ },
75
+
76
+ /*{
77
+ test: /\.scss/,
78
+ loader: process.env.framework + '/node_modules/sass-loader',
79
+ }*/
80
+ ]
81
+
82
+ }
@@ -0,0 +1,165 @@
1
+ /*----------------------------------
2
+ - DEPENDANCES
3
+ ----------------------------------*/
4
+
5
+ // npm
6
+ import webpack from 'webpack';
7
+ import dayjs from 'dayjs';
8
+ import path from 'path';
9
+
10
+ // Plugins
11
+ const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
12
+
13
+ // Core
14
+ import cli from '../..';
15
+
16
+ // Type
17
+ import type { App } from '../../app';
18
+ import type { TAppSide } from '../../app';
19
+
20
+ /*----------------------------------
21
+ - CONSTANTS
22
+ ----------------------------------*/
23
+
24
+ export const regex = {
25
+ scripts: /\.(ts|tsx)$/,
26
+ style: /\.(css|less|scss)$/,
27
+ images: /\.(bmp|gif|jpg|jpeg|png|ico|svg)$/, // SVG gérés par SVGR
28
+ fonts: /\.(woff(2)?|ttf|eot)(\?v=\d+\.\d+\.\d+)?$/,
29
+ staticAssetName: /*isDebug ? '[name].[ext].[hash:8]' :*/ '[hash:8][ext]',
30
+ }
31
+
32
+ /*----------------------------------
33
+ - TYPES
34
+ ----------------------------------*/
35
+
36
+ export type TCompileMode = 'dev' | 'prod'
37
+ export type TCompileOutputTarget = 'dev' | 'bin'
38
+
39
+ /*----------------------------------
40
+ - BASE CONFIG
41
+ ----------------------------------*/
42
+
43
+ export default function createCommonConfig(
44
+ app: App,
45
+ side: TAppSide,
46
+ mode: TCompileMode,
47
+ outputTarget: TCompileOutputTarget = mode === 'dev' ? 'dev' : 'bin',
48
+ ): webpack.Configuration {
49
+
50
+ const dev = mode === 'dev';
51
+ const buildDev = dev && outputTarget === 'bin';
52
+ const config: webpack.Configuration = {
53
+
54
+ // Project root
55
+ context: app.paths.root,
56
+
57
+ mode: dev ? 'development' : 'production',
58
+
59
+ resolveLoader: {
60
+ // Support both install modes:
61
+ // - npm i: loaders are often hoisted in app/node_modules
62
+ // - npm link: loaders often live in framework/node_modules
63
+ modules: [
64
+ app.paths.root + '/node_modules',
65
+ cli.paths.core.root + '/node_modules',
66
+ cli.paths.core.cli + '/node_modules',
67
+ ],
68
+ mainFields: ['loader', 'main'],
69
+ },
70
+
71
+ plugins: [
72
+
73
+ // https://webpack.js.org/plugins/define-plugin/
74
+ new webpack.DefinePlugin({
75
+
76
+ // Flags
77
+ __DEV__: dev,
78
+ SERVER: side === 'server',
79
+
80
+ // Core
81
+ CORE_VERSION: JSON.stringify( cli.packageJson.version ),
82
+ CORE_PATH: JSON.stringify(cli.paths.core.root),
83
+
84
+ // Application
85
+ BUILD_DATE: JSON.stringify(dayjs().format('YY.MM.DD-HH.mm')),
86
+ BUILD_ID: JSON.stringify(app.buildId),
87
+ APP_PATH: JSON.stringify(app.paths.root),
88
+ APP_NAME: JSON.stringify(app.identity.web.title),
89
+ APP_OUTPUT_DIR: JSON.stringify(path.basename(app.outputPath(outputTarget))),
90
+ PROTEUM_ROUTER_PORT_OVERRIDE: JSON.stringify(app.routerPortOverride ?? null),
91
+
92
+ }),
93
+
94
+ ...(side === 'client' && cli.args.analyze ? [
95
+
96
+ new BundleAnalyzerPlugin({
97
+ defaultSizes: 'stat',
98
+ openAnalyzer: false
99
+ }),
100
+
101
+ ] : []),
102
+
103
+ ...(dev ? [
104
+
105
+ // HMR
106
+ //new webpack.HotModuleReplacementPlugin()
107
+
108
+ ] : []),
109
+
110
+ ],
111
+
112
+ resolve: {
113
+
114
+ // Empêche le remplatcement des chemins vers les liens symboliques par leur vrai chemin
115
+ // Permet de conserver le chemin des packages enregistrés via npm link
116
+ // Equivalent tsconfig: preserveSymlinks: true
117
+ symlinks: false,
118
+
119
+ /*modules: [
120
+ cli.paths.core.root + '/node_modules',
121
+ app.paths.root + '/node_modules',
122
+ ]*/
123
+ },
124
+
125
+ // Turn off performance processing because we utilize
126
+ // our own hints via the FileSizeReporter
127
+ performance: false,
128
+
129
+ // Smoke builds should fail immediately on the first compilation error.
130
+ bail: buildDev || !dev,
131
+
132
+ // Persistent cache speeds up repeated local build-dev invocations.
133
+ cache: (buildDev || cli.args.cache === true) ? {
134
+ type: 'filesystem',
135
+ cacheDirectory: path.join(app.paths.cache, 'webpack', side, buildDev ? 'build-dev' : mode),
136
+ compression: false,
137
+ buildDependencies: {
138
+ config: [__filename],
139
+ },
140
+ } : false,
141
+
142
+ // Increase compilation performance
143
+ profile: false,
144
+
145
+ // Pour bundle-stats
146
+ // https://github.com/relative-ci/bundle-stats/tree/master/packages/cli#webpack-configuration
147
+ stats: {
148
+ cached: dev,
149
+ cachedAssets: dev,
150
+ chunks: dev,
151
+ chunkModules: dev,
152
+ colors: true,
153
+ hash: dev,
154
+ modules: dev,
155
+ reasons: dev,
156
+ timings: true,
157
+ version: dev,
158
+ errorDetails: true
159
+ },
160
+
161
+ }
162
+
163
+ return config;
164
+
165
+ }