@graphcommerce/next-config 10.1.0-canary.4 → 10.1.0-canary.6
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 +4 -0
- package/dist/index.js +11 -11
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
package/dist/index.js
CHANGED
|
@@ -428,7 +428,7 @@ function extractValue(node, path, optional = false) {
|
|
|
428
428
|
}
|
|
429
429
|
}
|
|
430
430
|
function extractExports(module) {
|
|
431
|
-
const exports
|
|
431
|
+
const exports = {};
|
|
432
432
|
const errors = [];
|
|
433
433
|
for (const moduleItem of module.body) {
|
|
434
434
|
switch (moduleItem.type) {
|
|
@@ -442,19 +442,19 @@ function extractExports(module) {
|
|
|
442
442
|
switch (moduleItem.declaration.type) {
|
|
443
443
|
case "ClassDeclaration":
|
|
444
444
|
case "FunctionDeclaration":
|
|
445
|
-
exports
|
|
445
|
+
exports[moduleItem.declaration.identifier.value] = RUNTIME_VALUE;
|
|
446
446
|
break;
|
|
447
447
|
case "VariableDeclaration":
|
|
448
448
|
moduleItem.declaration.declarations.forEach((decl) => {
|
|
449
449
|
if (isIdentifier(decl.id) && decl.init) {
|
|
450
|
-
exports
|
|
450
|
+
exports[decl.id.value] = extractValue(decl.init, void 0, true);
|
|
451
451
|
}
|
|
452
452
|
});
|
|
453
453
|
break;
|
|
454
454
|
}
|
|
455
455
|
}
|
|
456
456
|
}
|
|
457
|
-
return [exports
|
|
457
|
+
return [exports, errors];
|
|
458
458
|
}
|
|
459
459
|
|
|
460
460
|
const pluginConfigParsed = z.object({
|
|
@@ -468,7 +468,7 @@ function nonNullable(value) {
|
|
|
468
468
|
}
|
|
469
469
|
const isObject = (input) => typeof input === "object" && input !== null && !Array.isArray(input);
|
|
470
470
|
function parseStructure(ast, gcConfig, sourceModule) {
|
|
471
|
-
const [exports
|
|
471
|
+
const [exports, errors] = extractExports(ast);
|
|
472
472
|
if (errors.length) console.error("Plugin error for", errors.join("\n"));
|
|
473
473
|
const {
|
|
474
474
|
config: moduleConfig,
|
|
@@ -479,7 +479,7 @@ function parseStructure(ast, gcConfig, sourceModule) {
|
|
|
479
479
|
plugin,
|
|
480
480
|
Plugin,
|
|
481
481
|
...rest
|
|
482
|
-
} = exports
|
|
482
|
+
} = exports;
|
|
483
483
|
const exportVals = Object.keys(rest);
|
|
484
484
|
if (component && !moduleConfig) exportVals.push("Plugin");
|
|
485
485
|
if (func && !moduleConfig) exportVals.push("plugin");
|
|
@@ -513,7 +513,7 @@ function parseStructure(ast, gcConfig, sourceModule) {
|
|
|
513
513
|
}
|
|
514
514
|
}
|
|
515
515
|
const val = {
|
|
516
|
-
targetExport: exports
|
|
516
|
+
targetExport: exports.component || exports.func || parsed.data.export,
|
|
517
517
|
sourceModule,
|
|
518
518
|
sourceExport: parsed.data.export,
|
|
519
519
|
targetModule: parsed.data.module,
|
|
@@ -623,12 +623,12 @@ function parseAndFindExport(resolved, findExport, resolve) {
|
|
|
623
623
|
}
|
|
624
624
|
}
|
|
625
625
|
}
|
|
626
|
-
const exports
|
|
626
|
+
const exports = ast.body.filter((node) => node.type === "ExportAllDeclaration").sort((a, b) => {
|
|
627
627
|
const probablyA = a.source.value.includes(findExport);
|
|
628
628
|
const probablyB = b.source.value.includes(findExport);
|
|
629
629
|
return probablyA === probablyB ? 0 : probablyA ? -1 : 1;
|
|
630
630
|
});
|
|
631
|
-
for (const node of exports
|
|
631
|
+
for (const node of exports) {
|
|
632
632
|
const isRelative = node.source.value.startsWith(".");
|
|
633
633
|
if (isRelative) {
|
|
634
634
|
const d = resolved.dependency === resolved.denormalized ? resolved.dependency.substring(0, resolved.dependency.lastIndexOf("/")) : resolved.dependency;
|
|
@@ -1485,7 +1485,7 @@ async function createConfigSectionFile(sectionName, sectionValue, targetDir, tar
|
|
|
1485
1485
|
for (const key of schemaKeys) {
|
|
1486
1486
|
completeSectionValue[key] = sectionValue[key];
|
|
1487
1487
|
}
|
|
1488
|
-
const exports
|
|
1488
|
+
const exports = Object.entries(completeSectionValue).map(([key, value]) => {
|
|
1489
1489
|
const valueStr = generateValueLiteral(value);
|
|
1490
1490
|
const propertyPath = `'${sectionName}.${key}'`;
|
|
1491
1491
|
const typeAnnotation = `: Get<GraphCommerceConfig, ${propertyPath}>`;
|
|
@@ -1496,7 +1496,7 @@ import type { Get } from 'type-fest'` ;
|
|
|
1496
1496
|
const content = `// Auto-generated by 'yarn graphcommerce codegen-config-values'
|
|
1497
1497
|
${imports}
|
|
1498
1498
|
|
|
1499
|
-
${exports
|
|
1499
|
+
${exports}
|
|
1500
1500
|
`;
|
|
1501
1501
|
const formattedContent = await prettier.format(content, {
|
|
1502
1502
|
...prettierConf,
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@graphcommerce/next-config",
|
|
3
3
|
"homepage": "https://www.graphcommerce.org/",
|
|
4
4
|
"repository": "github:graphcommerce-org/graphcommerce",
|
|
5
|
-
"version": "10.1.0-canary.
|
|
5
|
+
"version": "10.1.0-canary.6",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"exports": {
|
|
8
8
|
".": {
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
},
|
|
64
64
|
"peerDependencies": {
|
|
65
65
|
"@apollo/client": "*",
|
|
66
|
-
"@graphcommerce/prettier-config-pwa": "^10.1.0-canary.
|
|
66
|
+
"@graphcommerce/prettier-config-pwa": "^10.1.0-canary.6",
|
|
67
67
|
"@lingui/loader": "*",
|
|
68
68
|
"@lingui/macro": "*",
|
|
69
69
|
"@lingui/react": "*",
|