@tramvai/cli 2.49.0 → 2.49.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 (24) hide show
  1. package/lib/library/webpack/application/server/prod.js +7 -1
  2. package/lib/library/webpack/application/server/prod.js.map +1 -1
  3. package/lib/library/webpack/blocks/optimize.js +3 -1
  4. package/lib/library/webpack/blocks/optimize.js.map +1 -1
  5. package/package.json +2 -2
  6. package/src/library/swc/__integration__/__snapshots__/swc.build.test.ts.snap +564 -0
  7. package/src/library/swc/__integration__/__snapshots__/swc.start.test.ts.snap +769 -0
  8. package/src/library/swc/__integration__/components/lazy-inner.tsx +3 -0
  9. package/src/library/swc/__integration__/create-token-pure.ts +3 -0
  10. package/src/library/swc/__integration__/images/logo.svg +1 -0
  11. package/src/library/swc/__integration__/index.ts +18 -0
  12. package/src/library/swc/__integration__/lazy-component.tsx +12 -0
  13. package/src/library/swc/__integration__/mocks/tramvai-core.ts +3 -0
  14. package/src/library/swc/__integration__/mocks/tramvai-react.ts +1 -0
  15. package/src/library/swc/__integration__/node-env.ts +13 -0
  16. package/src/library/swc/__integration__/provider-stack.ts +10 -0
  17. package/src/library/swc/__integration__/react-svg.tsx +9 -0
  18. package/src/library/swc/__integration__/server.inline.ts +7 -0
  19. package/src/library/swc/__integration__/swc.build.test.ts +99 -0
  20. package/src/library/swc/__integration__/swc.start.test.ts +102 -0
  21. package/src/library/swc/__integration__/tsconfig.json +13 -0
  22. package/src/library/swc/__integration__/typeof-window.ts +13 -0
  23. package/src/library/webpack/application/server/prod.ts +6 -1
  24. package/src/library/webpack/blocks/optimize.ts +3 -1
@@ -0,0 +1,3 @@
1
+ export default () => {
2
+ return <div>Lazy inner</div>;
3
+ };
@@ -0,0 +1,3 @@
1
+ import { createToken } from '@tramvai/core';
2
+
3
+ export const TEST_TOKEN = createToken<string>('TEST_TOKEN');
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 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7-.3-1.2-.6-1.4-1.2-.3-.6-.2-1.2-.1-1.5.2 0 .4.1.6.1h1.2c1.1-.1 2.3-.6 3.6-1.9h8.4zM46.6 23l1.6 1 .4.2c-.9.3-1.6.7-2.2 1.3l-.1.1c-.1.1-.3.3-.4.5 0 0 0 .1-.1.1-.1.2-.2.3-.4.5 0 0 0 .1-.1.1-.1.2-.3.4-.4.6-1.2 2-3 3.2-4.7 3.2-1.7 0-3.5-1.2-4.7-3.2-.1-.2-.3-.4-.4-.6l-.1-.1c-.1-.2-.2-.3-.3-.5l-.1-.1c-.1-.2-.3-.3-.4-.5l-.1-.1c-.6-.6-1.3-1.1-2.2-1.3l.4-.2 1.6-1 1.7-1 4.5 2.5 4.5-2.5 2 1zm-2.2-2l-3.6 1.9v-7.7l4.9-1.7-1.3 7.5zm-4-6.6l-5.3-2.1c.5-1.1 2.5-2 5.3-2s4.9.9 5.3 2l-5.3 2.1z"/></svg>
@@ -0,0 +1,18 @@
1
+ import * as createTokenPure from './create-token-pure';
2
+ import * as providerStack from './provider-stack';
3
+ import * as lazyComponent from './lazy-component';
4
+ import * as typeofWindow from './typeof-window';
5
+ import * as nodeEnv from './node-env';
6
+ import * as serverInline from './server.inline';
7
+ import * as reactSvg from './react-svg';
8
+
9
+ // prevent from removing imports by webpack optimizations
10
+ console.log([
11
+ createTokenPure,
12
+ providerStack,
13
+ lazyComponent,
14
+ typeofWindow,
15
+ nodeEnv,
16
+ serverInline,
17
+ reactSvg,
18
+ ]);
@@ -0,0 +1,12 @@
1
+ import { lazy } from '@tramvai/react';
2
+
3
+ const LazyComponent = lazy(() => import('./components/lazy-inner'));
4
+
5
+ export const Component = () => {
6
+ return (
7
+ <>
8
+ <h2>Lazy test</h2>
9
+ <LazyComponent />
10
+ </>
11
+ );
12
+ };
@@ -0,0 +1,3 @@
1
+ export const createToken = () => {};
2
+
3
+ export const provide = () => {};
@@ -0,0 +1 @@
1
+ export const lazy = () => {};
@@ -0,0 +1,13 @@
1
+ let internalFunc: Function;
2
+
3
+ if (process.env.NODE_ENV === 'development') {
4
+ internalFunc = () => 'Are you developer, for sure?';
5
+ }
6
+
7
+ if (process.env.NODE_ENV === 'production') {
8
+ internalFunc = () => 'Nice production ;-)';
9
+ }
10
+
11
+ export const func = () => {
12
+ return internalFunc();
13
+ };
@@ -0,0 +1,10 @@
1
+ import type { Provider } from '@tramvai/core';
2
+ import { provide } from '@tramvai/core';
3
+ import { TEST_TOKEN } from './create-token-pure';
4
+
5
+ export const providers: Provider[] = [
6
+ provide({
7
+ provide: TEST_TOKEN,
8
+ useValue: 'test',
9
+ }),
10
+ ];
@@ -0,0 +1,9 @@
1
+ import Logo from './images/logo.svg?react';
2
+
3
+ export const Component = () => {
4
+ return (
5
+ <div>
6
+ <Logo />
7
+ </div>
8
+ );
9
+ };
@@ -0,0 +1,7 @@
1
+ export class ForBrowser {
2
+ static prop = 'static';
3
+
4
+ test() {
5
+ console.log('Ok');
6
+ }
7
+ }
@@ -0,0 +1,99 @@
1
+ import * as path from 'path';
2
+ import { promises as fs } from 'fs';
3
+ import { build } from '@tramvai/cli';
4
+
5
+ let clientCode: string;
6
+ let clientModernCode: string;
7
+ let serverCode: string;
8
+
9
+ const getModuleCode = (code: string, name: string) => {
10
+ const regexp = new RegExp(`swc/__integration__/${name}":\\s*\n.+?{\n(.+?)/\\*{3}/\\s`, 's');
11
+
12
+ const match = code.match(regexp);
13
+
14
+ if (match) {
15
+ return match[1];
16
+ }
17
+
18
+ throw new Error(`Module ${name} not found in code`);
19
+ };
20
+
21
+ beforeAll(async () => {
22
+ await build({
23
+ rootDir: __dirname,
24
+ disableProdOptimization: true,
25
+ config: {
26
+ name: 'swc-app',
27
+ type: 'application',
28
+ root: './',
29
+ commands: {
30
+ build: {
31
+ options: {
32
+ server: 'index.ts',
33
+ },
34
+ configurations: {
35
+ experiments: {
36
+ transpilation: {
37
+ loader: 'swc',
38
+ },
39
+ },
40
+ },
41
+ },
42
+ serve: {
43
+ configurations: {
44
+ experiments: {
45
+ transpilation: {
46
+ loader: 'swc',
47
+ },
48
+ },
49
+ },
50
+ },
51
+ },
52
+ },
53
+ });
54
+
55
+ const distRoot = path.resolve(__dirname, 'dist');
56
+
57
+ serverCode = await fs.readFile(path.resolve(distRoot, 'server/server.js'), 'utf-8');
58
+
59
+ const stats = require(path.resolve(distRoot, 'client/stats.json'));
60
+ const modernStats = require(path.resolve(distRoot, 'client/stats.modern.json'));
61
+
62
+ clientCode = await fs.readFile(
63
+ path.resolve(distRoot, 'client', stats.assetsByChunkName.platform[0]),
64
+ 'utf-8'
65
+ );
66
+
67
+ clientModernCode = await fs.readFile(
68
+ path.resolve(distRoot, 'client', modernStats.assetsByChunkName.platform[0]),
69
+ 'utf-8'
70
+ );
71
+ }, 180000);
72
+
73
+ const MODULES = [
74
+ 'create-token-pure.ts',
75
+ 'provider-stack.ts',
76
+ 'lazy-component.tsx',
77
+ 'typeof-window.ts',
78
+ 'node-env.ts',
79
+ 'server.inline.ts',
80
+ 'react-svg.tsx',
81
+ 'images/logo.svg\\?react',
82
+ ];
83
+
84
+ for (const mod of MODULES) {
85
+ // eslint-disable-next-line no-loop-func
86
+ it(`client-legacy: ${mod}`, () => {
87
+ expect(getModuleCode(clientCode, mod)).toMatchSnapshot();
88
+ });
89
+
90
+ // eslint-disable-next-line no-loop-func
91
+ it(`client-modern: ${mod}`, () => {
92
+ expect(getModuleCode(clientModernCode, mod)).toMatchSnapshot();
93
+ });
94
+
95
+ // eslint-disable-next-line no-loop-func
96
+ it(`server: ${mod}`, () => {
97
+ expect(getModuleCode(serverCode, mod)).toMatchSnapshot();
98
+ });
99
+ }
@@ -0,0 +1,102 @@
1
+ import { start } from '@tramvai/cli';
2
+ import { getStaticUrl } from '@tramvai/test-integration';
3
+ import type { PromiseType } from 'utility-types';
4
+ import fetch from 'node-fetch';
5
+
6
+ let app: PromiseType<ReturnType<typeof start>>;
7
+ let clientCode: string;
8
+ let serverCode: string;
9
+
10
+ const normalizeCode = (code: string) => {
11
+ return code
12
+ .replace(/\\n/g, '\n')
13
+ .replace(/\\t/g, '\t')
14
+ .replace(/\\"/g, '"')
15
+ .replace(new RegExp(__dirname, 'g'), '<project_dir>');
16
+ };
17
+
18
+ const getModuleCode = (code: string, name: string) => {
19
+ const regexp = new RegExp(`swc/__integration__/${name}":.+?eval\\("(.+?)//# sourceURL=`, 's');
20
+
21
+ const match = code.match(regexp);
22
+
23
+ if (match) {
24
+ return normalizeCode(match[1]);
25
+ }
26
+
27
+ throw new Error(`Module ${name} not found in code`);
28
+ };
29
+
30
+ beforeAll(async () => {
31
+ app = await start({
32
+ rootDir: __dirname,
33
+ port: 0,
34
+ staticPort: 0,
35
+ strictErrorHandle: true,
36
+ config: {
37
+ name: 'swc-app',
38
+ type: 'application',
39
+ root: './',
40
+ commands: {
41
+ build: {
42
+ options: {
43
+ server: 'index.ts',
44
+ },
45
+ configurations: {
46
+ experiments: {
47
+ transpilation: {
48
+ loader: 'swc',
49
+ },
50
+ },
51
+ },
52
+ },
53
+ serve: {
54
+ configurations: {
55
+ experiments: {
56
+ transpilation: {
57
+ loader: 'swc',
58
+ },
59
+ },
60
+ },
61
+ },
62
+ },
63
+ },
64
+ });
65
+
66
+ const staticUrl = getStaticUrl(app);
67
+
68
+ const platform = await fetch(`${staticUrl}/dist/client/platform.js`);
69
+
70
+ clientCode = await platform.text();
71
+
72
+ const server = await fetch(`${staticUrl}/dist/server/server.js`);
73
+
74
+ serverCode = await server.text();
75
+ }, 180000);
76
+
77
+ afterAll(() => {
78
+ return app.close();
79
+ });
80
+
81
+ const MODULES = [
82
+ 'create-token-pure.ts',
83
+ 'provider-stack.ts',
84
+ 'lazy-component.tsx',
85
+ 'typeof-window.ts',
86
+ 'node-env.ts',
87
+ 'server.inline.ts',
88
+ 'react-svg.tsx',
89
+ 'images/logo.svg\\?react',
90
+ ];
91
+
92
+ for (const mod of MODULES) {
93
+ // eslint-disable-next-line no-loop-func
94
+ it(`client: ${mod}`, () => {
95
+ expect(getModuleCode(clientCode, mod)).toMatchSnapshot();
96
+ });
97
+
98
+ // eslint-disable-next-line no-loop-func
99
+ it(`server: ${mod}`, () => {
100
+ expect(getModuleCode(serverCode, mod)).toMatchSnapshot();
101
+ });
102
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "compilerOptions": {
3
+ "baseUrl": ".",
4
+ "paths": {
5
+ "@tramvai/core": [
6
+ "mocks/tramvai-core.ts"
7
+ ],
8
+ "@tramvai/react": [
9
+ "mocks/tramvai-react.ts"
10
+ ],
11
+ }
12
+ }
13
+ }
@@ -0,0 +1,13 @@
1
+ let internalFunc: Function;
2
+
3
+ if (typeof window !== 'undefined') {
4
+ internalFunc = () => "Hello, I'm in browser";
5
+ }
6
+
7
+ if (typeof window === 'undefined') {
8
+ internalFunc = () => "I'm a big server";
9
+ }
10
+
11
+ export const func = () => {
12
+ return internalFunc();
13
+ };
@@ -30,7 +30,12 @@ export const webpackServerConfig = ({
30
30
  (configManager.build.configurations.externals || []).map((s) => new RegExp(`^${s}`))
31
31
  );
32
32
 
33
- if (!configManager.disableProdOptimization) {
33
+ if (configManager.disableProdOptimization) {
34
+ // with this option for id of module path to file will be used
35
+ config.optimization.set('moduleIds', 'named');
36
+ // prevent modules from concatenation in single module to easier debug
37
+ config.optimization.set('concatenateModules', false);
38
+ } else {
34
39
  config.plugin('terser').use(TerserPlugin, [
35
40
  {
36
41
  extractComments: false,
@@ -8,8 +8,10 @@ export default (configManager: ConfigManager) => (config: Config) => {
8
8
  const { modern, debug, disableProdOptimization } = configManager;
9
9
 
10
10
  if (disableProdOptimization) {
11
- // в качестве id модуля будет использоваться путь до файла
11
+ // with this option for id of module path to file will be used
12
12
  config.optimization.set('moduleIds', 'named');
13
+ // prevent modules from concatenation in single module to easier debug
14
+ config.optimization.set('concatenateModules', false);
13
15
 
14
16
  config.plugin('terser').use(TerserPlugin, [
15
17
  {