gdu 4.1.6 → 4.2.1

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.
@@ -1,4 +1,11 @@
1
1
  export declare const withTM: (nextConfig?: {}) => {};
2
+ declare type CSPKey = 'frame-ancestors' | 'frame-src' | 'style-src' | 'img-src' | 'font-src' | 'worker-src' | 'child-src' | 'object-src' | 'connect-src' | 'script-src-elem' | 'script-src';
3
+ interface CSPItem {
4
+ key: CSPKey;
5
+ values: string[];
6
+ }
7
+ export declare const CSPDefaultsList: CSPItem[];
8
+ export declare const generateCSP: (cspList: CSPItem[]) => string;
2
9
  export declare const defaultSecurityHeaders: {
3
10
  key: string;
4
11
  value: string;
@@ -18,6 +25,7 @@ export declare const createNextJSConfig: (buildEnv: any) => {
18
25
  ignoreBuildErrors: boolean;
19
26
  };
20
27
  images: {
28
+ minimumCacheTTL: number;
21
29
  formats: string[];
22
30
  deviceSizes: number[];
23
31
  imageSizes: number[];
@@ -26,3 +34,4 @@ export declare const createNextJSConfig: (buildEnv: any) => {
26
34
  webpack: (defaultConfig: any) => any;
27
35
  };
28
36
  export declare const createNextJSTranspiledConfig: () => any;
37
+ export {};
@@ -22,7 +22,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
22
22
  return (mod && mod.__esModule) ? mod : { "default": mod };
23
23
  };
24
24
  Object.defineProperty(exports, "__esModule", { value: true });
25
- exports.createNextJSTranspiledConfig = exports.createNextJSConfig = exports.defaultSecurityHeaders = exports.withTM = void 0;
25
+ exports.createNextJSTranspiledConfig = exports.createNextJSConfig = exports.defaultSecurityHeaders = exports.generateCSP = exports.CSPDefaultsList = exports.withTM = void 0;
26
26
  const path_1 = __importStar(require("path"));
27
27
  const next_plugin_1 = require("@vanilla-extract/next-plugin");
28
28
  const dotenv_webpack_1 = __importDefault(require("dotenv-webpack"));
@@ -45,45 +45,120 @@ exports.withTM = next_transpile_modules_1.default([
45
45
  '@autoguru/layout',
46
46
  '@popperjs/core',
47
47
  ]);
48
- const allowedScriptSources = [
49
- "'self'",
50
- "'unsafe-inline'",
51
- '*.autoguru.com.au',
52
- '*.googletagmanager.com',
53
- '*.google-analytics.com',
54
- '*.google.com',
55
- '*.google.com.au',
56
- '*.gstatic.com',
57
- '*.googleadservices.com',
58
- '*.heapanalytics.com',
59
- 'heapanalytics.com',
60
- '*.doubleclick.net',
61
- '*.mapbox.com',
62
- '*.quantserve.com',
63
- '*.wisepops.com',
64
- '*.tvsquared.com',
65
- '*.quantcount.com',
66
- ].join(' ');
67
- const allowedStyleSources = [
68
- "'self'",
69
- "'unsafe-inline'",
70
- 'https://*.autoguru.com.au',
71
- 'https://*.googleapis.com',
72
- ].join(' ');
73
- const allowedIFrameSources = [
74
- "'self'",
75
- 'https://www.youtube.com',
76
- 'https://www.google.com',
77
- ].join(' ');
78
- const allowedImageSources = ["'self'"].join(' ');
79
- const allowedDataDomains = ['https://*'].join(' ');
80
- const allowedFontSources = [
81
- 'https://*.autoguru.com.au',
82
- 'https://*.googleapis.com',
83
- 'https://*.gstatic.com',
84
- ].join(' ');
85
- const allowedDataSources = ["'self'", 'blob:'].join(' ');
86
- const allowedObjectSources = ["'none'"].join(' ');
48
+ exports.CSPDefaultsList = [
49
+ {
50
+ key: 'frame-ancestors',
51
+ values: ['https://*.autoguru.com.au'],
52
+ },
53
+ {
54
+ key: 'frame-src',
55
+ values: ["'self'", 'https://www.youtube.com', 'https://www.google.com'],
56
+ },
57
+ {
58
+ key: 'style-src',
59
+ values: [
60
+ "'self'",
61
+ "'unsafe-inline'",
62
+ 'https://*.autoguru.com.au',
63
+ 'https://*.googleapis.com',
64
+ ],
65
+ },
66
+ {
67
+ key: 'img-src',
68
+ values: [
69
+ "'self'",
70
+ 'data:',
71
+ 'https://*.autoguru.com.au',
72
+ 'https://*.googletagmanager.com',
73
+ 'https://*.google-analytics.com',
74
+ 'https://*.heapanalytics.com/',
75
+ 'https://*.tvsquared.com',
76
+ 'https://*.google.com',
77
+ 'https://*.google.com.au',
78
+ 'https://*.gstatic.com',
79
+ ],
80
+ },
81
+ {
82
+ key: 'font-src',
83
+ values: [
84
+ 'https://*.autoguru.com.au',
85
+ 'https://*.googleapis.com',
86
+ 'https://*.gstatic.com',
87
+ ],
88
+ },
89
+ {
90
+ key: 'worker-src',
91
+ values: ["'self'", 'blob:'],
92
+ },
93
+ {
94
+ key: 'child-src',
95
+ values: ["'self'", 'blob:'],
96
+ },
97
+ {
98
+ key: 'object-src',
99
+ values: ["'none'"],
100
+ },
101
+ {
102
+ key: 'connect-src',
103
+ values: [
104
+ "'self'",
105
+ '*.autoguru.com.au',
106
+ 'https://*.googletagmanager.com',
107
+ 'https://*.google-analytics.com',
108
+ 'https://*.google.com',
109
+ 'https://*.google.com.au',
110
+ 'https://*.gstatic.com',
111
+ 'https://*.googleadservices.com',
112
+ 'https://*.heapanalytics.com',
113
+ 'https://*.doubleclick.net',
114
+ 'https://*.mapbox.com',
115
+ 'https://*.quantserve.com',
116
+ 'https://*.wisepops.com',
117
+ 'https://*.tvsquared.com',
118
+ 'https://*.quantcount.com',
119
+ ],
120
+ },
121
+ {
122
+ key: 'script-src-elem',
123
+ values: [
124
+ "'self'",
125
+ "'unsafe-inline'",
126
+ 'https://*.autoguru.com.au',
127
+ 'https://*.google-analytics.com',
128
+ 'https://*.googletagmanager.com',
129
+ 'https://*.gstatic.com',
130
+ 'https://*.google.com',
131
+ 'https://*.google.com.au',
132
+ 'https://*.gstatic.com',
133
+ 'https://*.googleadservices.com',
134
+ 'https://*.heapanalytics.com',
135
+ 'https://*.doubleclick.net',
136
+ 'https://*.mapbox.com',
137
+ 'https://*.quantserve.com',
138
+ 'https://*.wisepops.com',
139
+ 'https://*.tvsquared.com',
140
+ 'https://*.quantcount.com',
141
+ ],
142
+ },
143
+ {
144
+ key: 'script-src',
145
+ values: [
146
+ "'self'",
147
+ "'unsafe-eval'",
148
+ 'https://*.autoguru.com.au',
149
+ 'https://*.googletagmanager.com',
150
+ 'https://*.google.com.au',
151
+ 'https://*.gstatic.com',
152
+ 'https://*.heapanalytics.com',
153
+ 'https://*.quantserve.com',
154
+ 'https://*.wisepops.com',
155
+ 'https://*.tvsquared.com',
156
+ 'https://*.quantcount.com',
157
+ ],
158
+ },
159
+ ];
160
+ const generateCSP = (cspList) => cspList.reduce((policies, csp, currentIndex) => `${policies}${currentIndex !== 0 ? '; ' : ''}${csp.key} ${csp.values.join(' ')}`, '');
161
+ exports.generateCSP = generateCSP;
87
162
  exports.defaultSecurityHeaders = [
88
163
  {
89
164
  key: 'X-DNS-Prefetch-Control',
@@ -97,10 +172,6 @@ exports.defaultSecurityHeaders = [
97
172
  key: 'X-Frame-Options',
98
173
  value: 'SAMEORIGIN https://*.autoguru.com.au',
99
174
  },
100
- {
101
- key: 'Content-Security-Policy',
102
- value: `frame-ancestors https://*.autoguru.com.au; frame-src ${allowedIFrameSources}; style-src ${allowedStyleSources}; img-src ${allowedImageSources} data: ${allowedDataDomains}; font-src ${allowedFontSources}; worker-src ${allowedDataSources}; child-src ${allowedDataSources}; object-src ${allowedObjectSources};connect-src ${allowedScriptSources}; script-src-elem ${allowedScriptSources}; script-src ${allowedScriptSources};`,
103
- },
104
175
  ];
105
176
  const createNextJSConfig = (buildEnv) => {
106
177
  var _a, _b;
@@ -122,6 +193,7 @@ const createNextJSConfig = (buildEnv) => {
122
193
  ignoreBuildErrors: true,
123
194
  },
124
195
  images: {
196
+ minimumCacheTTL: 3153600000,
125
197
  formats: ['image/avif', 'image/webp'],
126
198
  deviceSizes: [640, 750, 828, 1080, 1200, 1920, 2048, 3840],
127
199
  imageSizes: [16, 32, 48, 64, 96, 128, 256, 384],
@@ -146,9 +218,13 @@ const createNextJSConfig = (buildEnv) => {
146
218
  .flatMap((configsDir) => [
147
219
  new dotenv_webpack_1.default({
148
220
  path: path_1.default.resolve(configsDir, '.env.defaults'),
221
+ prefix: 'process.env.',
222
+ ignoreStub: true,
149
223
  }),
150
224
  new dotenv_webpack_1.default({
151
225
  path: path_1.default.resolve(configsDir, `.env.${env}`),
226
+ prefix: 'process.env.',
227
+ ignoreStub: true,
152
228
  }),
153
229
  ])
154
230
  .forEach((plugin) => defaultConfig.plugins.push(plugin));
@@ -282,9 +282,13 @@ const baseOptions = (buildEnv, isMultiEnv) => ({
282
282
  ...configs_1.getConfigsDirs().flatMap((configsDir) => [
283
283
  new dotenv_webpack_1.default({
284
284
  path: path_1.default.resolve(configsDir, '.env.defaults'),
285
+ prefix: 'process.env.',
286
+ ignoreStub: true,
285
287
  }),
286
288
  new dotenv_webpack_1.default({
287
289
  path: path_1.default.resolve(configsDir, `.env.${process.env.APP_ENV || (isDev ? 'dev' : buildEnv)}`),
290
+ prefix: 'process.env.',
291
+ ignoreStub: true,
288
292
  }),
289
293
  ]),
290
294
  !isDev &&
package/gdu.d.ts CHANGED
@@ -20,11 +20,12 @@ declare namespace NodeJS {
20
20
  * Will be set to true when building for a browser
21
21
  */
22
22
  readonly browser: boolean;
23
- }
24
-
25
- interface ProcessEnv {
26
- readonly NODE_ENV: 'development' | 'production';
27
- readonly APP_ENV: 'dev' | 'test' | 'uat' | 'preprod' | 'prod' | string;
23
+ readonly env: {
24
+ APP_ENV: 'dev' | 'test' | 'uat' | 'preprod' | 'prod' | string;
25
+ GITHUB_ACTIONS: string;
26
+ GITHUB_REF: string;
27
+ NODE_ENV: 'development' | 'production';
28
+ };
28
29
  }
29
30
  }
30
31
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gdu",
3
- "version": "4.1.6",
3
+ "version": "4.2.1",
4
4
  "private": false,
5
5
  "description": "AutoGuru's development toolkit",
6
6
  "homepage": "https://github.com/autoguru-au/octane/tree/master/packages/gdu#readme",
@@ -33,10 +33,10 @@
33
33
  "@babel/runtime-corejs3": "^7.14.9",
34
34
  "@babel/template": "^7.14.5",
35
35
  "@graphql-tools/json-file-loader": "^6.2.6",
36
- "@vanilla-extract/babel-plugin": "^1.1.2",
37
- "@vanilla-extract/css": "^1.6.3",
38
- "@vanilla-extract/next-plugin": "^1.0.1",
39
- "@vanilla-extract/webpack-plugin": "^2.1.0",
36
+ "@vanilla-extract/babel-plugin": "^1.1.6",
37
+ "@vanilla-extract/css": "^1.7.1",
38
+ "@vanilla-extract/next-plugin": "^2.0.2",
39
+ "@vanilla-extract/webpack-plugin": "^2.1.10",
40
40
  "babel-loader": "^8.2.2",
41
41
  "babel-plugin-relay": "^13.2.0",
42
42
  "babel-plugin-treat": "^1.6.2",
@@ -48,7 +48,7 @@
48
48
  "date-fns": "^2.17.0",
49
49
  "deepmerge": "^4.2.2",
50
50
  "diary": "^0.0.12",
51
- "dotenv-webpack": "^7.0.3",
51
+ "dotenv-webpack": "^7.1.0",
52
52
  "ensure-gitignore": "^1.1.2",
53
53
  "env-ci": "^5.0.2",
54
54
  "execa": "^5.0.0",
@@ -65,7 +65,7 @@
65
65
  "kleur": "^4.1.4",
66
66
  "mini-css-extract-plugin": "^2.4.2",
67
67
  "mkdirp": "^1.0.4",
68
- "next": "^12.0.2",
68
+ "next": "^12.1.6",
69
69
  "next-transpile-modules": "^9.0.0",
70
70
  "node-fetch": "^2.6.1",
71
71
  "null-loader": "^4.0.1",