proteum 1.0.0-1

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 (156) hide show
  1. package/.dockerignore +10 -0
  2. package/Rte.zip +0 -0
  3. package/cli/app/config.ts +54 -0
  4. package/cli/app/index.ts +195 -0
  5. package/cli/bin.js +11 -0
  6. package/cli/commands/build.ts +34 -0
  7. package/cli/commands/deploy/app.ts +29 -0
  8. package/cli/commands/deploy/web.ts +60 -0
  9. package/cli/commands/dev.ts +109 -0
  10. package/cli/commands/init.ts +85 -0
  11. package/cli/compiler/client/identite.ts +72 -0
  12. package/cli/compiler/client/index.ts +334 -0
  13. package/cli/compiler/common/babel/index.ts +170 -0
  14. package/cli/compiler/common/babel/plugins/index.ts +0 -0
  15. package/cli/compiler/common/babel/plugins/services.ts +579 -0
  16. package/cli/compiler/common/babel/routes/imports.ts +127 -0
  17. package/cli/compiler/common/babel/routes/routes.ts +1130 -0
  18. package/cli/compiler/common/files/autres.ts +39 -0
  19. package/cli/compiler/common/files/images.ts +35 -0
  20. package/cli/compiler/common/files/style.ts +78 -0
  21. package/cli/compiler/common/index.ts +154 -0
  22. package/cli/compiler/index.ts +532 -0
  23. package/cli/compiler/server/index.ts +211 -0
  24. package/cli/index.ts +189 -0
  25. package/cli/paths.ts +165 -0
  26. package/cli/print.ts +12 -0
  27. package/cli/tsconfig.json +38 -0
  28. package/cli/utils/index.ts +22 -0
  29. package/cli/utils/keyboard.ts +78 -0
  30. package/client/app/component.tsx +54 -0
  31. package/client/app/index.ts +142 -0
  32. package/client/app/service.ts +34 -0
  33. package/client/app.tsconfig.json +28 -0
  34. package/client/components/Button.tsx +298 -0
  35. package/client/components/Dialog/Manager.tsx +309 -0
  36. package/client/components/Dialog/card.tsx +208 -0
  37. package/client/components/Dialog/index.less +151 -0
  38. package/client/components/Dialog/status.less +176 -0
  39. package/client/components/Dialog/status.tsx +48 -0
  40. package/client/components/index.ts +2 -0
  41. package/client/components/types.d.ts +3 -0
  42. package/client/data/input.ts +32 -0
  43. package/client/global.d.ts +5 -0
  44. package/client/hooks.ts +22 -0
  45. package/client/index.ts +6 -0
  46. package/client/pages/_layout/index.less +6 -0
  47. package/client/pages/_layout/index.tsx +43 -0
  48. package/client/pages/bug.tsx.old +60 -0
  49. package/client/pages/useHeader.tsx +50 -0
  50. package/client/services/captcha/index.ts +67 -0
  51. package/client/services/router/components/Link.tsx +46 -0
  52. package/client/services/router/components/Page.tsx +55 -0
  53. package/client/services/router/components/router.tsx +218 -0
  54. package/client/services/router/index.tsx +521 -0
  55. package/client/services/router/request/api.ts +267 -0
  56. package/client/services/router/request/history.ts +5 -0
  57. package/client/services/router/request/index.ts +53 -0
  58. package/client/services/router/request/multipart.ts +147 -0
  59. package/client/services/router/response/index.tsx +128 -0
  60. package/client/services/router/response/page.ts +86 -0
  61. package/client/services/socket/index.ts +147 -0
  62. package/client/utils/dom.ts +77 -0
  63. package/common/app/index.ts +9 -0
  64. package/common/data/chaines/index.ts +54 -0
  65. package/common/data/dates.ts +179 -0
  66. package/common/data/markdown.ts +73 -0
  67. package/common/data/rte/nodes.ts +83 -0
  68. package/common/data/stats.ts +90 -0
  69. package/common/errors/index.tsx +326 -0
  70. package/common/router/index.ts +213 -0
  71. package/common/router/layouts.ts +93 -0
  72. package/common/router/register.ts +55 -0
  73. package/common/router/request/api.ts +77 -0
  74. package/common/router/request/index.ts +35 -0
  75. package/common/router/response/index.ts +45 -0
  76. package/common/router/response/page.ts +128 -0
  77. package/common/utils/rte.ts +183 -0
  78. package/common/utils.ts +7 -0
  79. package/doc/TODO.md +71 -0
  80. package/doc/front/router.md +27 -0
  81. package/doc/workspace/workspace.png +0 -0
  82. package/doc/workspace/workspace2.png +0 -0
  83. package/doc/workspace/workspace_26.01.22.png +0 -0
  84. package/package.json +171 -0
  85. package/server/app/commands.ts +141 -0
  86. package/server/app/container/config.ts +203 -0
  87. package/server/app/container/console/index.ts +550 -0
  88. package/server/app/container/index.ts +137 -0
  89. package/server/app/index.ts +273 -0
  90. package/server/app/service/container.ts +88 -0
  91. package/server/app/service/index.ts +235 -0
  92. package/server/app.tsconfig.json +28 -0
  93. package/server/context.ts +4 -0
  94. package/server/index.ts +4 -0
  95. package/server/services/auth/index.ts +250 -0
  96. package/server/services/auth/old.ts +277 -0
  97. package/server/services/auth/router/index.ts +95 -0
  98. package/server/services/auth/router/request.ts +54 -0
  99. package/server/services/auth/router/service.json +6 -0
  100. package/server/services/auth/service.json +6 -0
  101. package/server/services/cache/commands.ts +41 -0
  102. package/server/services/cache/index.ts +297 -0
  103. package/server/services/cache/service.json +6 -0
  104. package/server/services/cron/CronTask.ts +86 -0
  105. package/server/services/cron/index.ts +112 -0
  106. package/server/services/cron/service.json +6 -0
  107. package/server/services/disks/driver.ts +103 -0
  108. package/server/services/disks/drivers/local/index.ts +188 -0
  109. package/server/services/disks/drivers/local/service.json +6 -0
  110. package/server/services/disks/drivers/s3/index.ts +301 -0
  111. package/server/services/disks/drivers/s3/service.json +6 -0
  112. package/server/services/disks/index.ts +90 -0
  113. package/server/services/disks/service.json +6 -0
  114. package/server/services/email/index.ts +188 -0
  115. package/server/services/email/utils.ts +53 -0
  116. package/server/services/fetch/index.ts +201 -0
  117. package/server/services/fetch/service.json +7 -0
  118. package/server/services/models.7z +0 -0
  119. package/server/services/prisma/Facet.ts +142 -0
  120. package/server/services/prisma/index.ts +201 -0
  121. package/server/services/prisma/service.json +6 -0
  122. package/server/services/router/http/index.ts +217 -0
  123. package/server/services/router/http/multipart.ts +102 -0
  124. package/server/services/router/http/session.ts.old +40 -0
  125. package/server/services/router/index.ts +801 -0
  126. package/server/services/router/request/api.ts +87 -0
  127. package/server/services/router/request/index.ts +184 -0
  128. package/server/services/router/request/service.ts +21 -0
  129. package/server/services/router/request/validation/zod.ts +180 -0
  130. package/server/services/router/response/index.ts +338 -0
  131. package/server/services/router/response/mask/Filter.ts +323 -0
  132. package/server/services/router/response/mask/index.ts +60 -0
  133. package/server/services/router/response/mask/selecteurs.ts +92 -0
  134. package/server/services/router/response/page/document.tsx +160 -0
  135. package/server/services/router/response/page/index.tsx +196 -0
  136. package/server/services/router/service.json +6 -0
  137. package/server/services/router/service.ts +36 -0
  138. package/server/services/schema/index.ts +44 -0
  139. package/server/services/schema/request.ts +49 -0
  140. package/server/services/schema/router/index.ts +28 -0
  141. package/server/services/schema/router/service.json +6 -0
  142. package/server/services/schema/service.json +6 -0
  143. package/server/services/security/encrypt/aes/index.ts +85 -0
  144. package/server/services/security/encrypt/aes/service.json +6 -0
  145. package/server/services/socket/index.ts +162 -0
  146. package/server/services/socket/scope.ts +226 -0
  147. package/server/services/socket/service.json +6 -0
  148. package/server/services_old/SocketClient.ts +92 -0
  149. package/server/services_old/Token.old.ts +97 -0
  150. package/server/utils/slug.ts +79 -0
  151. package/tsconfig.common.json +45 -0
  152. package/tsconfig.json +3 -0
  153. package/types/aliases.d.ts +54 -0
  154. package/types/global/modules.d.ts +49 -0
  155. package/types/global/utils.d.ts +103 -0
  156. package/types/icons.d.ts +1 -0
@@ -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,35 @@
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|jpg|jpegico|svg|webp)$/,
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
+ test: /\.(jpg|jpeg|png)$/i,
20
+ type: "javascript/auto",
21
+ use: [{
22
+ loader: "responsive-loader",
23
+ options: {
24
+ sizes: [320, 480, 640, 768, 1024, 1300],
25
+ placeholder: true,
26
+ placeholderSize: 20,
27
+ quality: 100,
28
+ publicPath: '/public'
29
+ }
30
+ }]
31
+ }, {
32
+ test: /\.(webm|mp4|avi|mpk|mov|mkv)$/,
33
+ type: 'asset/resource',
34
+ },]
35
+ }
@@ -0,0 +1,78 @@
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
+ return [
9
+
10
+ // Apply PostCSS plugins including autoprefixer
11
+ {
12
+ loader: MiniCssExtractPlugin.loader
13
+ },
14
+
15
+ // Process external/third-party styles
16
+ {
17
+ exclude: [app.paths.root],
18
+ loader: 'css-loader',
19
+ options: {
20
+ sourceMap: dev
21
+ },
22
+ },
23
+
24
+ // Process internal/project styles (from root folder)
25
+ {
26
+ include: [app.paths.root],
27
+ loader: 'css-loader',
28
+ options: {
29
+ // CSS Loader https://github.com/webpack/css-loader
30
+ importLoaders: 1, // let postcss run on @imports
31
+ sourceMap: dev
32
+ },
33
+ },
34
+
35
+ // Postcss
36
+ {
37
+ loader: 'postcss-loader',
38
+ options: {
39
+ postcssOptions: {
40
+ plugins: [
41
+ /* Tailwind V4 */require('@tailwindcss/postcss')({
42
+ // Ensure Tailwind scans the application sources even if the build
43
+ // process is launched from another working directory (e.g. Docker).
44
+ base: app.paths.root,
45
+
46
+ // Avoid double-minifying: Webpack already runs CssMinimizerPlugin in prod.
47
+ optimize: false,
48
+ }),
49
+ ///* Tailwind V3 */require('tailwindcss'),
50
+ require('autoprefixer'),
51
+ ],
52
+ },
53
+ },
54
+ },
55
+
56
+ {
57
+ test: /\.less$/,
58
+ loader: 'less-loader',
59
+ options: {
60
+ lessOptions: {
61
+ // RAPPEL: Rallonge considéralement le temps de compilation
62
+ // Pour math.random
63
+ //javascriptEnabled: true
64
+
65
+ // Défault = parens-division depuis 4.0.0
66
+ // https://lesscss.org/usage/#less-options-math
67
+ math: 'always',
68
+ },
69
+ }
70
+ },
71
+
72
+ /*{
73
+ test: /\.scss/,
74
+ loader: process.env.framework + '/node_modules/sass-loader',
75
+ }*/
76
+ ]
77
+
78
+ }
@@ -0,0 +1,154 @@
1
+ /*----------------------------------
2
+ - DEPENDANCES
3
+ ----------------------------------*/
4
+
5
+ // npm
6
+ import webpack from 'webpack';
7
+ import dayjs from 'dayjs';
8
+
9
+ // Plugins
10
+ const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
11
+
12
+ // Core
13
+ import cli from '../..';
14
+
15
+ // Type
16
+ import type { App } from '../../app';
17
+ import type { TAppSide } from '../../app';
18
+
19
+ /*----------------------------------
20
+ - CONSTANTS
21
+ ----------------------------------*/
22
+
23
+ export const regex = {
24
+ scripts: /\.(ts|tsx)$/,
25
+ style: /\.(css|less|scss)$/,
26
+ images: /\.(bmp|gif|jpg|jpeg|png|ico|svg)$/, // SVG gérés par SVGR
27
+ fonts: /\.(woff(2)?|ttf|eot)(\?v=\d+\.\d+\.\d+)?$/,
28
+ staticAssetName: /*isDebug ? '[name].[ext].[hash:8]' :*/ '[hash:8][ext]',
29
+ }
30
+
31
+ /*----------------------------------
32
+ - TYPES
33
+ ----------------------------------*/
34
+
35
+ export type TCompileMode = 'dev' | 'prod'
36
+
37
+ /*----------------------------------
38
+ - BASE CONFIG
39
+ ----------------------------------*/
40
+
41
+ export default function createCommonConfig(
42
+ app: App,
43
+ side: TAppSide,
44
+ mode: TCompileMode,
45
+ ): webpack.Configuration {
46
+
47
+ const dev = mode === 'dev';
48
+ const config: webpack.Configuration = {
49
+
50
+ // Project root
51
+ context: app.paths.root,
52
+
53
+ mode: dev ? 'development' : 'production',
54
+
55
+ resolveLoader: {
56
+ // Recherche des loaders dans framework/node_modules (psinon, webpack cherche dans le projet)
57
+ modules: [
58
+ // The line below is not necessary
59
+ // By default, webpack is supposed to search in the project directory at first
60
+ //cli.paths.appRoot + '/node_modules',
61
+ cli.paths.core.root + '/node_modules',
62
+ cli.paths.core.cli + '/node_modules',
63
+ ],
64
+ mainFields: ['loader', 'main'],
65
+ },
66
+
67
+ plugins: [
68
+
69
+ // https://webpack.js.org/plugins/define-plugin/
70
+ new webpack.DefinePlugin({
71
+
72
+ // Flags
73
+ __DEV__: dev,
74
+ SERVER: side === 'server',
75
+
76
+ // Core
77
+ CORE_VERSION: JSON.stringify( cli.packageJson.version ),
78
+ CORE_PATH: JSON.stringify(cli.paths.core.root),
79
+
80
+ // Application
81
+ BUILD_DATE: JSON.stringify(dayjs().format('YY.MM.DD-HH.mm')),
82
+ BUILD_ID: JSON.stringify(app.buildId),
83
+ APP_PATH: JSON.stringify(app.paths.root),
84
+ APP_NAME: JSON.stringify(app.identity.web.title),
85
+
86
+ }),
87
+
88
+ ...(side === 'client' && cli.args.analyze ? [
89
+
90
+ new BundleAnalyzerPlugin({
91
+ defaultSizes: 'stat',
92
+ openAnalyzer: false
93
+ }),
94
+
95
+ ] : []),
96
+
97
+ ...(dev ? [
98
+
99
+ // HMR
100
+ //new webpack.HotModuleReplacementPlugin()
101
+
102
+ ] : []),
103
+
104
+ ],
105
+
106
+ resolve: {
107
+
108
+ // Empêche le remplatcement des chemins vers les liens symboliques par leur vrai chemin
109
+ // Permet de conserver le chemin des packages enregistrés via npm link
110
+ // Equivalent tsconfig: preserveSymlinks: true
111
+ symlinks: false,
112
+
113
+ /*modules: [
114
+ cli.paths.core.root + '/node_modules',
115
+ app.paths.root + '/node_modules',
116
+ ]*/
117
+ },
118
+
119
+ // Turn off performance processing because we utilize
120
+ // our own hints via the FileSizeReporter
121
+ performance: false,
122
+
123
+ // Don't attempt to continue if there are any errors.
124
+ bail: !dev,
125
+
126
+ // When true, Can cause troubles on re-compiling the client side
127
+ // "webpack" The "path" argument must be of type string. Received undefined
128
+ // https://github.com/webpack/webpack/issues/12616
129
+ // Update: Hum it's fixed, just had to update webpack deps
130
+ cache: dev,
131
+
132
+ profile: true,
133
+
134
+ // Pour bundle-stats
135
+ // https://github.com/relative-ci/bundle-stats/tree/master/packages/cli#webpack-configuration
136
+ stats: {
137
+ cached: dev,
138
+ cachedAssets: dev,
139
+ chunks: dev,
140
+ chunkModules: dev,
141
+ colors: true,
142
+ hash: dev,
143
+ modules: dev,
144
+ reasons: dev,
145
+ timings: true,
146
+ version: dev,
147
+ errorDetails: true
148
+ },
149
+
150
+ }
151
+
152
+ return config;
153
+
154
+ }