@nlabs/lex 1.46.2 → 1.47.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.
- package/__mocks__/LexConfig.js +20 -0
- package/__mocks__/boxen.js +7 -0
- package/__mocks__/build.js +16 -0
- package/__mocks__/chalk.js +23 -0
- package/__mocks__/compile.js +8 -0
- package/__mocks__/execa.js +21 -0
- package/__mocks__/ora.js +17 -0
- package/__mocks__/versions.js +12 -0
- package/dist/LexConfig.js +72 -14
- package/dist/commands/ai/ai.js +303 -0
- package/dist/commands/ai/index.js +7 -0
- package/dist/commands/build/build.js +350 -0
- package/dist/commands/clean/clean.js +31 -0
- package/dist/commands/compile/compile.js +195 -0
- package/dist/commands/config/config.js +43 -0
- package/dist/commands/copy/copy.js +38 -0
- package/dist/commands/create/create.js +124 -0
- package/dist/commands/dev/dev.js +70 -0
- package/dist/commands/init/init.js +93 -0
- package/dist/commands/link/link.js +15 -0
- package/dist/commands/lint/lint.js +656 -0
- package/dist/commands/migrate/migrate.js +37 -0
- package/dist/commands/publish/publish.js +104 -0
- package/dist/commands/test/test.js +327 -0
- package/dist/commands/update/update.js +62 -0
- package/dist/commands/upgrade/upgrade.js +47 -0
- package/dist/commands/versions/versions.js +41 -0
- package/dist/create/changelog.js +3 -3
- package/dist/index.js +35 -0
- package/dist/jest.config.lex.d.ts +2 -0
- package/dist/lex.js +25 -22
- package/dist/types.js +1 -0
- package/dist/utils/aiService.js +290 -0
- package/dist/utils/app.js +3 -3
- package/dist/utils/file.js +1 -1
- package/dist/utils/log.js +2 -1
- package/dist/utils/reactShim.js +3 -3
- package/dist/webpack.config.d.ts +2 -0
- package/eslint.config.js +10 -0
- package/index.cjs +20 -0
- package/jest.config.cjs +31 -27
- package/jest.config.lex.js +90 -38
- package/jest.setup.js +5 -0
- package/lex.config.js +50 -0
- package/package.json +69 -52
- package/{.postcssrc.js → postcss.config.js} +21 -9
- package/tsconfig.json +2 -1
- package/webpack.config.js +27 -11
- package/dist/commands/build.js +0 -265
- package/dist/commands/bulid.test.js +0 -317
- package/dist/commands/clean.js +0 -31
- package/dist/commands/clean.test.js +0 -63
- package/dist/commands/compile.js +0 -195
- package/dist/commands/compile.test.js +0 -93
- package/dist/commands/config.js +0 -43
- package/dist/commands/copy.js +0 -38
- package/dist/commands/create.js +0 -120
- package/dist/commands/dev.js +0 -70
- package/dist/commands/init.js +0 -93
- package/dist/commands/link.js +0 -15
- package/dist/commands/lint.js +0 -179
- package/dist/commands/migrate.js +0 -37
- package/dist/commands/publish.js +0 -104
- package/dist/commands/test.js +0 -190
- package/dist/commands/update.js +0 -64
- package/dist/commands/upgrade.js +0 -47
- package/dist/commands/versions.js +0 -41
- package/dist/commands/versions.test.js +0 -49
- package/dist/lint.js +0 -11
- package/jest.setup.ts +0 -3
package/jest.config.lex.js
CHANGED
|
@@ -1,70 +1,122 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { resolve as pathResolve } from
|
|
3
|
-
import { URL } from
|
|
1
|
+
import { existsSync } from 'fs';
|
|
2
|
+
import { resolve as pathResolve } from 'path';
|
|
3
|
+
import { URL } from 'url';
|
|
4
4
|
|
|
5
|
-
import { getNodePath } from
|
|
5
|
+
import { getNodePath } from './dist/utils/file.js';
|
|
6
6
|
|
|
7
7
|
const rootDir = process.cwd();
|
|
8
8
|
const { jest, sourceFullPath, targetEnvironment, useTypescript } = JSON.parse(
|
|
9
|
-
process.env.LEX_CONFIG ||
|
|
9
|
+
process.env.LEX_CONFIG || '{}'
|
|
10
10
|
);
|
|
11
11
|
|
|
12
|
-
const dirName = new URL(
|
|
13
|
-
const nodePath = pathResolve(dirName,
|
|
12
|
+
const dirName = new URL('.', import.meta.url).pathname;
|
|
13
|
+
const nodePath = pathResolve(dirName, './node_modules');
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
// Check if setup files exist
|
|
16
|
+
const lexSetupFile = pathResolve(dirName, './jest.setup.js');
|
|
17
|
+
const projectSetupFile = pathResolve(rootDir, './jest.setup.js');
|
|
18
|
+
const setupFilesAfterEnv = [];
|
|
19
|
+
|
|
20
|
+
// Add Lex's setup file if it exists
|
|
21
|
+
if(existsSync(lexSetupFile)) {
|
|
22
|
+
setupFilesAfterEnv.push(lexSetupFile);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// Add project's setup file if it exists
|
|
26
|
+
if(existsSync(projectSetupFile)) {
|
|
27
|
+
setupFilesAfterEnv.push(projectSetupFile);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
let testEnvironment = 'node';
|
|
16
31
|
let testEnvironmentOptions = {};
|
|
17
32
|
|
|
18
|
-
if
|
|
19
|
-
testEnvironment =
|
|
33
|
+
if(targetEnvironment === 'web') {
|
|
34
|
+
testEnvironment = 'jsdom';
|
|
20
35
|
testEnvironmentOptions = {
|
|
21
|
-
url:
|
|
36
|
+
url: 'http://localhost'
|
|
22
37
|
};
|
|
23
38
|
}
|
|
24
39
|
|
|
25
|
-
let moduleFileExtensions = [
|
|
26
|
-
let testRegex =
|
|
27
|
-
let transformIgnorePatterns = [
|
|
40
|
+
let moduleFileExtensions = ['js', 'json'];
|
|
41
|
+
let testRegex = '(/__tests__/.*|\\.(test|spec))\\.(js)?$';
|
|
42
|
+
let transformIgnorePatterns = [];
|
|
28
43
|
|
|
29
|
-
if
|
|
30
|
-
moduleFileExtensions = [
|
|
31
|
-
testRegex =
|
|
32
|
-
transformIgnorePatterns = [
|
|
44
|
+
if(useTypescript) {
|
|
45
|
+
moduleFileExtensions = ['js', 'ts', 'tsx', 'json'];
|
|
46
|
+
testRegex = '(/__tests__/.*|\\.(test|spec))\\.(ts|tsx)?$';
|
|
47
|
+
transformIgnorePatterns = [];
|
|
33
48
|
}
|
|
34
49
|
|
|
35
|
-
|
|
50
|
+
// Create a base config
|
|
51
|
+
const baseConfig = {
|
|
36
52
|
collectCoverage: true,
|
|
37
|
-
coverageDirectory:
|
|
53
|
+
coverageDirectory: '<rootDir>/coverage',
|
|
38
54
|
coveragePathIgnorePatterns: [
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
55
|
+
'/node_modules/',
|
|
56
|
+
'/dist',
|
|
57
|
+
'/lib',
|
|
58
|
+
'__snapshots__',
|
|
59
|
+
'.d.ts'
|
|
44
60
|
],
|
|
45
|
-
coverageReporters: [
|
|
46
|
-
|
|
61
|
+
coverageReporters: ['html', 'text'],
|
|
62
|
+
extensionsToTreatAsEsm: ['.ts', '.tsx'],
|
|
63
|
+
moduleDirectories: ['node_modules', nodePath],
|
|
47
64
|
moduleFileExtensions,
|
|
48
65
|
moduleNameMapper: {
|
|
49
|
-
|
|
66
|
+
'^chalk$': getNodePath('chalk/source/index.js'),
|
|
67
|
+
'^#ansi-styles$': getNodePath('chalk/node_modules/ansi-styles/index.js'),
|
|
68
|
+
'^#supports-color$': getNodePath('chalk/node_modules/supports-color/index.js'),
|
|
69
|
+
'\\.(css|jpg|png|svg|txt)$': pathResolve(dirName, './emptyModule')
|
|
50
70
|
},
|
|
51
71
|
modulePaths: [rootDir, `${rootDir}/node_modules`, nodePath, sourceFullPath],
|
|
52
|
-
|
|
72
|
+
// preset: 'ts-jest', // Removed to avoid resolution issues
|
|
73
|
+
resolver: pathResolve(dirName, './resolver.cjs'),
|
|
53
74
|
rootDir,
|
|
54
75
|
setupFiles: [
|
|
55
|
-
getNodePath(
|
|
56
|
-
getNodePath(
|
|
76
|
+
getNodePath('core-js'),
|
|
77
|
+
getNodePath('regenerator-runtime/runtime.js')
|
|
57
78
|
],
|
|
79
|
+
// Only add setupFilesAfterEnv if there are entries
|
|
80
|
+
...(setupFilesAfterEnv.length > 0 ? { setupFilesAfterEnv } : {}),
|
|
58
81
|
testEnvironment,
|
|
59
82
|
testEnvironmentOptions,
|
|
60
|
-
testPathIgnorePatterns: [
|
|
83
|
+
testPathIgnorePatterns: ['/node_modules/', `${nodePath}/`],
|
|
61
84
|
testRegex,
|
|
62
|
-
testRunner: getNodePath(
|
|
85
|
+
testRunner: getNodePath('jest-circus/runner.js'),
|
|
63
86
|
transform: {
|
|
64
|
-
...
|
|
65
|
-
|
|
87
|
+
...(useTypescript ? {
|
|
88
|
+
'\\.tsx?$': [getNodePath('ts-jest/dist/index.js'), {
|
|
89
|
+
useESM: true
|
|
90
|
+
}]
|
|
91
|
+
} : {
|
|
92
|
+
'\\.[jt]sx?$': getNodePath('babel-jest')
|
|
93
|
+
}),
|
|
94
|
+
'\\.(gql|graphql)$': getNodePath('jest-transform-graphql')
|
|
66
95
|
},
|
|
67
|
-
transformIgnorePatterns
|
|
68
|
-
|
|
69
|
-
|
|
96
|
+
transformIgnorePatterns: [
|
|
97
|
+
'node_modules/(?!(chalk|@testing-library/jest-dom)/)'
|
|
98
|
+
],
|
|
99
|
+
verbose: true
|
|
70
100
|
};
|
|
101
|
+
|
|
102
|
+
// Deep merge function
|
|
103
|
+
const deepMerge = (target, source) => {
|
|
104
|
+
if(!source) return target;
|
|
105
|
+
const output = { ...target };
|
|
106
|
+
|
|
107
|
+
Object.keys(source).forEach(key => {
|
|
108
|
+
if(source[key] instanceof Object && key in target && target[key] instanceof Object && !Array.isArray(source[key]) && !Array.isArray(target[key])) {
|
|
109
|
+
output[key] = {...target[key], ...source[key]};
|
|
110
|
+
} else if(Array.isArray(source[key]) && Array.isArray(target[key])) {
|
|
111
|
+
// Merge arrays
|
|
112
|
+
output[key] = [...target[key], ...source[key]];
|
|
113
|
+
} else {
|
|
114
|
+
output[key] = source[key];
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
return output;
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
// Export the merged configuration
|
|
122
|
+
export default deepMerge(baseConfig, jest);
|
package/jest.setup.js
ADDED
package/lex.config.js
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lex configuration file
|
|
3
|
+
* This file contains configuration options for the Lex CLI tool
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
// Source and output paths
|
|
8
|
+
sourcePath: './src',
|
|
9
|
+
outputPath: './dist',
|
|
10
|
+
|
|
11
|
+
// Project settings
|
|
12
|
+
useTypescript: true,
|
|
13
|
+
targetEnvironment: 'web',
|
|
14
|
+
preset: 'web',
|
|
15
|
+
|
|
16
|
+
// AI configuration
|
|
17
|
+
// Use this section to configure AI features for lint --fix and ai commands
|
|
18
|
+
ai: {
|
|
19
|
+
// Available providers: 'cursor', 'copilot', 'openai', 'anthropic', 'none'
|
|
20
|
+
provider: 'cursor',
|
|
21
|
+
|
|
22
|
+
// API key for external providers (recommended to use environment variables)
|
|
23
|
+
// apiKey: process.env.OPENAI_API_KEY,
|
|
24
|
+
|
|
25
|
+
// Model configuration (specific to each provider)
|
|
26
|
+
model: 'cursor-code', // For Cursor IDE
|
|
27
|
+
// model: 'copilot-codex', // For GitHub Copilot
|
|
28
|
+
// model: 'gpt-4o', // For OpenAI
|
|
29
|
+
// model: 'claude-3-sonnet', // For Anthropic
|
|
30
|
+
|
|
31
|
+
// Optional parameters
|
|
32
|
+
maxTokens: 4000,
|
|
33
|
+
temperature: 0.1
|
|
34
|
+
},
|
|
35
|
+
|
|
36
|
+
// Build configuration
|
|
37
|
+
esbuild: {
|
|
38
|
+
entryPoints: ['src/index.ts'],
|
|
39
|
+
outdir: 'dist',
|
|
40
|
+
platform: 'node',
|
|
41
|
+
target: 'es2020',
|
|
42
|
+
format: 'esm'
|
|
43
|
+
},
|
|
44
|
+
|
|
45
|
+
// Test configuration
|
|
46
|
+
jest: {
|
|
47
|
+
roots: ['<rootDir>/src'],
|
|
48
|
+
testEnvironment: 'node'
|
|
49
|
+
}
|
|
50
|
+
};
|
package/package.json
CHANGED
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nlabs/lex",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.47.0",
|
|
4
4
|
"description": "Lex",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"bin": "./dist/lex.js",
|
|
8
|
+
"main": "./dist/index.js",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"import": "./dist/index.js",
|
|
12
|
+
"require": "./index.cjs"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"types": "./dist/index.d.ts",
|
|
8
16
|
"keywords": [
|
|
9
17
|
"arkhamjs",
|
|
10
18
|
"lex",
|
|
@@ -28,11 +36,16 @@
|
|
|
28
36
|
"node": ">=22"
|
|
29
37
|
},
|
|
30
38
|
"scripts": {
|
|
31
|
-
"build": "NODE_ENV=production && rm -rf dist && esbuild
|
|
39
|
+
"build": "NODE_ENV=production && rm -rf dist && esbuild $(find src -name '*.ts' -not -name '*.test.ts' -not -name '*.spec.ts') --platform=node --outdir=./dist --sourcemap=inline --target=node22 --format=esm --packages=external && npm run declarations",
|
|
40
|
+
"build:all": "npm run build && npm run build:ai",
|
|
41
|
+
"build:ai": "NODE_ENV=production && esbuild packages/lex/src/commands/ai/*.ts --platform=node --outdir=./dist/commands/ai --sourcemap=inline --target=node22 --format=esm --packages=external",
|
|
42
|
+
"declarations": "tsc --declaration --emitDeclarationOnly --outDir dist",
|
|
32
43
|
"clean": "rm -rf dist node_modules package-lock.json *.log coverage",
|
|
33
44
|
"compile": "tsc -p tsconfig.build.json",
|
|
34
45
|
"env": "LEX_CONFIG='{\"useTypescript\":true}'",
|
|
35
|
-
"lint": "eslint ./src --
|
|
46
|
+
"lint": "eslint ./src --fix || true",
|
|
47
|
+
"lint:ai": "node ./dist/lex.js lint --fix || true",
|
|
48
|
+
"lint:rebuild": "npm run build && npm run lint:ai",
|
|
36
49
|
"prepublishOnly": "npm run build",
|
|
37
50
|
"publish:major": "npm version major && npm publish",
|
|
38
51
|
"publish:minor": "npm version minor && npm publish",
|
|
@@ -43,99 +56,105 @@
|
|
|
43
56
|
"watch": "NODE_ENV=development rm -rf dist && npm run compile -w"
|
|
44
57
|
},
|
|
45
58
|
"dependencies": {
|
|
46
|
-
"@babel/core": "^7.
|
|
47
|
-
"@babel/preset-env": "^7.
|
|
48
|
-
"@babel/preset-typescript": "7.
|
|
59
|
+
"@babel/core": "^7.27.4",
|
|
60
|
+
"@babel/preset-env": "^7.27.2",
|
|
61
|
+
"@babel/preset-typescript": "7.27.1",
|
|
49
62
|
"@luckycatfactory/esbuild-graphql-loader": "^3.8.1",
|
|
50
63
|
"@nlabs/execa-mock": "*",
|
|
51
64
|
"@nlabs/webpack-plugin-static-site": "*",
|
|
52
|
-
"
|
|
65
|
+
"@tailwindcss/postcss": "4.1.10",
|
|
66
|
+
"@testing-library/jest-dom": "^6.6.3",
|
|
67
|
+
"acorn": "^8.15.0",
|
|
53
68
|
"ajv": "^8.17.1",
|
|
54
69
|
"assert": "^2.1.0",
|
|
55
|
-
"autoprefixer": "^10.4.
|
|
56
|
-
"babel-jest": "^
|
|
70
|
+
"autoprefixer": "^10.4.21",
|
|
71
|
+
"babel-jest": "^30.0.2",
|
|
57
72
|
"boxen": "8.0.1",
|
|
58
73
|
"buffer": "^6.0.3",
|
|
59
|
-
"caniuse-lite": "1.0.
|
|
74
|
+
"caniuse-lite": "1.0.30001726",
|
|
60
75
|
"chalk": "^5.4.1",
|
|
61
|
-
"commander": "^
|
|
76
|
+
"commander": "^14.0.0",
|
|
62
77
|
"compare-versions": "^6.1.1",
|
|
63
78
|
"compression-webpack-plugin": "^11.1.0",
|
|
64
79
|
"config-webpack-plugin": "^1.1.0",
|
|
65
|
-
"copy-webpack-plugin": "^
|
|
66
|
-
"core-js": "^3.
|
|
80
|
+
"copy-webpack-plugin": "^13.0.0",
|
|
81
|
+
"core-js": "^3.43.0",
|
|
67
82
|
"crypto-browserify": "^3.12.1",
|
|
68
83
|
"css-loader": "^7.1.2",
|
|
69
|
-
"cssnano": "^7.0.
|
|
84
|
+
"cssnano": "^7.0.7",
|
|
70
85
|
"dotenv-webpack": "^8.1.0",
|
|
71
|
-
"download-npm-package": "^1.
|
|
72
|
-
"esbuild": "0.
|
|
73
|
-
"esbuild-loader": "4.
|
|
74
|
-
"eslint": "
|
|
75
|
-
"eslint-config-styleguidejs": "^
|
|
76
|
-
"execa": "9.
|
|
86
|
+
"download-npm-package": "^3.1.12",
|
|
87
|
+
"esbuild": "0.25.5",
|
|
88
|
+
"esbuild-loader": "4.3.0",
|
|
89
|
+
"eslint": "9.29.0",
|
|
90
|
+
"eslint-config-styleguidejs": "^4.0.10",
|
|
91
|
+
"execa": "9.6.0",
|
|
77
92
|
"exports-loader": "^5.0.0",
|
|
78
93
|
"favicons-webpack-plugin": "^6.0.1",
|
|
79
94
|
"file-loader": "^6.2.0",
|
|
80
95
|
"find-file-up": "^2.0.1",
|
|
81
|
-
"glob": "^11.0.
|
|
82
|
-
"graphql": "^16.
|
|
96
|
+
"glob": "^11.0.3",
|
|
97
|
+
"graphql": "^16.11.0",
|
|
83
98
|
"graphql-tag": "^2.12.6",
|
|
84
99
|
"html-loader": "^5.1.0",
|
|
85
100
|
"html-webpack-plugin": "^5.6.3",
|
|
86
101
|
"https-browserify": "^1.0.0",
|
|
87
102
|
"imports-loader": "^5.0.0",
|
|
88
|
-
"jest": "
|
|
89
|
-
"jest-circus": "
|
|
90
|
-
"jest-cli": "
|
|
91
|
-
"jest-environment-jsdom": "
|
|
103
|
+
"jest": "30.0.3",
|
|
104
|
+
"jest-circus": "30.0.3",
|
|
105
|
+
"jest-cli": "30.0.3",
|
|
106
|
+
"jest-environment-jsdom": "30.0.2",
|
|
92
107
|
"jest-transform-graphql": "2.1.0",
|
|
93
108
|
"json-d-ts": "1.0.1",
|
|
94
109
|
"latest-version": "9.0.0",
|
|
95
110
|
"lodash": "^4.17.21",
|
|
96
|
-
"luxon": "^3.
|
|
111
|
+
"luxon": "^3.6.1",
|
|
97
112
|
"net": "^1.0.2",
|
|
98
|
-
"npm-check-updates": "^
|
|
113
|
+
"npm-check-updates": "^18.0.1",
|
|
114
|
+
"openai": "^5.7.0",
|
|
99
115
|
"ora": "8.2.0",
|
|
100
116
|
"os-browserify": "^0.3.0",
|
|
101
117
|
"path-browserify": "^1.0.1",
|
|
102
118
|
"postcss-browser-reporter": "^0.7.0",
|
|
103
|
-
"postcss-cli": "^11.0.
|
|
104
|
-
"postcss-custom-properties": "^14.0.
|
|
119
|
+
"postcss-cli": "^11.0.1",
|
|
120
|
+
"postcss-custom-properties": "^14.0.6",
|
|
105
121
|
"postcss-flexbugs-fixes": "^5.0.2",
|
|
106
122
|
"postcss-for": "^2.1.1",
|
|
107
123
|
"postcss-hash": "^3.0.0",
|
|
108
|
-
"postcss-import": "16.1.
|
|
124
|
+
"postcss-import": "16.1.1",
|
|
109
125
|
"postcss-loader": "^8.1.1",
|
|
110
|
-
"postcss-nesting": "^13.0.
|
|
126
|
+
"postcss-nesting": "^13.0.2",
|
|
111
127
|
"postcss-percentage": "^0.0.0",
|
|
112
|
-
"postcss-preset-env": "^10.
|
|
128
|
+
"postcss-preset-env": "^10.2.3",
|
|
113
129
|
"postcss-simple-vars": "^7.0.1",
|
|
114
|
-
"postcss-svgo": "7.0.
|
|
130
|
+
"postcss-svgo": "7.0.2",
|
|
115
131
|
"postcss-url": "10.1.3",
|
|
116
132
|
"process": "^0.11.10",
|
|
117
|
-
"react": "^19.
|
|
118
|
-
"react-dom": "^19.
|
|
133
|
+
"react": "^19.1.0",
|
|
134
|
+
"react-dom": "^19.1.0",
|
|
119
135
|
"regenerator-runtime": "^0.14.1",
|
|
120
136
|
"resolve": "^1.22.10",
|
|
121
137
|
"rimraf": "^6.0.1",
|
|
122
|
-
"semver": "^7.7.
|
|
138
|
+
"semver": "^7.7.2",
|
|
123
139
|
"source-map-loader": "^5.0.0",
|
|
124
140
|
"source-map-support": "^0.5.21",
|
|
125
141
|
"speed-measure-webpack-plugin": "^1.5.0",
|
|
126
|
-
"static-site-generator-webpack-plugin": "^3.
|
|
142
|
+
"static-site-generator-webpack-plugin": "^3.4.2",
|
|
127
143
|
"stream-browserify": "^3.0.0",
|
|
128
144
|
"stream-http": "^3.2.0",
|
|
129
145
|
"style-loader": "^4.0.0",
|
|
130
146
|
"svg-spritemap-webpack-plugin": "^4.7.0",
|
|
131
|
-
"svgo": "
|
|
147
|
+
"svgo": "4.0.0",
|
|
132
148
|
"tls": "^0.0.1",
|
|
133
|
-
"ts-jest": "29.
|
|
149
|
+
"ts-jest": "29.4.0",
|
|
134
150
|
"ts-node": "^10.9.2",
|
|
135
|
-
"
|
|
151
|
+
"tsconfig-paths-webpack-plugin": "^4.2.0",
|
|
152
|
+
"typescript": "5.8.3",
|
|
153
|
+
"unicorn-magic": "^0.3.0",
|
|
136
154
|
"url-loader": "^4.1.1",
|
|
137
155
|
"util": "^0.12.5",
|
|
138
|
-
"
|
|
156
|
+
"vm-browserify": "^1.1.2",
|
|
157
|
+
"webpack": "5.99.9",
|
|
139
158
|
"webpack-bundle-analyzer": "^4.10.2",
|
|
140
159
|
"webpack-cli": "^6.0.1",
|
|
141
160
|
"webpack-merge": "^6.0.1",
|
|
@@ -143,19 +162,17 @@
|
|
|
143
162
|
"webpack-plugin-serve": "^1.6.0"
|
|
144
163
|
},
|
|
145
164
|
"devDependencies": {
|
|
146
|
-
"@babel/plugin-transform-runtime": "^7.
|
|
147
|
-
"@babel/preset-react": "^7.
|
|
165
|
+
"@babel/plugin-transform-runtime": "^7.27.4",
|
|
166
|
+
"@babel/preset-react": "^7.27.1",
|
|
148
167
|
"@nlabs/execa-mock": "^1.41.0",
|
|
149
|
-
"@types/jest": "^
|
|
150
|
-
"@types/luxon": "^3.
|
|
151
|
-
"@types/node": "^
|
|
168
|
+
"@types/jest": "^30.0.0",
|
|
169
|
+
"@types/luxon": "^3.6.2",
|
|
170
|
+
"@types/node": "^24.0.4",
|
|
152
171
|
"@types/ora": "^3.2.0",
|
|
153
|
-
"@types/react": "^19.
|
|
172
|
+
"@types/react": "^19.1.8",
|
|
154
173
|
"@types/webpack": "^5.28.5",
|
|
155
|
-
"babel-plugin-transform-import-meta": "^2.3.
|
|
156
|
-
"babel-plugin-transform-vite-meta-env": "^1.0.3"
|
|
157
|
-
"eslint": "^9.19.0",
|
|
158
|
-
"eslint-config-styleguidejs": "^3.2.1"
|
|
174
|
+
"babel-plugin-transform-import-meta": "^2.3.3",
|
|
175
|
+
"babel-plugin-transform-vite-meta-env": "^1.0.3"
|
|
159
176
|
},
|
|
160
177
|
"gitHead": "0f5fb22fc0f0ab1abab5adf62afed24c7c87e4a8"
|
|
161
178
|
}
|
|
@@ -2,24 +2,29 @@
|
|
|
2
2
|
* Copyright (c) 2018-Present, Nitrogen Labs, Inc.
|
|
3
3
|
* Copyrights licensed under the MIT License. See the accompanying LICENSE file for terms.
|
|
4
4
|
*/
|
|
5
|
+
import tailwindcss from '@tailwindcss/postcss';
|
|
5
6
|
import autoprefixer from 'autoprefixer';
|
|
6
7
|
import cssnano from 'cssnano';
|
|
7
8
|
import postcssBrowserReporter from 'postcss-browser-reporter';
|
|
8
9
|
import postcssCustomProperties from 'postcss-custom-properties';
|
|
9
10
|
import postcssFlexbugsFixes from 'postcss-flexbugs-fixes';
|
|
10
11
|
import postcssFor from 'postcss-for';
|
|
12
|
+
import postcssHash from 'postcss-hash';
|
|
11
13
|
import postcssImport from 'postcss-import';
|
|
12
14
|
import postcssNesting from 'postcss-nesting';
|
|
13
15
|
import postcssPercentage from 'postcss-percentage';
|
|
14
16
|
import postcssPresetEnv from 'postcss-preset-env';
|
|
17
|
+
import postcssSimpleVars from 'postcss-simple-vars';
|
|
18
|
+
import postcssSvgo from 'postcss-svgo';
|
|
15
19
|
import postcssUrl from 'postcss-url';
|
|
16
|
-
import {
|
|
20
|
+
import {default as webpack} from 'webpack';
|
|
17
21
|
|
|
18
22
|
const config = {
|
|
19
23
|
plugins: [
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
24
|
+
tailwindcss(),
|
|
25
|
+
postcssImport({addDependencyTo: webpack}),
|
|
26
|
+
postcssUrl(),
|
|
27
|
+
postcssFor(),
|
|
23
28
|
postcssPercentage({
|
|
24
29
|
floor: true,
|
|
25
30
|
precision: 9,
|
|
@@ -30,16 +35,23 @@ const config = {
|
|
|
30
35
|
strict: false,
|
|
31
36
|
warnings: false
|
|
32
37
|
}),
|
|
33
|
-
autoprefixer,
|
|
34
|
-
postcssNesting,
|
|
35
|
-
postcssFlexbugsFixes,
|
|
38
|
+
autoprefixer(),
|
|
39
|
+
postcssNesting(),
|
|
40
|
+
postcssFlexbugsFixes(),
|
|
36
41
|
postcssPresetEnv({
|
|
37
42
|
browsers: ['last 5 versions'],
|
|
38
43
|
stage: 0
|
|
39
44
|
}),
|
|
40
45
|
cssnano({autoprefixer: false}),
|
|
41
|
-
postcssBrowserReporter
|
|
46
|
+
postcssBrowserReporter(),
|
|
47
|
+
postcssSimpleVars(),
|
|
48
|
+
postcssSvgo()
|
|
49
|
+
// postcssHash({
|
|
50
|
+
// algorithm: 'md5',
|
|
51
|
+
// trim: 10,
|
|
52
|
+
// manifest: './build/manifest.json'
|
|
53
|
+
// })
|
|
42
54
|
]
|
|
43
|
-
}
|
|
55
|
+
};
|
|
44
56
|
|
|
45
57
|
export default config;
|
package/tsconfig.json
CHANGED
package/webpack.config.js
CHANGED
|
@@ -2,11 +2,8 @@
|
|
|
2
2
|
* Copyright (c) 2018-Present, Nitrogen Labs, Inc.
|
|
3
3
|
* Copyrights licensed under the MIT License. See the accompanying LICENSE file for terms.
|
|
4
4
|
*/
|
|
5
|
-
import {existsSync} from 'fs';
|
|
6
|
-
import {resolve as pathResolve} from 'path';
|
|
7
|
-
import {URL} from 'url';
|
|
8
|
-
|
|
9
5
|
import {StaticSitePlugin} from '@nlabs/webpack-plugin-static-site';
|
|
6
|
+
import tailwindcss from '@tailwindcss/postcss';
|
|
10
7
|
import autoprefixer from 'autoprefixer';
|
|
11
8
|
import CompressionWebpackPlugin from 'compression-webpack-plugin';
|
|
12
9
|
import CopyWebpackPlugin from 'copy-webpack-plugin';
|
|
@@ -14,9 +11,11 @@ import cssnano from 'cssnano';
|
|
|
14
11
|
import DotenvPlugin from 'dotenv-webpack';
|
|
15
12
|
import {EsbuildPlugin} from 'esbuild-loader';
|
|
16
13
|
import FaviconsWebpackPlugin from 'favicons-webpack-plugin';
|
|
14
|
+
import {existsSync} from 'fs';
|
|
17
15
|
import {sync as globSync} from 'glob';
|
|
18
16
|
import HtmlWebPackPlugin from 'html-webpack-plugin';
|
|
19
17
|
import isEmpty from 'lodash/isEmpty.js';
|
|
18
|
+
import {resolve as pathResolve} from 'path';
|
|
20
19
|
import postcssBrowserReporter from 'postcss-browser-reporter';
|
|
21
20
|
import postcssCustomProperties from 'postcss-custom-properties';
|
|
22
21
|
import postcssFlexbugsFixes from 'postcss-flexbugs-fixes';
|
|
@@ -27,6 +26,8 @@ import postcssPercentage from 'postcss-percentage';
|
|
|
27
26
|
import postcssPresetEnv from 'postcss-preset-env';
|
|
28
27
|
import postcssUrl from 'postcss-url';
|
|
29
28
|
import SVGSpriteMapPlugin from 'svg-spritemap-webpack-plugin';
|
|
29
|
+
import TsconfigPathsPlugin from 'tsconfig-paths-webpack-plugin';
|
|
30
|
+
import {URL} from 'url';
|
|
30
31
|
import {default as webpack} from 'webpack';
|
|
31
32
|
import {BundleAnalyzerPlugin} from 'webpack-bundle-analyzer';
|
|
32
33
|
import {merge} from 'webpack-merge';
|
|
@@ -158,6 +159,13 @@ if(outputFile) {
|
|
|
158
159
|
outputFilename = '[name].js';
|
|
159
160
|
}
|
|
160
161
|
|
|
162
|
+
const resolvePlugins = [];
|
|
163
|
+
if(existsSync(`${sourceFullPath}/tsconfig.json`)) {
|
|
164
|
+
resolvePlugins.push(new TsconfigPathsPlugin({
|
|
165
|
+
configFile: `${sourceFullPath}/../tsconfig.json`
|
|
166
|
+
}));
|
|
167
|
+
}
|
|
168
|
+
|
|
161
169
|
// Loader paths
|
|
162
170
|
const esbuildLoaderPath = relativeNodePath('esbuild-loader', dirName);
|
|
163
171
|
const cssLoaderPath = relativeNodePath('css-loader', dirName);
|
|
@@ -266,26 +274,32 @@ export default (webpackEnv, webpackOptions) => {
|
|
|
266
274
|
postcssOptions: {
|
|
267
275
|
plugins: [
|
|
268
276
|
postcssImport({addDependencyTo: webpack}),
|
|
269
|
-
postcssUrl,
|
|
270
|
-
postcssFor,
|
|
277
|
+
postcssUrl(),
|
|
278
|
+
postcssFor(),
|
|
271
279
|
postcssPercentage({
|
|
272
280
|
floor: true,
|
|
273
281
|
precision: 9,
|
|
274
282
|
trimTrailingZero: true
|
|
275
283
|
}),
|
|
276
284
|
postcssCustomProperties({
|
|
285
|
+
extensions: ['.css'],
|
|
286
|
+
inject: {
|
|
287
|
+
insertAt: 'top'
|
|
288
|
+
},
|
|
289
|
+
minimize: true,
|
|
277
290
|
preserve: false,
|
|
278
291
|
strict: false,
|
|
279
292
|
warnings: false
|
|
280
293
|
}),
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
294
|
+
tailwindcss(),
|
|
295
|
+
autoprefixer(),
|
|
296
|
+
postcssNesting(),
|
|
297
|
+
postcssFlexbugsFixes(),
|
|
284
298
|
postcssPresetEnv({
|
|
285
299
|
stage: 0
|
|
286
300
|
}),
|
|
287
301
|
cssnano({autoprefixer: false}),
|
|
288
|
-
postcssBrowserReporter
|
|
302
|
+
postcssBrowserReporter()
|
|
289
303
|
]
|
|
290
304
|
}
|
|
291
305
|
}
|
|
@@ -374,10 +388,12 @@ export default (webpackEnv, webpackOptions) => {
|
|
|
374
388
|
path: relativeNodePath('path-browserify', dirName),
|
|
375
389
|
process: relativeNodePath('process/browser.js', dirName),
|
|
376
390
|
stream: relativeNodePath('stream-browserify', dirName),
|
|
377
|
-
util: relativeNodePath('util', dirName)
|
|
391
|
+
util: relativeNodePath('util', dirName),
|
|
392
|
+
vm: relativeNodePath('vm-browserify', dirName)
|
|
378
393
|
},
|
|
379
394
|
mainFiles: ['index'],
|
|
380
395
|
modules: [sourceFullPath, 'node_modules', relativeNodePath('', dirName)],
|
|
396
|
+
plugins: resolvePlugins,
|
|
381
397
|
unsafeCache: {
|
|
382
398
|
node_modules: true
|
|
383
399
|
}
|