@nlabs/lex 1.49.4 → 1.50.0

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 (55) hide show
  1. package/.swcrc +35 -0
  2. package/README.md +43 -59
  3. package/__mocks__/chalk.js +19 -17
  4. package/config.json +32 -8
  5. package/examples/lex.config.js +110 -10
  6. package/index.cjs +1 -5
  7. package/lex.config.js +34 -7
  8. package/lib/Button.stories.js +99 -0
  9. package/lib/LexConfig.d.ts +60 -22
  10. package/lib/LexConfig.js +285 -244
  11. package/lib/commands/ai/ai.js +287 -288
  12. package/lib/commands/ai/index.js +8 -7
  13. package/lib/commands/build/build.d.ts +2 -2
  14. package/lib/commands/build/build.js +349 -458
  15. package/lib/commands/clean/clean.js +45 -33
  16. package/lib/commands/compile/compile.js +214 -227
  17. package/lib/commands/config/config.js +46 -42
  18. package/lib/commands/copy/copy.js +36 -35
  19. package/lib/commands/create/create.js +200 -121
  20. package/lib/commands/dev/dev.d.ts +2 -0
  21. package/lib/commands/dev/dev.js +259 -263
  22. package/lib/commands/init/init.js +108 -88
  23. package/lib/commands/link/link.js +18 -14
  24. package/lib/commands/lint/lint.js +735 -742
  25. package/lib/commands/migrate/migrate.js +49 -36
  26. package/lib/commands/publish/publish.js +116 -96
  27. package/lib/commands/serverless/serverless.js +611 -585
  28. package/lib/commands/storybook/storybook.js +242 -238
  29. package/lib/commands/test/test.d.ts +1 -1
  30. package/lib/commands/test/test.js +382 -394
  31. package/lib/commands/update/update.js +141 -120
  32. package/lib/commands/upgrade/upgrade.js +51 -44
  33. package/lib/commands/versions/versions.d.ts +1 -1
  34. package/lib/commands/versions/versions.js +36 -38
  35. package/lib/create/changelog.js +136 -125
  36. package/lib/index.js +40 -38
  37. package/lib/lex.js +95 -68
  38. package/lib/storybook/index.js +6 -1
  39. package/lib/test-react/index.js +7 -84
  40. package/lib/types.d.ts +1 -1
  41. package/lib/types.js +7 -1
  42. package/lib/utils/aiService.js +240 -227
  43. package/lib/utils/app.js +274 -273
  44. package/lib/utils/deepMerge.js +37 -23
  45. package/lib/utils/file.js +218 -215
  46. package/lib/utils/log.js +29 -27
  47. package/lib/utils/reactShim.js +7 -85
  48. package/lib/utils/translations.js +91 -65
  49. package/package.json +63 -64
  50. package/templates/typescript/DataLayer.js.txt +218 -0
  51. package/templates/typescript/DataLayer.test.js.txt +268 -0
  52. package/templates/typescript/DataLayer.test.ts.txt +269 -0
  53. package/templates/typescript/DataLayer.ts.txt +227 -0
  54. package/webpack.config.js +53 -26
  55. package/lib/commands/lint/autofix.d.ts +0 -2
@@ -1,24 +1,4 @@
1
1
  import type { Linter } from 'eslint';
2
- export interface EsbuildConfig {
3
- [key: string]: unknown;
4
- entryPoints?: string[];
5
- outdir?: string;
6
- platform?: 'node' | 'browser';
7
- target?: string;
8
- format?: 'cjs' | 'esm';
9
- minify?: boolean;
10
- treeShaking?: boolean;
11
- drop?: string[];
12
- pure?: string[];
13
- external?: string[];
14
- splitting?: boolean;
15
- metafile?: boolean;
16
- sourcemap?: boolean | 'inline' | 'external';
17
- legalComments?: 'none' | 'inline' | 'eof' | 'linked' | 'separate';
18
- banner?: Record<string, string>;
19
- footer?: Record<string, string>;
20
- define?: Record<string, string>;
21
- }
22
2
  export interface JestConfig {
23
3
  [key: string]: unknown;
24
4
  roots?: string[];
@@ -35,7 +15,7 @@ export interface WebpackConfig {
35
15
  output?: Record<string, unknown>;
36
16
  module?: Record<string, unknown>;
37
17
  plugins?: unknown[];
38
- publicPath?: string;
18
+ staticPath?: string;
39
19
  }
40
20
  export interface AIConfig {
41
21
  provider?: 'cursor' | 'copilot' | 'openai' | 'anthropic' | 'none';
@@ -49,6 +29,64 @@ export interface ESLintConfig {
49
29
  extends?: string[];
50
30
  rules?: Linter.RulesRecord;
51
31
  }
32
+ export interface SWCConfig {
33
+ jsc?: {
34
+ parser?: {
35
+ syntax?: 'typescript' | 'ecmascript';
36
+ tsx?: boolean;
37
+ decorators?: boolean;
38
+ dynamicImport?: boolean;
39
+ };
40
+ target?: 'es3' | 'es5' | 'es2015' | 'es2016' | 'es2017' | 'es2018' | 'es2019' | 'es2020' | 'es2021' | 'es2022' | 'es2023';
41
+ transform?: {
42
+ react?: {
43
+ runtime?: 'automatic' | 'classic';
44
+ pragma?: string;
45
+ pragmaFrag?: string;
46
+ throwIfNamespace?: boolean;
47
+ development?: boolean;
48
+ useBuiltins?: boolean;
49
+ refresh?: boolean;
50
+ };
51
+ };
52
+ externalHelpers?: boolean;
53
+ keepClassNames?: boolean;
54
+ loose?: boolean;
55
+ minify?: {
56
+ compress?: boolean;
57
+ mangle?: boolean;
58
+ };
59
+ };
60
+ module?: {
61
+ type?: 'es6' | 'commonjs' | 'amd' | 'umd' | 'systemjs';
62
+ strict?: boolean;
63
+ strictMode?: boolean;
64
+ lazy?: boolean;
65
+ noInterop?: boolean;
66
+ };
67
+ minify?: boolean;
68
+ sourceMaps?: boolean | 'inline';
69
+ inlineSourcesContent?: boolean;
70
+ isModule?: boolean;
71
+ filename?: string;
72
+ configFile?: string;
73
+ swcrc?: boolean;
74
+ env?: {
75
+ targets?: string | string[] | Record<string, string>;
76
+ mode?: 'usage' | 'entry';
77
+ coreJs?: string;
78
+ path?: string;
79
+ debug?: boolean;
80
+ dynamicImport?: boolean;
81
+ loose?: boolean;
82
+ bugfixes?: boolean;
83
+ include?: string[];
84
+ exclude?: string[];
85
+ forceAllTransforms?: boolean;
86
+ modules?: 'amd' | 'umd' | 'systemjs' | 'auto' | false;
87
+ shippedProposals?: boolean;
88
+ };
89
+ }
52
90
  export interface LexConfigType {
53
91
  ai?: AIConfig;
54
92
  configFiles?: string[];
@@ -56,7 +94,6 @@ export interface LexConfigType {
56
94
  entryHTML?: string;
57
95
  entryJs?: string;
58
96
  env?: object;
59
- esbuild?: EsbuildConfig;
60
97
  eslint?: ESLintConfig;
61
98
  gitUrl?: string;
62
99
  jest?: JestConfig;
@@ -70,6 +107,7 @@ export interface LexConfigType {
70
107
  preset?: 'web' | 'node' | 'lambda' | 'mobile';
71
108
  sourceFullPath?: string;
72
109
  sourcePath?: string;
110
+ swc?: SWCConfig;
73
111
  targetEnvironment?: 'node' | 'web';
74
112
  useGraphQl?: boolean;
75
113
  useTypescript?: boolean;