proteum 1.0.0 → 1.0.2

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 (66) hide show
  1. package/cli/app/config.ts +54 -0
  2. package/cli/app/index.ts +195 -0
  3. package/cli/bin.js +35 -0
  4. package/cli/commands/build.ts +34 -0
  5. package/cli/commands/deploy/app.ts +29 -0
  6. package/cli/commands/deploy/web.ts +60 -0
  7. package/cli/commands/dev.ts +109 -0
  8. package/cli/commands/init.ts +85 -0
  9. package/cli/compiler/client/identite.ts +72 -0
  10. package/cli/compiler/client/index.ts +335 -0
  11. package/cli/compiler/common/babel/index.ts +170 -0
  12. package/cli/compiler/common/babel/plugins/index.ts +0 -0
  13. package/cli/compiler/common/babel/plugins/services.ts +586 -0
  14. package/cli/compiler/common/babel/routes/imports.ts +127 -0
  15. package/cli/compiler/common/babel/routes/routes.ts +1130 -0
  16. package/cli/compiler/common/files/autres.ts +39 -0
  17. package/cli/compiler/common/files/images.ts +42 -0
  18. package/cli/compiler/common/files/style.ts +80 -0
  19. package/cli/compiler/common/index.ts +160 -0
  20. package/cli/compiler/index.ts +564 -0
  21. package/cli/compiler/server/index.ts +211 -0
  22. package/cli/index.ts +189 -0
  23. package/cli/paths.ts +165 -0
  24. package/cli/print.ts +12 -0
  25. package/cli/tsconfig.json +42 -0
  26. package/cli/utils/index.ts +22 -0
  27. package/cli/utils/keyboard.ts +78 -0
  28. package/client/app/index.ts +2 -0
  29. package/client/components/Dialog/Manager.tsx +3 -49
  30. package/client/components/Dialog/index.less +3 -1
  31. package/client/components/index.ts +1 -2
  32. package/client/services/router/index.tsx +6 -16
  33. package/common/errors/index.tsx +12 -31
  34. package/doc/TODO.md +1 -1
  35. package/package.json +58 -20
  36. package/server/app/container/console/index.ts +1 -1
  37. package/server/services/auth/index.ts +62 -27
  38. package/server/services/auth/router/request.ts +17 -6
  39. package/server/services/router/http/index.ts +1 -1
  40. package/server/services/router/response/index.ts +1 -1
  41. package/server/services/schema/request.ts +28 -10
  42. package/tsconfig.common.json +2 -1
  43. package/changelog.md +0 -5
  44. package/client/components/Button.tsx +0 -298
  45. package/client/components/Dialog/card.tsx +0 -208
  46. package/client/data/input.ts +0 -32
  47. package/client/pages/bug.tsx.old +0 -60
  48. package/templates/composant.tsx +0 -40
  49. package/templates/form.ts +0 -30
  50. package/templates/modal.tsx +0 -47
  51. package/templates/modele.ts +0 -56
  52. package/templates/page.tsx +0 -74
  53. package/templates/route.ts +0 -43
  54. package/templates/service.ts +0 -75
  55. package/vscode/copyimportationpath/.eslintrc.json +0 -24
  56. package/vscode/copyimportationpath/.vscodeignore +0 -12
  57. package/vscode/copyimportationpath/CHANGELOG.md +0 -9
  58. package/vscode/copyimportationpath/README.md +0 -3
  59. package/vscode/copyimportationpath/copyimportationpath-0.0.1.vsix +0 -0
  60. package/vscode/copyimportationpath/out/extension.js +0 -206
  61. package/vscode/copyimportationpath/out/extension.js.map +0 -1
  62. package/vscode/copyimportationpath/package-lock.json +0 -4536
  63. package/vscode/copyimportationpath/package.json +0 -86
  64. package/vscode/copyimportationpath/src/extension.ts +0 -300
  65. package/vscode/copyimportationpath/tsconfig.json +0 -22
  66. 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,80 @@
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) => {
7
+
8
+ console.log('app.paths.root', app.paths.root)
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: dev
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: dev
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
+ require('autoprefixer'),
53
+ ],
54
+ },
55
+ },
56
+ },
57
+
58
+ {
59
+ test: /\.less$/,
60
+ loader: 'less-loader',
61
+ options: {
62
+ lessOptions: {
63
+ // RAPPEL: Rallonge considéralement le temps de compilation
64
+ // Pour math.random
65
+ //javascriptEnabled: true
66
+
67
+ // Défault = parens-division depuis 4.0.0
68
+ // https://lesscss.org/usage/#less-options-math
69
+ math: 'always',
70
+ },
71
+ }
72
+ },
73
+
74
+ /*{
75
+ test: /\.scss/,
76
+ loader: process.env.framework + '/node_modules/sass-loader',
77
+ }*/
78
+ ]
79
+
80
+ }
@@ -0,0 +1,160 @@
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
+
38
+ /*----------------------------------
39
+ - BASE CONFIG
40
+ ----------------------------------*/
41
+
42
+ export default function createCommonConfig(
43
+ app: App,
44
+ side: TAppSide,
45
+ mode: TCompileMode,
46
+ ): webpack.Configuration {
47
+
48
+ const dev = mode === 'dev';
49
+ const config: webpack.Configuration = {
50
+
51
+ // Project root
52
+ context: app.paths.root,
53
+
54
+ mode: dev ? 'development' : 'production',
55
+
56
+ resolveLoader: {
57
+ // Support both install modes:
58
+ // - npm i: loaders are often hoisted in app/node_modules
59
+ // - npm link: loaders often live in framework/node_modules
60
+ modules: [
61
+ app.paths.root + '/node_modules',
62
+ cli.paths.core.root + '/node_modules',
63
+ cli.paths.core.cli + '/node_modules',
64
+ ],
65
+ mainFields: ['loader', 'main'],
66
+ },
67
+
68
+ plugins: [
69
+
70
+ // https://webpack.js.org/plugins/define-plugin/
71
+ new webpack.DefinePlugin({
72
+
73
+ // Flags
74
+ __DEV__: dev,
75
+ SERVER: side === 'server',
76
+
77
+ // Core
78
+ CORE_VERSION: JSON.stringify( cli.packageJson.version ),
79
+ CORE_PATH: JSON.stringify(cli.paths.core.root),
80
+
81
+ // Application
82
+ BUILD_DATE: JSON.stringify(dayjs().format('YY.MM.DD-HH.mm')),
83
+ BUILD_ID: JSON.stringify(app.buildId),
84
+ APP_PATH: JSON.stringify(app.paths.root),
85
+ APP_NAME: JSON.stringify(app.identity.web.title),
86
+
87
+ }),
88
+
89
+ ...(side === 'client' && cli.args.analyze ? [
90
+
91
+ new BundleAnalyzerPlugin({
92
+ defaultSizes: 'stat',
93
+ openAnalyzer: false
94
+ }),
95
+
96
+ ] : []),
97
+
98
+ ...(dev ? [
99
+
100
+ // HMR
101
+ //new webpack.HotModuleReplacementPlugin()
102
+
103
+ ] : []),
104
+
105
+ ],
106
+
107
+ resolve: {
108
+
109
+ // Empêche le remplatcement des chemins vers les liens symboliques par leur vrai chemin
110
+ // Permet de conserver le chemin des packages enregistrés via npm link
111
+ // Equivalent tsconfig: preserveSymlinks: true
112
+ symlinks: false,
113
+
114
+ /*modules: [
115
+ cli.paths.core.root + '/node_modules',
116
+ app.paths.root + '/node_modules',
117
+ ]*/
118
+ },
119
+
120
+ // Turn off performance processing because we utilize
121
+ // our own hints via the FileSizeReporter
122
+ performance: false,
123
+
124
+ // Don't attempt to continue if there are any errors.
125
+ bail: !dev,
126
+
127
+ // Persistent cache speeds up cold starts and incremental rebuilds.
128
+ cache: /*(dev || cli.args.cache === true) ? {
129
+ type: 'filesystem',
130
+ cacheDirectory: path.join(app.paths.cache, 'webpack', side),
131
+ compression: false,
132
+ buildDependencies: {
133
+ config: [__filename],
134
+ },
135
+ } : */false,
136
+
137
+ // Increase compilation performance
138
+ profile: false,
139
+
140
+ // Pour bundle-stats
141
+ // https://github.com/relative-ci/bundle-stats/tree/master/packages/cli#webpack-configuration
142
+ stats: {
143
+ cached: dev,
144
+ cachedAssets: dev,
145
+ chunks: dev,
146
+ chunkModules: dev,
147
+ colors: true,
148
+ hash: dev,
149
+ modules: dev,
150
+ reasons: dev,
151
+ timings: true,
152
+ version: dev,
153
+ errorDetails: true
154
+ },
155
+
156
+ }
157
+
158
+ return config;
159
+
160
+ }