@friggframework/devtools 2.0.0--canary.731.fbc1a37.0 → 2.0.0--canary.731.8f730e5.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.
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Shared cases for every builder whose functions bundle Prisma when the
3
+ * Prisma layer is off.
4
+ * @param {(usePrismaLayer: boolean, architecture?: string) => Promise<Object[]>|Object[]} functionsOf
5
+ * Builds the app and returns its function definitions
6
+ */
7
+ function itBundlesOnlyTheTargetPrismaEngine(functionsOf) {
8
+ it.each([
9
+ [undefined, 'rhel-openssl-3.0.x', 'linux-arm64-openssl-3.0.x'],
10
+ ['x86_64', 'rhel-openssl-3.0.x', 'linux-arm64-openssl-3.0.x'],
11
+ ['arm64', 'linux-arm64-openssl-3.0.x', 'rhel-openssl-3.0.x'],
12
+ ])(
13
+ 'with the layer off and architecture %s, the bundled Prisma keeps only the %s engine',
14
+ async (architecture, target, otherTarget) => {
15
+ for (const fn of await functionsOf(false, architecture)) {
16
+ expect(fn.package.exclude).toEqual(
17
+ expect.arrayContaining([
18
+ '**/libquery_engine-debian*',
19
+ `**/libquery_engine-${otherTarget}*`,
20
+ ])
21
+ );
22
+ expect(fn.package.exclude).not.toContain(`**/libquery_engine-${target}*`);
23
+ }
24
+ }
25
+ );
26
+
27
+ it('with the layer on, adds no engine patterns, since the layer carries the engines', async () => {
28
+ for (const fn of await functionsOf(true, 'arm64')) {
29
+ expect(fn.package.exclude).not.toEqual(
30
+ expect.arrayContaining(['**/libquery_engine-rhel-openssl-3.0.x*'])
31
+ );
32
+ expect(fn.package.exclude).not.toEqual(
33
+ expect.arrayContaining(['**/libquery_engine-debian*'])
34
+ );
35
+ }
36
+ });
37
+ }
38
+
39
+ module.exports = { itBundlesOnlyTheTargetPrismaEngine };
@@ -16,10 +16,7 @@
16
16
  const { InfrastructureBuilder, ValidationResult } = require('../shared/base-builder');
17
17
  const { isScopedEnvironmentActive } = require('../shared/function-environments');
18
18
  const { nestedNodeModulesExcludes } = require('../shared/utilities/nested-node-modules');
19
- const {
20
- resolveLambdaArchitecture,
21
- foreignPrismaEngineExcludes,
22
- } = require('../shared/lambda-architectures');
19
+ const { bundledPrismaEngineExcludes } = require('../shared/lambda-architectures');
23
20
 
24
21
  class AdminScriptBuilder extends InfrastructureBuilder {
25
22
  constructor() {
@@ -415,9 +412,8 @@ class AdminScriptBuilder extends InfrastructureBuilder {
415
412
  'node_modules/prisma/**',
416
413
  'node_modules/@friggframework/core/generated/**',
417
414
  ]
418
- : foreignPrismaEngineExcludes(
419
- resolveLambdaArchitecture(appDefinition).name
420
- )),
415
+ : []),
416
+ ...bundledPrismaEngineExcludes(appDefinition, usePrismaLayer),
421
417
  ...nestedNodeModulesExcludes(appDefinition, usePrismaLayer),
422
418
  'node_modules/@friggframework/test/**',
423
419
  'node_modules/@friggframework/eslint-config/**',
@@ -10,6 +10,7 @@
10
10
 
11
11
  const { AdminScriptBuilder } = require('./admin-script-builder');
12
12
  const { ValidationResult } = require('../shared/base-builder');
13
+ const { itBundlesOnlyTheTargetPrismaEngine } = require('../../__tests__/helpers/bundled-prisma-engine-excludes');
13
14
 
14
15
  describe('AdminScriptBuilder', () => {
15
16
  let adminScriptBuilder;
@@ -975,35 +976,7 @@ describe('AdminScriptBuilder', () => {
975
976
  );
976
977
  return Object.values(result.functions);
977
978
  };
978
- const layerOff = (architecture) => functionsOf(false, architecture);
979
- const layerOn = (architecture) => functionsOf(true, architecture);
980
-
981
- it.each([
982
- [undefined, 'rhel-openssl-3.0.x', 'linux-arm64-openssl-3.0.x'],
983
- ['x86_64', 'rhel-openssl-3.0.x', 'linux-arm64-openssl-3.0.x'],
984
- ['arm64', 'linux-arm64-openssl-3.0.x', 'rhel-openssl-3.0.x'],
985
- ])(
986
- 'with the layer off and architecture %s, the bundled Prisma keeps only the %s engine',
987
- async (architecture, target, otherTarget) => {
988
- for (const fn of await layerOff(architecture)) {
989
- expect(fn.package.exclude).toEqual(
990
- expect.arrayContaining(['**/libquery_engine-debian*', `**/libquery_engine-${otherTarget}*`])
991
- );
992
- expect(fn.package.exclude).not.toContain(`**/libquery_engine-${target}*`);
993
- }
994
- }
995
- );
996
-
997
- it('with the layer on, adds no engine patterns, since the layer carries the engines', async () => {
998
- for (const fn of await layerOn('arm64')) {
999
- expect(fn.package.exclude).not.toEqual(
1000
- expect.arrayContaining(['**/libquery_engine-rhel-openssl-3.0.x*'])
1001
- );
1002
- expect(fn.package.exclude).not.toEqual(
1003
- expect.arrayContaining(['**/libquery_engine-debian*'])
1004
- );
1005
- }
1006
- });
979
+ itBundlesOnlyTheTargetPrismaEngine(functionsOf);
1007
980
  });
1008
981
 
1009
982
  describe('getName()', () => {
@@ -32,10 +32,7 @@ const {
32
32
  const {
33
33
  nestedNodeModulesExcludes,
34
34
  } = require('../shared/utilities/nested-node-modules');
35
- const {
36
- resolveLambdaArchitecture,
37
- foreignPrismaEngineExcludes,
38
- } = require('../shared/lambda-architectures');
35
+ const { bundledPrismaEngineExcludes } = require('../shared/lambda-architectures');
39
36
  const {
40
37
  INTEGRATION_QUEUE_MAX_RECEIVE_COUNT,
41
38
  QUEUE_MAX_RECEIVE_COUNT_ENV,
@@ -271,9 +268,8 @@ class IntegrationBuilder extends InfrastructureBuilder {
271
268
  'node_modules/prisma/**',
272
269
  'node_modules/@friggframework/core/generated/**',
273
270
  ]
274
- : foreignPrismaEngineExcludes(
275
- resolveLambdaArchitecture(appDefinition).name
276
- )),
271
+ : []),
272
+ ...bundledPrismaEngineExcludes(appDefinition, usePrismaLayer),
277
273
 
278
274
  ...nestedNodeModulesExcludes(appDefinition, usePrismaLayer),
279
275
 
@@ -10,6 +10,7 @@ const {
10
10
  } = require('@friggframework/core/queues/queue-delivery');
11
11
  const { IntegrationBuilder } = require('./integration-builder');
12
12
  const { ValidationResult } = require('../shared/base-builder');
13
+ const { itBundlesOnlyTheTargetPrismaEngine } = require('../../__tests__/helpers/bundled-prisma-engine-excludes');
13
14
 
14
15
  describe('IntegrationBuilder', () => {
15
16
  let integrationBuilder;
@@ -1097,35 +1098,7 @@ describe('IntegrationBuilder Lambda architecture with usePrismaLambdaLayer=false
1097
1098
  );
1098
1099
  return Object.values(result.functions);
1099
1100
  };
1100
- const layerOff = (architecture) => functionsOf(false, architecture);
1101
- const layerOn = (architecture) => functionsOf(true, architecture);
1102
-
1103
- it.each([
1104
- [undefined, 'rhel-openssl-3.0.x', 'linux-arm64-openssl-3.0.x'],
1105
- ['x86_64', 'rhel-openssl-3.0.x', 'linux-arm64-openssl-3.0.x'],
1106
- ['arm64', 'linux-arm64-openssl-3.0.x', 'rhel-openssl-3.0.x'],
1107
- ])(
1108
- 'with the layer off and architecture %s, the bundled Prisma keeps only the %s engine',
1109
- async (architecture, target, otherTarget) => {
1110
- for (const fn of await layerOff(architecture)) {
1111
- expect(fn.package.exclude).toEqual(
1112
- expect.arrayContaining(['**/libquery_engine-debian*', `**/libquery_engine-${otherTarget}*`])
1113
- );
1114
- expect(fn.package.exclude).not.toContain(`**/libquery_engine-${target}*`);
1115
- }
1116
- }
1117
- );
1118
-
1119
- it('with the layer on, adds no engine patterns, since the layer carries the engines', async () => {
1120
- for (const fn of await layerOn('arm64')) {
1121
- expect(fn.package.exclude).not.toEqual(
1122
- expect.arrayContaining(['**/libquery_engine-rhel-openssl-3.0.x*'])
1123
- );
1124
- expect(fn.package.exclude).not.toEqual(
1125
- expect.arrayContaining(['**/libquery_engine-debian*'])
1126
- );
1127
- }
1128
- });
1101
+ itBundlesOnlyTheTargetPrismaEngine(functionsOf);
1129
1102
  });
1130
1103
 
1131
1104
  describe('IntegrationBuilder nested node_modules (lambda.keepNestedNodeModules)', () => {
@@ -88,6 +88,19 @@ function foreignPrismaEngineExcludes(name) {
88
88
  );
89
89
  }
90
90
 
91
+ /**
92
+ * Package exclude patterns for a function that bundles Prisma itself. With
93
+ * the Prisma layer on, the layer carries the engines and nothing is added.
94
+ * @param {Object} appDefinition
95
+ * @param {boolean} usePrismaLayer
96
+ * @returns {string[]}
97
+ */
98
+ function bundledPrismaEngineExcludes(appDefinition, usePrismaLayer) {
99
+ return usePrismaLayer
100
+ ? []
101
+ : foreignPrismaEngineExcludes(resolveLambdaArchitecture(appDefinition).name);
102
+ }
103
+
91
104
  module.exports = {
92
105
  LAMBDA_ARCHITECTURES,
93
106
  DEFAULT_LAMBDA_ARCHITECTURE,
@@ -96,4 +109,5 @@ module.exports = {
96
109
  PRISMA_ENGINES_PACKAGE_DIR,
97
110
  prismaEngineFileNames,
98
111
  foreignPrismaEngineExcludes,
112
+ bundledPrismaEngineExcludes,
99
113
  };
@@ -4,6 +4,7 @@ const {
4
4
  resolveLambdaArchitecture,
5
5
  prismaEngineFileNames,
6
6
  foreignPrismaEngineExcludes,
7
+ bundledPrismaEngineExcludes,
7
8
  } = require('./lambda-architectures');
8
9
 
9
10
  describe('resolveLambdaArchitecture()', () => {
@@ -145,3 +146,19 @@ describe('foreignPrismaEngineExcludes()', () => {
145
146
  );
146
147
  });
147
148
  });
149
+
150
+ describe('bundledPrismaEngineExcludes()', () => {
151
+ it('adds nothing when the Prisma layer carries the engines', () => {
152
+ expect(bundledPrismaEngineExcludes({ architecture: 'arm64' }, true)).toEqual([]);
153
+ });
154
+
155
+ it.each([
156
+ [{}, 'x86_64'],
157
+ [{ architecture: 'x86_64' }, 'x86_64'],
158
+ [{ architecture: 'arm64' }, 'arm64'],
159
+ ])('with the layer off, excludes the engines %j does not load', (appDefinition, name) => {
160
+ expect(bundledPrismaEngineExcludes(appDefinition, false)).toEqual(
161
+ foreignPrismaEngineExcludes(name)
162
+ );
163
+ });
164
+ });
@@ -12,7 +12,7 @@ const { nestedNodeModulesExcludes } = require('./nested-node-modules');
12
12
  const { buildLoggingProviderConfig } = require('./logging-config');
13
13
  const {
14
14
  resolveLambdaArchitecture,
15
- foreignPrismaEngineExcludes,
15
+ bundledPrismaEngineExcludes,
16
16
  } = require('../lambda-architectures');
17
17
 
18
18
  /**
@@ -40,10 +40,7 @@ function createBaseDefinition(
40
40
  const region = process.env.AWS_REGION || 'us-east-1';
41
41
  const loggingConfig = buildLoggingProviderConfig(AppDefinition.logging);
42
42
  const architecture = resolveLambdaArchitecture(AppDefinition);
43
- // Bundled Prisma carries every generated engine; keep the target's only
44
- const bundledEngineExcludes = usePrismaLayer
45
- ? []
46
- : foreignPrismaEngineExcludes(architecture.name);
43
+ const bundledEngineExcludes = bundledPrismaEngineExcludes(AppDefinition, usePrismaLayer);
47
44
 
48
45
  // Package config for handlers that skip esbuild (need node_modules dependencies)
49
46
  // Include backend src/ and index.js since handlers load the app definition
@@ -5,6 +5,7 @@
5
5
  */
6
6
 
7
7
  const { createBaseDefinition } = require('./base-definition-factory');
8
+ const { itBundlesOnlyTheTargetPrismaEngine } = require('../../../__tests__/helpers/bundled-prisma-engine-excludes');
8
9
 
9
10
  describe('Base Definition Factory', () => {
10
11
  beforeEach(() => {
@@ -366,35 +367,7 @@ describe('Lambda architecture with usePrismaLambdaLayer=false', () => {
366
367
  );
367
368
  return Object.values(result.functions);
368
369
  };
369
- const layerOff = (architecture) => functionsOf(false, architecture);
370
- const layerOn = (architecture) => functionsOf(true, architecture);
371
-
372
- it.each([
373
- [undefined, 'rhel-openssl-3.0.x', 'linux-arm64-openssl-3.0.x'],
374
- ['x86_64', 'rhel-openssl-3.0.x', 'linux-arm64-openssl-3.0.x'],
375
- ['arm64', 'linux-arm64-openssl-3.0.x', 'rhel-openssl-3.0.x'],
376
- ])(
377
- 'with the layer off and architecture %s, the bundled Prisma keeps only the %s engine',
378
- async (architecture, target, otherTarget) => {
379
- for (const fn of await layerOff(architecture)) {
380
- expect(fn.package.exclude).toEqual(
381
- expect.arrayContaining(['**/libquery_engine-debian*', `**/libquery_engine-${otherTarget}*`])
382
- );
383
- expect(fn.package.exclude).not.toContain(`**/libquery_engine-${target}*`);
384
- }
385
- }
386
- );
387
-
388
- it('with the layer on, adds no engine patterns, since the layer carries the engines', async () => {
389
- for (const fn of await layerOn('arm64')) {
390
- expect(fn.package.exclude).not.toEqual(
391
- expect.arrayContaining(['**/libquery_engine-rhel-openssl-3.0.x*'])
392
- );
393
- expect(fn.package.exclude).not.toEqual(
394
- expect.arrayContaining(['**/libquery_engine-debian*'])
395
- );
396
- }
397
- });
370
+ itBundlesOnlyTheTargetPrismaEngine(functionsOf);
398
371
  });
399
372
 
400
373
  describe('nested node_modules (lambda.keepNestedNodeModules)', () => {
@@ -49,7 +49,8 @@ function parseLayerMarker(markerText) {
49
49
  coreVersion: marker.coreVersion,
50
50
  prismaClientVersion: marker.prismaClientVersion,
51
51
  };
52
- } catch (error) {
52
+ } catch {
53
+ // A marker written before the JSON format is plain text: treat it as a legacy build
53
54
  return {
54
55
  prismaBinaryTarget: LEGACY_MARKER_TARGET,
55
56
  clientPackages: null,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@friggframework/devtools",
3
3
  "prettier": "@friggframework/prettier-config",
4
- "version": "2.0.0--canary.731.fbc1a37.0",
4
+ "version": "2.0.0--canary.731.8f730e5.0",
5
5
  "bin": {
6
6
  "frigg": "./frigg-cli/index.js"
7
7
  },
@@ -28,9 +28,9 @@
28
28
  "@babel/eslint-parser": "^7.18.9",
29
29
  "@babel/parser": "^7.25.3",
30
30
  "@babel/traverse": "^7.25.3",
31
- "@friggframework/core": "2.0.0--canary.731.fbc1a37.0",
32
- "@friggframework/schemas": "2.0.0--canary.731.fbc1a37.0",
33
- "@friggframework/test": "2.0.0--canary.731.fbc1a37.0",
31
+ "@friggframework/core": "2.0.0--canary.731.8f730e5.0",
32
+ "@friggframework/schemas": "2.0.0--canary.731.8f730e5.0",
33
+ "@friggframework/test": "2.0.0--canary.731.8f730e5.0",
34
34
  "@hapi/boom": "^10.0.1",
35
35
  "@inquirer/prompts": "^5.3.8",
36
36
  "axios": "^1.18.0",
@@ -58,8 +58,8 @@
58
58
  "validate-npm-package-name": "^5.0.0"
59
59
  },
60
60
  "devDependencies": {
61
- "@friggframework/eslint-config": "2.0.0--canary.731.fbc1a37.0",
62
- "@friggframework/prettier-config": "2.0.0--canary.731.fbc1a37.0",
61
+ "@friggframework/eslint-config": "2.0.0--canary.731.8f730e5.0",
62
+ "@friggframework/prettier-config": "2.0.0--canary.731.8f730e5.0",
63
63
  "aws-sdk-client-mock": "^4.1.0",
64
64
  "aws-sdk-client-mock-jest": "^4.1.0",
65
65
  "jest": "^30.1.3",
@@ -91,5 +91,5 @@
91
91
  "publishConfig": {
92
92
  "access": "public"
93
93
  },
94
- "gitHead": "fbc1a37740d892d7b852e854f2bd657681150650"
94
+ "gitHead": "8f730e5991297a0039d70db2bad2a711bdb0f6ff"
95
95
  }