skuba 14.0.0-hacky-hack-lang-json-20260110020753 → 14.0.0-hacky-hack-lang-json-20260111095131
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/lib/cli/lint/internalLints/upgrade/patches/13.1.1/patchRootTsconfig.js +2 -2
- package/lib/cli/lint/internalLints/upgrade/patches/13.1.1/patchRootTsconfig.js.map +3 -3
- package/package.json +6 -6
- package/template/greeter/package.json +2 -2
- package/template/lambda-sqs-worker-cdk/package.json +2 -2
- package/lib/cli/lint/internalLints/upgrade/utils/astGrepJson.d.ts +0 -1
- package/lib/cli/lint/internalLints/upgrade/utils/astGrepJson.js +0 -73
- package/lib/cli/lint/internalLints/upgrade/utils/astGrepJson.js.map +0 -7
|
@@ -33,10 +33,10 @@ __export(patchRootTsconfig_exports, {
|
|
|
33
33
|
});
|
|
34
34
|
module.exports = __toCommonJS(patchRootTsconfig_exports);
|
|
35
35
|
var import_util = require("util");
|
|
36
|
+
var import_lang_json = __toESM(require("@ast-grep/lang-json"));
|
|
36
37
|
var import_napi = require("@ast-grep/napi");
|
|
37
38
|
var import_fs_extra = __toESM(require("fs-extra"));
|
|
38
39
|
var import_logging = require("../../../../../../utils/logging.js");
|
|
39
|
-
var import_astGrepJson = require("../../utils/astGrepJson.js");
|
|
40
40
|
const patchRootConfig = async ({
|
|
41
41
|
mode
|
|
42
42
|
}) => {
|
|
@@ -49,7 +49,7 @@ const patchRootConfig = async ({
|
|
|
49
49
|
reason: "no root tsconfig.json found"
|
|
50
50
|
};
|
|
51
51
|
}
|
|
52
|
-
|
|
52
|
+
(0, import_napi.registerDynamicLanguage)({ json: import_lang_json.default });
|
|
53
53
|
const tsconfig = await (0, import_napi.parseAsync)("json", tsconfigFile);
|
|
54
54
|
const ast = tsconfig.root();
|
|
55
55
|
const compilerOptionsObj = ast.find({
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../../src/cli/lint/internalLints/upgrade/patches/13.1.1/patchRootTsconfig.ts"],
|
|
4
|
-
"sourcesContent": ["import { inspect } from 'util';\n\nimport { parseAsync } from '@ast-grep/napi';\nimport fs from 'fs-extra';\n\nimport { log } from '../../../../../../utils/logging.js';\nimport type { PatchFunction, PatchReturnType } from '../../index.js';\
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAwB;AAExB,
|
|
6
|
-
"names": ["fs", "edit", "newSource"]
|
|
4
|
+
"sourcesContent": ["import { inspect } from 'util';\n\nimport json from '@ast-grep/lang-json';\nimport { parseAsync, registerDynamicLanguage } from '@ast-grep/napi';\nimport fs from 'fs-extra';\n\nimport { log } from '../../../../../../utils/logging.js';\nimport type { PatchFunction, PatchReturnType } from '../../index.js';\n\nexport const patchRootConfig: PatchFunction = async ({\n mode,\n}): Promise<PatchReturnType> => {\n let tsconfigFile: string;\n try {\n tsconfigFile = await fs.promises.readFile('tsconfig.json', 'utf8');\n } catch {\n return {\n result: 'skip',\n reason: 'no root tsconfig.json found',\n };\n }\n\n registerDynamicLanguage({ json });\n const tsconfig = await parseAsync('json', tsconfigFile);\n const ast = tsconfig.root();\n\n const compilerOptionsObj = ast.find({\n rule: {\n pattern: {\n context: '{\"compilerOptions\":}',\n selector: 'pair',\n },\n },\n });\n\n if (!compilerOptionsObj) {\n const startingBracket = ast.find({ rule: { pattern: '{' } });\n\n if (!startingBracket) {\n return {\n result: 'skip',\n reason: 'Unable to parse tsconfig.json',\n };\n }\n\n const edit = startingBracket.replace(\n `{\n \"compilerOptions\": {\n \"rootDir\": \".\"\n },`,\n );\n\n const newSource = ast.commitEdits([edit]);\n\n if (mode === 'lint') {\n return {\n result: 'apply',\n };\n }\n\n await fs.promises.writeFile('tsconfig.json', newSource, 'utf8');\n\n return {\n result: 'apply',\n };\n }\n\n const rootDirOption = compilerOptionsObj.find({\n rule: { pattern: '\"rootDir\"' },\n });\n\n if (rootDirOption) {\n return {\n result: 'skip',\n reason: 'rootDir already set in tsconfig.json',\n };\n }\n\n const compilerOptionsStart = compilerOptionsObj.find({\n rule: { pattern: '{' },\n });\n\n if (!compilerOptionsStart) {\n return {\n result: 'skip',\n reason: 'Unable to parse tsconfig.json compilerOptions',\n };\n }\n\n const edit = compilerOptionsStart.replace(`{\n \"rootDir\": \".\",`);\n\n const newSource = ast.commitEdits([edit]);\n\n if (mode === 'lint') {\n return {\n result: 'apply',\n };\n }\n\n await fs.promises.writeFile('tsconfig.json', newSource, 'utf8');\n\n return {\n result: 'apply',\n };\n};\n\nexport const tryPatchRootTsConfig: PatchFunction = async (config) => {\n try {\n return await patchRootConfig(config);\n } catch (err) {\n log.warn('Failed to patch root `tsconfig.json`');\n log.subtle(inspect(err));\n return { result: 'skip', reason: 'due to an error' };\n }\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAwB;AAExB,uBAAiB;AACjB,kBAAoD;AACpD,sBAAe;AAEf,qBAAoB;AAGb,MAAM,kBAAiC,OAAO;AAAA,EACnD;AACF,MAAgC;AAC9B,MAAI;AACJ,MAAI;AACF,mBAAe,MAAM,gBAAAA,QAAG,SAAS,SAAS,iBAAiB,MAAM;AAAA,EACnE,QAAQ;AACN,WAAO;AAAA,MACL,QAAQ;AAAA,MACR,QAAQ;AAAA,IACV;AAAA,EACF;AAEA,2CAAwB,EAAE,uBAAAC,QAAK,CAAC;AAChC,QAAM,WAAW,UAAM,wBAAW,QAAQ,YAAY;AACtD,QAAM,MAAM,SAAS,KAAK;AAE1B,QAAM,qBAAqB,IAAI,KAAK;AAAA,IAClC,MAAM;AAAA,MACJ,SAAS;AAAA,QACP,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,EACF,CAAC;AAED,MAAI,CAAC,oBAAoB;AACvB,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AK,sCAAsC;AAC/C,uBAAI,WAAO,qBAAQ,GAAG,CAAC;AACvB,WAAO,EAAE,QAAQ,QAAQ,QAAQ,kBAAkB;AAAA,EACrD;AACF;",
|
|
6
|
+
"names": ["fs", "json", "edit", "newSource"]
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "skuba",
|
|
3
|
-
"version": "14.0.0-hacky-hack-lang-json-
|
|
3
|
+
"version": "14.0.0-hacky-hack-lang-json-20260111095131",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "SEEK development toolkit for backend applications and packages",
|
|
6
6
|
"homepage": "https://github.com/seek-oss/skuba#readme",
|
|
@@ -55,8 +55,8 @@
|
|
|
55
55
|
]
|
|
56
56
|
},
|
|
57
57
|
"dependencies": {
|
|
58
|
-
"@ast-grep/lang-json": "^0.0.
|
|
59
|
-
"@ast-grep/napi": "^0.40.
|
|
58
|
+
"@ast-grep/lang-json": "^0.0.6",
|
|
59
|
+
"@ast-grep/napi": "^0.40.5",
|
|
60
60
|
"@esbuild-plugins/tsconfig-paths": "^0.1.0",
|
|
61
61
|
"@inquirer/prompts": "^7.9.0",
|
|
62
62
|
"@jest/types": "^30.0.0",
|
|
@@ -94,7 +94,7 @@
|
|
|
94
94
|
"read-pkg-up": "^7.0.1",
|
|
95
95
|
"semantic-release": "^24.2.3",
|
|
96
96
|
"simple-git": "^3.5.0",
|
|
97
|
-
"tree-sitter-cli": "0.
|
|
97
|
+
"tree-sitter-cli": "0.25.8",
|
|
98
98
|
"ts-dedent": "^2.2.0",
|
|
99
99
|
"ts-jest": "^29.4.0",
|
|
100
100
|
"ts-node": "^10.9.2",
|
|
@@ -103,8 +103,8 @@
|
|
|
103
103
|
"tsx": "^4.21.0",
|
|
104
104
|
"typescript": "~5.9.0",
|
|
105
105
|
"zod": "^4.0.0",
|
|
106
|
-
"@skuba-lib/api": "^2.0.0-hacky-hack-lang-json-
|
|
107
|
-
"eslint-config-skuba": "8.0.0-hacky-hack-lang-json-
|
|
106
|
+
"@skuba-lib/api": "^2.0.0-hacky-hack-lang-json-20260111095131",
|
|
107
|
+
"eslint-config-skuba": "8.0.0-hacky-hack-lang-json-20260111095131"
|
|
108
108
|
},
|
|
109
109
|
"devDependencies": {
|
|
110
110
|
"@changesets/cli": "2.29.8",
|
|
@@ -19,11 +19,11 @@
|
|
|
19
19
|
"test:watch": "skuba test --watch"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"skuba-dive": "4.0.0-hacky-hack-lang-json-
|
|
22
|
+
"skuba-dive": "4.0.0-hacky-hack-lang-json-20260111095131"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
25
|
"@types/node": "^22.13.10",
|
|
26
|
-
"skuba": "14.0.0-hacky-hack-lang-json-
|
|
26
|
+
"skuba": "14.0.0-hacky-hack-lang-json-20260111095131"
|
|
27
27
|
},
|
|
28
28
|
"packageManager": "pnpm@10.27.0",
|
|
29
29
|
"engines": {
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"@aws-sdk/client-sns": "^3.363.0",
|
|
25
25
|
"@seek/aws-codedeploy-hooks": "^2.0.0",
|
|
26
26
|
"@seek/logger": "^11.1.0",
|
|
27
|
-
"skuba-dive": "4.0.0-hacky-hack-lang-json-
|
|
27
|
+
"skuba-dive": "4.0.0-hacky-hack-lang-json-20260111095131",
|
|
28
28
|
"zod": "^4.0.0"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"datadog-lambda-js": "^12.0.0",
|
|
43
43
|
"dd-trace": "^5.0.0",
|
|
44
44
|
"pino-pretty": "^13.0.0",
|
|
45
|
-
"skuba": "14.0.0-hacky-hack-lang-json-
|
|
45
|
+
"skuba": "14.0.0-hacky-hack-lang-json-20260111095131"
|
|
46
46
|
},
|
|
47
47
|
"packageManager": "pnpm@10.27.0",
|
|
48
48
|
"engines": {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const installAstGrepJson: () => Promise<void>;
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var astGrepJson_exports = {};
|
|
30
|
-
__export(astGrepJson_exports, {
|
|
31
|
-
installAstGrepJson: () => installAstGrepJson
|
|
32
|
-
});
|
|
33
|
-
module.exports = __toCommonJS(astGrepJson_exports);
|
|
34
|
-
var import_path = __toESM(require("path"));
|
|
35
|
-
var import_util = require("util");
|
|
36
|
-
var import_lang_json = __toESM(require("@ast-grep/lang-json"));
|
|
37
|
-
var import_napi = require("@ast-grep/napi");
|
|
38
|
-
var import_exec = require("../../../../../utils/exec.js");
|
|
39
|
-
var import_logging = require("../../../../../utils/logging.js");
|
|
40
|
-
let jsonRegistered = false;
|
|
41
|
-
const installAstGrepJson = async () => {
|
|
42
|
-
if (jsonRegistered) {
|
|
43
|
-
return;
|
|
44
|
-
}
|
|
45
|
-
try {
|
|
46
|
-
const treeSitterCliDir = import_path.default.dirname(
|
|
47
|
-
require.resolve("tree-sitter-cli/package.json")
|
|
48
|
-
);
|
|
49
|
-
const treeSitterExec = (0, import_exec.createExec)({
|
|
50
|
-
cwd: treeSitterCliDir
|
|
51
|
-
});
|
|
52
|
-
await treeSitterExec("npm", "run", "install");
|
|
53
|
-
const astGrepJsonDir = import_path.default.dirname(
|
|
54
|
-
require.resolve("@ast-grep/lang-json/package.json")
|
|
55
|
-
);
|
|
56
|
-
const astGrepExec = (0, import_exec.createExec)({
|
|
57
|
-
cwd: astGrepJsonDir
|
|
58
|
-
});
|
|
59
|
-
await astGrepExec("npm", "run", "postinstall");
|
|
60
|
-
} catch (err) {
|
|
61
|
-
import_logging.log.warn(
|
|
62
|
-
"Failed to run @ast-grep/lang-json postinstall step, AST parsing may fail"
|
|
63
|
-
);
|
|
64
|
-
import_logging.log.subtle((0, import_util.inspect)(err));
|
|
65
|
-
}
|
|
66
|
-
(0, import_napi.registerDynamicLanguage)({ json: import_lang_json.default });
|
|
67
|
-
jsonRegistered = true;
|
|
68
|
-
};
|
|
69
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
70
|
-
0 && (module.exports = {
|
|
71
|
-
installAstGrepJson
|
|
72
|
-
});
|
|
73
|
-
//# sourceMappingURL=astGrepJson.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../../../src/cli/lint/internalLints/upgrade/utils/astGrepJson.ts"],
|
|
4
|
-
"sourcesContent": ["import path from 'path';\nimport { inspect } from 'util';\n\nimport json from '@ast-grep/lang-json';\nimport { registerDynamicLanguage } from '@ast-grep/napi';\n\nimport { createExec } from '../../../../../utils/exec.js';\nimport { log } from '../../../../../utils/logging.js';\n\nlet jsonRegistered = false;\n\nexport const installAstGrepJson = async () => {\n if (jsonRegistered) {\n return;\n }\n\n // @ast-grep/json requires a postinstall step to build the native bindings\n // which may not have run in alpine due to pnpm not trusting scripts by default\n try {\n const treeSitterCliDir = path.dirname(\n require.resolve('tree-sitter-cli/package.json'),\n );\n const treeSitterExec = createExec({\n cwd: treeSitterCliDir,\n });\n await treeSitterExec('npm', 'run', 'install');\n\n const astGrepJsonDir = path.dirname(\n require.resolve('@ast-grep/lang-json/package.json'),\n );\n const astGrepExec = createExec({\n cwd: astGrepJsonDir,\n });\n await astGrepExec('npm', 'run', 'postinstall');\n } catch (err) {\n log.warn(\n 'Failed to run @ast-grep/lang-json postinstall step, AST parsing may fail',\n );\n log.subtle(inspect(err));\n }\n\n registerDynamicLanguage({ json });\n\n jsonRegistered = true;\n};\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AACjB,kBAAwB;AAExB,uBAAiB;AACjB,kBAAwC;AAExC,kBAA2B;AAC3B,qBAAoB;AAEpB,IAAI,iBAAiB;AAEd,MAAM,qBAAqB,YAAY;AAC5C,MAAI,gBAAgB;AAClB;AAAA,EACF;AAIA,MAAI;AACF,UAAM,mBAAmB,YAAAA,QAAK;AAAA,MAC5B,gBAAgB,8BAA8B;AAAA,IAChD;AACA,UAAM,qBAAiB,wBAAW;AAAA,MAChC,KAAK;AAAA,IACP,CAAC;AACD,UAAM,eAAe,OAAO,OAAO,SAAS;AAE5C,UAAM,iBAAiB,YAAAA,QAAK;AAAA,MAC1B,gBAAgB,kCAAkC;AAAA,IACpD;AACA,UAAM,kBAAc,wBAAW;AAAA,MAC7B,KAAK;AAAA,IACP,CAAC;AACD,UAAM,YAAY,OAAO,OAAO,aAAa;AAAA,EAC/C,SAAS,KAAK;AACZ,uBAAI;AAAA,MACF;AAAA,IACF;AACA,uBAAI,WAAO,qBAAQ,GAAG,CAAC;AAAA,EACzB;AAEA,2CAAwB,EAAE,uBAAAC,QAAK,CAAC;AAEhC,mBAAiB;AACnB;",
|
|
6
|
-
"names": ["path", "json"]
|
|
7
|
-
}
|