@adobe-commerce/elsie 1.7.0 → 1.7.1-alpha-20260316115040
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 +7 -0
- package/config/vite.mjs +50 -6
- package/package.json +8 -7
- package/src/docs/API/graphql.mdx +44 -0
- package/post-release.sh +0 -5
package/CHANGELOG.md
ADDED
package/config/vite.mjs
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
* accompanying it.
|
|
8
8
|
*******************************************************************/
|
|
9
9
|
|
|
10
|
+
import fs from 'fs';
|
|
10
11
|
import { glob } from 'glob';
|
|
11
12
|
import { createRequire } from 'node:module';
|
|
12
13
|
import path from 'path';
|
|
@@ -15,11 +16,11 @@ import { loadEnv } from 'vite';
|
|
|
15
16
|
// Plugins
|
|
16
17
|
import preact from '@preact/preset-vite';
|
|
17
18
|
import { visualizer } from 'rollup-plugin-visualizer';
|
|
19
|
+
import banner from 'vite-plugin-banner';
|
|
18
20
|
import cssInjectedByJsPlugin from 'vite-plugin-css-injected-by-js';
|
|
19
21
|
import dts from 'vite-plugin-dts';
|
|
20
22
|
import svgr from 'vite-plugin-svgr';
|
|
21
23
|
import tsconfigPaths from 'vite-tsconfig-paths';
|
|
22
|
-
import banner from 'vite-plugin-banner';
|
|
23
24
|
|
|
24
25
|
// Load .env files
|
|
25
26
|
const env = loadEnv('', process.cwd());
|
|
@@ -300,15 +301,21 @@ export default {
|
|
|
300
301
|
const chunk = bundle[fileName];
|
|
301
302
|
|
|
302
303
|
// Process both .map files and JS/TS files with sourcemaps
|
|
303
|
-
if (
|
|
304
|
-
|
|
304
|
+
if (
|
|
305
|
+
(chunk.type === 'asset' && fileName.endsWith('.map')) ||
|
|
306
|
+
(chunk.type === 'chunk' && chunk.map)
|
|
307
|
+
) {
|
|
305
308
|
try {
|
|
306
309
|
// Get the sourcemap object - either from the asset source or the chunk's map
|
|
307
|
-
const map =
|
|
310
|
+
const map =
|
|
311
|
+
chunk.type === 'asset' ? JSON.parse(chunk.source) : chunk.map;
|
|
308
312
|
|
|
309
313
|
if (map.sources) {
|
|
310
314
|
map.sources = map.sources.map((input) => {
|
|
311
|
-
return input.replace(
|
|
315
|
+
return input.replace(
|
|
316
|
+
/(?:\.\.?\/)+src\//,
|
|
317
|
+
`/${packageJSON.name}/src/`
|
|
318
|
+
);
|
|
312
319
|
});
|
|
313
320
|
|
|
314
321
|
// Update the sourcemap in the appropriate place
|
|
@@ -323,7 +330,44 @@ export default {
|
|
|
323
330
|
}
|
|
324
331
|
}
|
|
325
332
|
}
|
|
326
|
-
}
|
|
333
|
+
},
|
|
334
|
+
},
|
|
335
|
+
|
|
336
|
+
{
|
|
337
|
+
name: 'generate-dist-package-json',
|
|
338
|
+
generateBundle() {
|
|
339
|
+
this.emitFile({
|
|
340
|
+
type: 'asset',
|
|
341
|
+
fileName: 'package.json',
|
|
342
|
+
source: JSON.stringify(
|
|
343
|
+
{
|
|
344
|
+
name: packageJSON.name,
|
|
345
|
+
version: packageJSON.version,
|
|
346
|
+
license: packageJSON.license,
|
|
347
|
+
},
|
|
348
|
+
null,
|
|
349
|
+
2
|
|
350
|
+
),
|
|
351
|
+
});
|
|
352
|
+
|
|
353
|
+
this.emitFile({
|
|
354
|
+
type: 'asset',
|
|
355
|
+
fileName: 'LICENSE.md',
|
|
356
|
+
source: fs.readFileSync(
|
|
357
|
+
path.resolve(process.cwd(), '../../LICENSE.md'),
|
|
358
|
+
'utf-8'
|
|
359
|
+
),
|
|
360
|
+
});
|
|
361
|
+
|
|
362
|
+
const changelogPath = path.resolve(process.cwd(), 'CHANGELOG.md');
|
|
363
|
+
if (fs.existsSync(changelogPath)) {
|
|
364
|
+
this.emitFile({
|
|
365
|
+
type: 'asset',
|
|
366
|
+
fileName: 'CHANGELOG.md',
|
|
367
|
+
source: fs.readFileSync(changelogPath, 'utf-8'),
|
|
368
|
+
});
|
|
369
|
+
}
|
|
370
|
+
},
|
|
327
371
|
},
|
|
328
372
|
|
|
329
373
|
process.env.ANALYZE
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adobe-commerce/elsie",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.1-alpha-20260316115040",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
5
5
|
"description": "Domain Package SDK",
|
|
6
6
|
"engines": {
|
|
@@ -23,14 +23,15 @@
|
|
|
23
23
|
"build-storybook": "storybook build --disable-telemetry",
|
|
24
24
|
"test-storybook": "test-storybook",
|
|
25
25
|
"test-storybook-ci": "concurrently -k -s first -n \"SB,TEST\" -c \"magenta,blue\" \"npx http-server storybook-static --port 6006 --silent\" \"npx wait-on tcp:127.0.0.1:6006 && test-storybook\"",
|
|
26
|
-
"cleanup": "rimraf dist"
|
|
26
|
+
"cleanup": "rimraf dist",
|
|
27
|
+
"postpublish": "node ./scripts/publish-dist.mjs"
|
|
27
28
|
},
|
|
28
29
|
"devDependencies": {
|
|
29
|
-
"@adobe-commerce/event-bus": "
|
|
30
|
-
"@adobe-commerce/fetch-graphql": "
|
|
31
|
-
"@adobe-commerce/recaptcha": "
|
|
32
|
-
"@adobe-commerce/storefront-design": "
|
|
33
|
-
"@dropins/build-tools": "
|
|
30
|
+
"@adobe-commerce/event-bus": "1.0.2-alpha-20260316115040",
|
|
31
|
+
"@adobe-commerce/fetch-graphql": "1.2.4-alpha-20260316115040",
|
|
32
|
+
"@adobe-commerce/recaptcha": "1.0.4-alpha-20260316115040",
|
|
33
|
+
"@adobe-commerce/storefront-design": "1.0.1-alpha-20260316115040",
|
|
34
|
+
"@dropins/build-tools": "1.0.2-alpha-20260316115040",
|
|
34
35
|
"preact": "~10.22.1",
|
|
35
36
|
"vite-plugin-banner": "^0.8.0"
|
|
36
37
|
},
|
package/src/docs/API/graphql.mdx
CHANGED
|
@@ -169,6 +169,50 @@ An array of string or template literal with operations.
|
|
|
169
169
|
- If new variables are provided, the new variable will be added. i.e. `favorites(page: 1, offset: 5) { ... }`.
|
|
170
170
|
- If the existing variables are changed, the new variables will be used. i.e. `favorites(page: 2) { ... }`.
|
|
171
171
|
|
|
172
|
+
#### skipFragments: string[]
|
|
173
|
+
|
|
174
|
+
An array of fragment names to remove from the drop-in's exported fragments file. When a fragment name is listed in `skipFragments`:
|
|
175
|
+
|
|
176
|
+
- The fragment definition is removed from its exported variable.
|
|
177
|
+
- All references (fragment spreads) to the skipped fragment are also removed from other operations in the same file.
|
|
178
|
+
|
|
179
|
+
```js
|
|
180
|
+
import { overrideGQLOperations } from '@dropins/build-tools/gql-extend.js';
|
|
181
|
+
|
|
182
|
+
overrideGQLOperations([
|
|
183
|
+
{
|
|
184
|
+
npm: '@dropins/my-dropin',
|
|
185
|
+
skipFragments: ['MY_FRAGMENT'],
|
|
186
|
+
},
|
|
187
|
+
]);
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
#### Using `skipFragments` and `operations` together
|
|
191
|
+
|
|
192
|
+
When both `skipFragments` and `operations` are provided for the same fragment name, the fragment is **fully replaced** rather than merged:
|
|
193
|
+
|
|
194
|
+
1. `skipFragments` removes the original fragment definition entirely.
|
|
195
|
+
2. `operations` writes the new fragment definition directly, without merging it with the (now-removed) original.
|
|
196
|
+
|
|
197
|
+
```js
|
|
198
|
+
import { overrideGQLOperations } from '@dropins/build-tools/gql-extend.js';
|
|
199
|
+
|
|
200
|
+
overrideGQLOperations([
|
|
201
|
+
{
|
|
202
|
+
npm: '@dropins/my-dropin',
|
|
203
|
+
skipFragments: ['MY_FRAGMENT'],
|
|
204
|
+
operations: [`
|
|
205
|
+
fragment MY_FRAGMENT on FragmentInterface {
|
|
206
|
+
fragmentName
|
|
207
|
+
}
|
|
208
|
+
`],
|
|
209
|
+
},
|
|
210
|
+
]);
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
In the example above, the original `MY_FRAGMENT` is fully removed by `skipFragments` and then replaced by the new definition containing only `fragmentName`.
|
|
214
|
+
|
|
215
|
+
> **Note:** If `skipFragments` is used without a matching `operations` entry, the fragment is simply removed (emptied). If `operations` is used without `skipFragments`, the new fields are **merged** into the existing fragment definition.
|
|
172
216
|
|
|
173
217
|
```js
|
|
174
218
|
import overrideGQLOperations from '@dropins/build-tools/gql-extend.js';
|
package/post-release.sh
DELETED