@enact/cli 7.0.0-rc.1 → 7.1.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/CHANGELOG.md CHANGED
@@ -1,3 +1,14 @@
1
+ ## 7.1.0 (July 18, 2025)
2
+
3
+ ### pack
4
+
5
+ * Added `@daltontan/postcss-import-json` PostCSS plugin to process JSON imports in CSS.
6
+ * Fixed `eslintWebpackPluginConfig` to not always run lint in strict mode when `enact pack`.
7
+
8
+ ## 7.0.0 (June 10, 2025)
9
+
10
+ * Updated dependencies.
11
+
1
12
  ## 7.0.0-rc.1 (May 15, 2025)
2
13
 
3
14
  * Removed deprecated postcss plugin `postcss-global-import`.
@@ -15,7 +15,7 @@ const hasJsxRuntime = (() => {
15
15
  }
16
16
  })();
17
17
 
18
- const loadedEnactConfig = process.env.FRAMEWORK ? eslintConfigEnactStrict : eslintConfigEnact;
18
+ const loadedEnactConfig = process.env.FRAMEWORK === true ? eslintConfigEnactStrict : eslintConfigEnact;
19
19
 
20
20
  module.exports = [
21
21
  ...loadedEnactConfig,
@@ -146,7 +146,98 @@ module.exports = function (
146
146
  // the browserslist targets.
147
147
  !useTailwind && require('postcss-normalize'),
148
148
  // Resolution indepedence support
149
- app.ri !== false && require('postcss-resolution-independence')(app.ri)
149
+ app.ri !== false && require('postcss-resolution-independence')(app.ri),
150
+ // Support importing JSON files with ~ alias - custom plugin (must run first)
151
+ {
152
+ postcssPlugin: 'postcss-import-json-tilde',
153
+ Once(root) {
154
+ // Process all @import-json rules with ~ prefix first, before other plugins
155
+ root.walkAtRules('import-json', atRule => {
156
+ let src = atRule.params.slice(1, -1); // Remove quotes
157
+
158
+ // Only handle ~ alias paths
159
+ if (src.startsWith('~')) {
160
+ const packagePath = src.substring(1); // Remove ~
161
+
162
+ try {
163
+ // Use Node.js standard module resolution
164
+ // This mimics webpack's ~ alias behavior
165
+ const currentFileDir = path.dirname(atRule.source.input.file || '');
166
+
167
+ // Try to resolve the module using require.resolve
168
+ // This follows standard Node.js module resolution algorithm
169
+ let resolvedPath;
170
+ try {
171
+ // First try from current file's directory
172
+ resolvedPath = require.resolve(packagePath, {
173
+ paths: [currentFileDir]
174
+ });
175
+ } catch (e) {
176
+ // Fallback to current working directory
177
+ resolvedPath = require.resolve(packagePath, {
178
+ paths: [process.cwd()]
179
+ });
180
+ }
181
+
182
+ // Convert to relative path for the original plugin
183
+ const relativePath = path.relative(currentFileDir, resolvedPath);
184
+ atRule.params = `"${relativePath}"`;
185
+ } catch (error) {
186
+ // If resolution fails, try manual node_modules lookup
187
+ try {
188
+ let currentDir = path.dirname(
189
+ atRule.source.input.file || process.cwd()
190
+ );
191
+ let found = false;
192
+
193
+ // Walk up directories to find node_modules
194
+ while (currentDir !== path.parse(currentDir).root && !found) {
195
+ const moduleDir = path.join(
196
+ currentDir,
197
+ 'node_modules',
198
+ packagePath
199
+ );
200
+ if (fs.existsSync(moduleDir)) {
201
+ const relativePath = path.relative(
202
+ path.dirname(atRule.source.input.file || ''),
203
+ moduleDir
204
+ );
205
+ atRule.params = `"${relativePath}"`;
206
+ found = true;
207
+ break;
208
+ }
209
+ currentDir = path.dirname(currentDir);
210
+ }
211
+
212
+ if (!found) {
213
+ console.warn(`Could not resolve module path: ${packagePath}`);
214
+ }
215
+ } catch (fallbackError) {
216
+ console.warn(
217
+ `Failed to resolve ${packagePath}:`,
218
+ fallbackError.message
219
+ );
220
+ }
221
+ }
222
+ }
223
+ });
224
+ }
225
+ },
226
+ // Support importing JSON files in CSS - original plugin (for non-~ paths)
227
+ [
228
+ '@daltontan/postcss-import-json',
229
+ {
230
+ map: (selector, value) => {
231
+ if (typeof value === 'object' && value !== null && value.$ref) {
232
+ const tokenPath = value.$ref.split('#/')[1];
233
+ const cssVariableName = '--' + tokenPath.replace(/\//g, '-');
234
+
235
+ return `var(${cssVariableName})`;
236
+ }
237
+ return value;
238
+ }
239
+ }
240
+ ]
150
241
  ].filter(Boolean)
151
242
  },
152
243
  sourceMap: shouldUseSourceMap