@suss/contract-terraform 0.35.0 → 0.36.0

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/dist/index.cjs CHANGED
@@ -1226,15 +1226,15 @@ function deployableSummary(opts) {
1226
1226
  const { boundary, instanceName, process } = opts;
1227
1227
  const declared = declaredEnv(process.body, boundary.env ?? [], opts.scope);
1228
1228
  const platform = boundary.platformEnvVars ?? import_behavioral_ir.PLATFORM_INJECTED_ENV_VARS[boundary.deploymentTarget];
1229
- const code = codePointer(process.body, boundary, opts.scope);
1230
- const image = attributePattern(
1229
+ const runtime = attributePattern(
1231
1230
  process.body,
1232
- boundary.code?.imageAttribute,
1231
+ boundary.runtimeAttribute,
1233
1232
  opts.scope
1234
1233
  );
1235
- const runtime = attributePattern(
1234
+ const code = codePointer(process.body, boundary, opts.scope, runtime);
1235
+ const image = attributePattern(
1236
1236
  process.body,
1237
- boundary.runtimeAttribute,
1237
+ boundary.code?.imageAttribute,
1238
1238
  opts.scope
1239
1239
  );
1240
1240
  const prefix = opts.scope.namePrefix;
@@ -1266,7 +1266,7 @@ function deployableSummary(opts) {
1266
1266
  {
1267
1267
  codeScope: declaredCodeScope(
1268
1268
  opts.options.codeScopes?.[deployableUnit.instanceName],
1269
- code.entry
1269
+ code
1270
1270
  )
1271
1271
  },
1272
1272
  {
@@ -1281,8 +1281,11 @@ function deployableSummary(opts) {
1281
1281
  )
1282
1282
  };
1283
1283
  }
1284
- function declaredCodeScope(directory, entry) {
1285
- const written = entry !== null ? { entry } : {};
1284
+ function declaredCodeScope(directory, code) {
1285
+ const written = {
1286
+ ...code.entry !== null ? { entry: code.entry } : {},
1287
+ ...code.entryExport !== null ? { entryExport: code.entryExport } : {}
1288
+ };
1286
1289
  if (directory !== void 0) {
1287
1290
  return { kind: "codeUri", path: directory, ...written };
1288
1291
  }
@@ -1308,19 +1311,28 @@ function deployedProcesses(body, boundary, scope) {
1308
1311
  containerName: containers.nameAttribute === void 0 ? null : stringOf(container[containers.nameAttribute])
1309
1312
  }));
1310
1313
  }
1311
- var HANDLER_MODULE = {
1312
- "module.export": (written) => (0, import_behavioral_ir.parseHandler)(written)?.modulePath ?? null,
1313
- name: () => null
1314
+ var HANDLER_PARTS = {
1315
+ "module.export": (written, runtime) => {
1316
+ const parsed = (0, import_behavioral_ir.parseHandler)(written, runtime ?? void 0);
1317
+ return {
1318
+ entry: parsed?.modulePath ?? null,
1319
+ entryExport: parsed?.exportName ?? null
1320
+ };
1321
+ },
1322
+ name: (written) => ({ entry: null, entryExport: written.trim() || null })
1314
1323
  };
1315
- function codePointer(body, boundary, scope) {
1324
+ function codePointer(body, boundary, scope, runtime) {
1316
1325
  const spec = boundary.code?.handler;
1317
1326
  const written = attributePattern(body, spec?.attribute, scope);
1318
1327
  if (spec === void 0 || written === null) {
1319
- return { entryPoint: null, entry: null };
1328
+ return { entryPoint: null, entry: null, entryExport: null };
1329
+ }
1330
+ if ((0, import_behavioral_ir.hasNameHole)(written)) {
1331
+ return { entryPoint: written, entry: null, entryExport: null };
1320
1332
  }
1321
1333
  return {
1322
1334
  entryPoint: written,
1323
- entry: (0, import_behavioral_ir.hasNameHole)(written) ? null : HANDLER_MODULE[spec.spelling](written)
1335
+ ...HANDLER_PARTS[spec.spelling](written, runtime)
1324
1336
  };
1325
1337
  }
1326
1338
  var ENV_READERS = {
package/dist/index.js CHANGED
@@ -1197,15 +1197,15 @@ function deployableSummary(opts) {
1197
1197
  const { boundary, instanceName, process } = opts;
1198
1198
  const declared = declaredEnv(process.body, boundary.env ?? [], opts.scope);
1199
1199
  const platform = boundary.platformEnvVars ?? PLATFORM_INJECTED_ENV_VARS[boundary.deploymentTarget];
1200
- const code = codePointer(process.body, boundary, opts.scope);
1201
- const image = attributePattern(
1200
+ const runtime = attributePattern(
1202
1201
  process.body,
1203
- boundary.code?.imageAttribute,
1202
+ boundary.runtimeAttribute,
1204
1203
  opts.scope
1205
1204
  );
1206
- const runtime = attributePattern(
1205
+ const code = codePointer(process.body, boundary, opts.scope, runtime);
1206
+ const image = attributePattern(
1207
1207
  process.body,
1208
- boundary.runtimeAttribute,
1208
+ boundary.code?.imageAttribute,
1209
1209
  opts.scope
1210
1210
  );
1211
1211
  const prefix = opts.scope.namePrefix;
@@ -1237,7 +1237,7 @@ function deployableSummary(opts) {
1237
1237
  {
1238
1238
  codeScope: declaredCodeScope(
1239
1239
  opts.options.codeScopes?.[deployableUnit.instanceName],
1240
- code.entry
1240
+ code
1241
1241
  )
1242
1242
  },
1243
1243
  {
@@ -1252,8 +1252,11 @@ function deployableSummary(opts) {
1252
1252
  )
1253
1253
  };
1254
1254
  }
1255
- function declaredCodeScope(directory, entry) {
1256
- const written = entry !== null ? { entry } : {};
1255
+ function declaredCodeScope(directory, code) {
1256
+ const written = {
1257
+ ...code.entry !== null ? { entry: code.entry } : {},
1258
+ ...code.entryExport !== null ? { entryExport: code.entryExport } : {}
1259
+ };
1257
1260
  if (directory !== void 0) {
1258
1261
  return { kind: "codeUri", path: directory, ...written };
1259
1262
  }
@@ -1279,19 +1282,28 @@ function deployedProcesses(body, boundary, scope) {
1279
1282
  containerName: containers.nameAttribute === void 0 ? null : stringOf(container[containers.nameAttribute])
1280
1283
  }));
1281
1284
  }
1282
- var HANDLER_MODULE = {
1283
- "module.export": (written) => parseHandler(written)?.modulePath ?? null,
1284
- name: () => null
1285
+ var HANDLER_PARTS = {
1286
+ "module.export": (written, runtime) => {
1287
+ const parsed = parseHandler(written, runtime ?? void 0);
1288
+ return {
1289
+ entry: parsed?.modulePath ?? null,
1290
+ entryExport: parsed?.exportName ?? null
1291
+ };
1292
+ },
1293
+ name: (written) => ({ entry: null, entryExport: written.trim() || null })
1285
1294
  };
1286
- function codePointer(body, boundary, scope) {
1295
+ function codePointer(body, boundary, scope, runtime) {
1287
1296
  const spec = boundary.code?.handler;
1288
1297
  const written = attributePattern(body, spec?.attribute, scope);
1289
1298
  if (spec === void 0 || written === null) {
1290
- return { entryPoint: null, entry: null };
1299
+ return { entryPoint: null, entry: null, entryExport: null };
1300
+ }
1301
+ if (hasNameHole(written)) {
1302
+ return { entryPoint: written, entry: null, entryExport: null };
1291
1303
  }
1292
1304
  return {
1293
1305
  entryPoint: written,
1294
- entry: hasNameHole(written) ? null : HANDLER_MODULE[spec.spelling](written)
1306
+ ...HANDLER_PARTS[spec.spelling](written, runtime)
1295
1307
  };
1296
1308
  }
1297
1309
  var ENV_READERS = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@suss/contract-terraform",
3
- "version": "0.35.0",
3
+ "version": "0.36.0",
4
4
  "type": "module",
5
5
  "description": "Read the storage a Terraform configuration declares and check it against the code that reads and writes those tables.",
6
6
  "keywords": [
@@ -47,7 +47,7 @@
47
47
  "typecheck": "tsc --noEmit"
48
48
  },
49
49
  "dependencies": {
50
- "@suss/behavioral-ir": "0.35.0",
50
+ "@suss/behavioral-ir": "0.36.0",
51
51
  "hcl2-parser": "^1.0.3",
52
52
  "semver": "^7.6.0"
53
53
  },