@postxl/generator 1.3.3 → 1.3.5

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.
@@ -19,6 +19,11 @@
19
19
  * // @custom-start:myFeature
20
20
  * // your custom code here
21
21
  * // @custom-end:myFeature
22
+ *
23
+ * // The @ prefix is optional:
24
+ * // custom-start:myFeature
25
+ * // your custom code here
26
+ * // custom-end:myFeature
22
27
  * ```
23
28
  *
24
29
  * When the generator runs and would normally create merge conflicts,
@@ -33,6 +38,7 @@
33
38
  *
34
39
  * Supported formats:
35
40
  * - Line comments: // @custom-start or // @custom-start:name
41
+ * - Line comments (without @): // custom-start or // custom-start:name
36
42
  * - Block comments: Must be on a single line with both delimiters
37
43
  *
38
44
  * Note: Multi-line block comments are NOT supported. The opening and closing
@@ -20,6 +20,11 @@
20
20
  * // @custom-start:myFeature
21
21
  * // your custom code here
22
22
  * // @custom-end:myFeature
23
+ *
24
+ * // The @ prefix is optional:
25
+ * // custom-start:myFeature
26
+ * // your custom code here
27
+ * // custom-end:myFeature
23
28
  * ```
24
29
  *
25
30
  * When the generator runs and would normally create merge conflicts,
@@ -41,6 +46,7 @@ exports.reconstructNonCustomContent = reconstructNonCustomContent;
41
46
  *
42
47
  * Supported formats:
43
48
  * - Line comments: // @custom-start or // @custom-start:name
49
+ * - Line comments (without @): // custom-start or // custom-start:name
44
50
  * - Block comments: Must be on a single line with both delimiters
45
51
  *
46
52
  * Note: Multi-line block comments are NOT supported. The opening and closing
@@ -48,12 +54,12 @@ exports.reconstructNonCustomContent = reconstructNonCustomContent;
48
54
  * and avoids ambiguity. See tests for examples.
49
55
  */
50
56
  exports.customBlockMarkers = {
51
- // Matches: // @custom-start or // @custom-start:name
52
- // Also supports: /* @custom-start */ or /* @custom-start:name */
53
- startPattern: /^\s*(?:\/\/|\/\*)\s*@custom-start(?::([a-zA-Z0-9_-]+))?\s*(?:\*\/)?\s*$/,
54
- // Matches: // @custom-end or // @custom-end:name
55
- // Also supports: /* @custom-end */ or /* @custom-end:name */
56
- endPattern: /^\s*(?:\/\/|\/\*)\s*@custom-end(?::([a-zA-Z0-9_-]+))?\s*(?:\*\/)?\s*$/,
57
+ // Matches: // @custom-start or // @custom-start:name or // custom-start or // custom-start:name
58
+ // Also supports: /* @custom-start */ or /* custom-start:name */
59
+ startPattern: /^\s*(?:\/\/|\/\*)\s*@?custom-start(?::([a-zA-Z0-9_-]+))?\s*(?:\*\/)?\s*$/,
60
+ // Matches: // @custom-end or // @custom-end:name or // custom-end or // custom-end:name
61
+ // Also supports: /* @custom-end */ or /* custom-end:name */
62
+ endPattern: /^\s*(?:\/\/|\/\*)\s*@?custom-end(?::([a-zA-Z0-9_-]+))?\s*(?:\*\/)?\s*$/,
57
63
  };
58
64
  /**
59
65
  * Number of non-empty lines to capture before/after a custom block for anchoring
@@ -64,13 +64,13 @@ const packageJsonConfig = {
64
64
  };
65
65
  async function format({ path, content }) {
66
66
  const ext = (0, path_1.extname)(path);
67
- const parser = parsers[ext];
68
- if (parser === undefined || typeof content !== 'string') {
67
+ const supportsPrettier = parsers[ext] !== undefined;
68
+ if (!supportsPrettier || typeof content !== 'string') {
69
69
  return content;
70
70
  }
71
71
  const config = (0, path_1.basename)(path) === 'package.json' ? packageJsonConfig : prettier_config_1.prettierConfig;
72
72
  try {
73
- return await prettier.format(content, { ...config, parser });
73
+ return await prettier.format(content, { ...config, filepath: path });
74
74
  }
75
75
  catch (err) {
76
76
  console.error(`${content}\n\nFailed to format ${path}\n\n`);
@@ -12,7 +12,7 @@ function logSyncResult(results, options = {}) {
12
12
  logger.log((0, utils_1.red)(results.error.message));
13
13
  logger.log('');
14
14
  logger.log((0, utils_1.bold)((0, utils_1.red)(`Files with unresolved merge conflicts (${results.error.filesWithConflicts.length}):`)));
15
- for (const file of results.error.filesWithConflicts) {
15
+ for (const file of [...results.error.filesWithConflicts].sort()) {
16
16
  logger.log((0, utils_1.red)(` └── ${file}`));
17
17
  }
18
18
  logger.log('');
@@ -68,7 +68,8 @@ function logActionResult(action, paths, color, stateDescription, logger) {
68
68
  if (action === 'NoAction') {
69
69
  return;
70
70
  }
71
- paths.forEach((path) => {
71
+ const sorted = [...paths].sort();
72
+ sorted.forEach((path) => {
72
73
  logger.log((0, utils_1.gray)(` └── ${path}`));
73
74
  });
74
75
  }
@@ -79,7 +80,7 @@ function logEjectedDiff({ ejectedFiles, showEjectedStats, files, logger, }) {
79
80
  }
80
81
  }
81
82
  else {
82
- for (const path of ejectedFiles) {
83
+ for (const path of [...ejectedFiles].sort()) {
83
84
  logger.log((0, utils_1.bold)((0, utils_1.red)(`Ejected ${path}`)));
84
85
  const inputState = files[path].inputState;
85
86
  const contentSource = inputState.disk.state === 'hash' ? inputState.disk.content : '';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@postxl/generator",
3
- "version": "1.3.3",
3
+ "version": "1.3.5",
4
4
  "description": "Core package that orchestrates the code generation of a PXL project",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
@@ -46,8 +46,8 @@
46
46
  "jszip": "3.10.1",
47
47
  "minimatch": "^10.1.1",
48
48
  "p-limit": "3.1.0",
49
- "@postxl/schema": "^1.3.0",
50
- "@postxl/utils": "^1.3.1"
49
+ "@postxl/schema": "^1.6.0",
50
+ "@postxl/utils": "^1.3.3"
51
51
  },
52
52
  "devDependencies": {
53
53
  "@types/diff": "8.0.0"