@dbx-tools/projen 0.9.70 → 0.9.71
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/index.ts +1 -1
- package/package.json +4 -4
- package/tasks/python-node-bindings.ts +36 -35
package/index.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// Hand edits are overwritten on the next watch; this file is read-only.
|
|
4
4
|
|
|
5
5
|
export const PACKAGE_IDENTIFIER = "@dbx-tools/projen";
|
|
6
|
-
export const PACKAGE_VERSION = "0.9.
|
|
6
|
+
export const PACKAGE_VERSION = "0.9.71";
|
|
7
7
|
export * as barrels from "./src/barrels.ts";
|
|
8
8
|
export * as bunApp from "./src/bun-app.ts";
|
|
9
9
|
export * as bunWorkflow from "./src/bun-workflow.ts";
|
package/package.json
CHANGED
|
@@ -30,9 +30,9 @@
|
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@clack/prompts": "^1.7.0",
|
|
33
|
-
"@dbx-tools/core": "^0.9.
|
|
34
|
-
"@dbx-tools/path": "^0.9.
|
|
35
|
-
"@dbx-tools/shared-core": "^0.9.
|
|
33
|
+
"@dbx-tools/core": "^0.9.71",
|
|
34
|
+
"@dbx-tools/path": "^0.9.71",
|
|
35
|
+
"@dbx-tools/shared-core": "^0.9.71",
|
|
36
36
|
"commander": "^15.0.0",
|
|
37
37
|
"concurrently": "^10.0.3",
|
|
38
38
|
"constructs": "^10.6.0",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
},
|
|
55
55
|
"main": "index.ts",
|
|
56
56
|
"license": "Apache-2.0",
|
|
57
|
-
"version": "0.9.
|
|
57
|
+
"version": "0.9.71",
|
|
58
58
|
"types": "index.ts",
|
|
59
59
|
"type": "module",
|
|
60
60
|
"exports": {
|
|
@@ -217,9 +217,9 @@ export async function main(args: string[] = process.argv.slice(2)): Promise<void
|
|
|
217
217
|
const entrypoint = Bun.resolveSync(binding.entrypoint, binding.projectDirectory);
|
|
218
218
|
return binding.modules.length > 0
|
|
219
219
|
? binding.modules.map((module) => ({
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
220
|
+
key: runtimeModuleName(binding, module),
|
|
221
|
+
entrypoint: resolvePythonNodeBindingModule(entrypoint, module),
|
|
222
|
+
}))
|
|
223
223
|
: [{ key: runtimeModuleName(binding), entrypoint }];
|
|
224
224
|
});
|
|
225
225
|
const runtimeExports = [
|
|
@@ -320,8 +320,9 @@ export async function main(args: string[] = process.argv.slice(2)): Promise<void
|
|
|
320
320
|
const result = await Bun.build({
|
|
321
321
|
entrypoints: [shimEntry],
|
|
322
322
|
format: "cjs",
|
|
323
|
-
plugins: [runtimePlugin],
|
|
324
323
|
target: "browser",
|
|
324
|
+
conditions: ["require"],
|
|
325
|
+
plugins: [runtimePlugin],
|
|
325
326
|
});
|
|
326
327
|
if (!result.success) {
|
|
327
328
|
for (const message of result.logs) logger.error(message);
|
|
@@ -366,8 +367,8 @@ export async function main(args: string[] = process.argv.slice(2)): Promise<void
|
|
|
366
367
|
...bindings.flatMap((binding) => [
|
|
367
368
|
...(binding.modules.length > 0
|
|
368
369
|
? binding.modules.map((module) =>
|
|
369
|
-
|
|
370
|
-
|
|
370
|
+
join(binding.bindingDirectory, `${pythonFunctionName(module)}.py`),
|
|
371
|
+
)
|
|
371
372
|
: [join(binding.bindingDirectory, "index.py")]),
|
|
372
373
|
]),
|
|
373
374
|
].filter((file): file is string => Boolean(file)),
|
|
@@ -986,18 +987,18 @@ export async function main(args: string[] = process.argv.slice(2)): Promise<void
|
|
|
986
987
|
function pythonDataclass(record: PythonRecord): string {
|
|
987
988
|
const body = record.fields.length
|
|
988
989
|
? record.fields
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
990
|
+
.map((field) => {
|
|
991
|
+
const defaultArgument = Object.hasOwn(field, "defaultValue")
|
|
992
|
+
? pythonDefault(field.defaultValue)
|
|
993
|
+
: "default=None";
|
|
994
|
+
return [
|
|
995
|
+
` ${field.pythonName}: ${pythonOptionalType(field.type)} = field(`,
|
|
996
|
+
` ${defaultArgument},`,
|
|
997
|
+
` metadata={"javascript_name": ${JSON.stringify(field.javascriptName)}},`,
|
|
998
|
+
" )",
|
|
999
|
+
].join("\n");
|
|
1000
|
+
})
|
|
1001
|
+
.join("\n")
|
|
1001
1002
|
: " pass";
|
|
1002
1003
|
return `@dataclass(kw_only=True)\nclass ${record.name}:\n${body}`;
|
|
1003
1004
|
}
|
|
@@ -1025,11 +1026,11 @@ export async function main(args: string[] = process.argv.slice(2)): Promise<void
|
|
|
1025
1026
|
}
|
|
1026
1027
|
const body = response.fields.length
|
|
1027
1028
|
? response.fields
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1029
|
+
.map(
|
|
1030
|
+
({ name, required, type }) =>
|
|
1031
|
+
` ${name}: ${required ? type : `NotRequired[${type}]`}`,
|
|
1032
|
+
)
|
|
1033
|
+
.join("\n")
|
|
1033
1034
|
: " pass";
|
|
1034
1035
|
return `class ${response.name}(TypedDict):\n${body}`;
|
|
1035
1036
|
}
|
|
@@ -1044,18 +1045,18 @@ export async function main(args: string[] = process.argv.slice(2)): Promise<void
|
|
|
1044
1045
|
);
|
|
1045
1046
|
const methods = protocol.methods.length
|
|
1046
1047
|
? protocol.methods
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1048
|
+
.map((method) => {
|
|
1049
|
+
const parameters = method.parameters.map(
|
|
1050
|
+
({ name, required, type }) => ` ${name}: ${type}${required ? "" : " = ..."},`,
|
|
1051
|
+
);
|
|
1052
|
+
return [
|
|
1053
|
+
` async def ${method.name}(`,
|
|
1054
|
+
" self,",
|
|
1055
|
+
...parameters,
|
|
1056
|
+
` ) -> ${method.returnType}: ...`,
|
|
1057
|
+
].join("\n");
|
|
1058
|
+
})
|
|
1059
|
+
.join("\n\n")
|
|
1059
1060
|
: "";
|
|
1060
1061
|
const body = [...properties, methods].filter(Boolean).join("\n\n") || " pass";
|
|
1061
1062
|
return `class ${protocol.name}(Protocol):\n${body}`;
|