gdu 4.1.5 → 4.2.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.
@@ -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,118 @@ 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://*.google.com',
75
+ 'https://*.google.com.au',
76
+ 'https://*.gstatic.com',
77
+ ],
78
+ },
79
+ {
80
+ key: 'font-src',
81
+ values: [
82
+ 'https://*.autoguru.com.au',
83
+ 'https://*.googleapis.com',
84
+ 'https://*.gstatic.com',
85
+ ],
86
+ },
87
+ {
88
+ key: 'worker-src',
89
+ values: ["'self'", 'blob:'],
90
+ },
91
+ {
92
+ key: 'child-src',
93
+ values: ["'self'", 'blob:'],
94
+ },
95
+ {
96
+ key: 'object-src',
97
+ values: ["'none'"],
98
+ },
99
+ {
100
+ key: 'connect-src',
101
+ values: [
102
+ "'self'",
103
+ '*.autoguru.com.au',
104
+ 'https://*.googletagmanager.com',
105
+ 'https://*.google-analytics.com',
106
+ 'https://*.google.com',
107
+ 'https://*.google.com.au',
108
+ 'https://*.gstatic.com',
109
+ 'https://*.googleadservices.com',
110
+ 'https://*.heapanalytics.com',
111
+ 'https://*.doubleclick.net',
112
+ 'https://*.mapbox.com',
113
+ 'https://*.quantserve.com',
114
+ 'https://*.wisepops.com',
115
+ 'https://*.tvsquared.com',
116
+ 'https://*.quantcount.com',
117
+ ],
118
+ },
119
+ {
120
+ key: 'script-src-elem',
121
+ values: [
122
+ "'self'",
123
+ "'unsafe-inline'",
124
+ 'https://*.autoguru.com.au',
125
+ 'https://*.google-analytics.com',
126
+ 'https://*.googletagmanager.com',
127
+ 'https://*.gstatic.com',
128
+ 'https://*.google.com',
129
+ 'https://*.google.com.au',
130
+ 'https://*.gstatic.com',
131
+ 'https://*.googleadservices.com',
132
+ 'https://*.heapanalytics.com',
133
+ 'https://*.doubleclick.net',
134
+ 'https://*.mapbox.com',
135
+ 'https://*.quantserve.com',
136
+ 'https://*.wisepops.com',
137
+ 'https://*.tvsquared.com',
138
+ 'https://*.quantcount.com',
139
+ ],
140
+ },
141
+ {
142
+ key: 'script-src',
143
+ values: [
144
+ "'self'",
145
+ "'unsafe-eval'",
146
+ 'https://*.autoguru.com.au',
147
+ 'https://*.googletagmanager.com',
148
+ 'https://*.google.com.au',
149
+ 'https://*.gstatic.com',
150
+ 'https://*.heapanalytics.com',
151
+ 'https://*.quantserve.com',
152
+ 'https://*.wisepops.com',
153
+ 'https://*.tvsquared.com',
154
+ 'https://*.quantcount.com',
155
+ ],
156
+ },
157
+ ];
158
+ const generateCSP = (cspList) => cspList.reduce((policies, csp, currentIndex) => `${policies}${currentIndex !== 0 ? '; ' : ''}${csp.key} ${csp.values.join(' ')}`, '');
159
+ exports.generateCSP = generateCSP;
87
160
  exports.defaultSecurityHeaders = [
88
161
  {
89
162
  key: 'X-DNS-Prefetch-Control',
@@ -97,10 +170,6 @@ exports.defaultSecurityHeaders = [
97
170
  key: 'X-Frame-Options',
98
171
  value: 'SAMEORIGIN https://*.autoguru.com.au',
99
172
  },
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
173
  ];
105
174
  const createNextJSConfig = (buildEnv) => {
106
175
  var _a, _b;
@@ -122,6 +191,7 @@ const createNextJSConfig = (buildEnv) => {
122
191
  ignoreBuildErrors: true,
123
192
  },
124
193
  images: {
194
+ minimumCacheTTL: 3153600000,
125
195
  formats: ['image/avif', 'image/webp'],
126
196
  deviceSizes: [640, 750, 828, 1080, 1200, 1920, 2048, 3840],
127
197
  imageSizes: [16, 32, 48, 64, 96, 128, 256, 384],
@@ -146,9 +216,13 @@ const createNextJSConfig = (buildEnv) => {
146
216
  .flatMap((configsDir) => [
147
217
  new dotenv_webpack_1.default({
148
218
  path: path_1.default.resolve(configsDir, '.env.defaults'),
219
+ prefix: 'process.env.',
220
+ ignoreStub: true,
149
221
  }),
150
222
  new dotenv_webpack_1.default({
151
223
  path: path_1.default.resolve(configsDir, `.env.${env}`),
224
+ prefix: 'process.env.',
225
+ ignoreStub: true,
152
226
  }),
153
227
  ])
154
228
  .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.5",
3
+ "version": "4.2.0",
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,12 +33,12 @@
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
- "babel-plugin-relay": "^11.0.2",
41
+ "babel-plugin-relay": "^13.2.0",
42
42
  "babel-plugin-treat": "^1.6.2",
43
43
  "browserslist-config-autoguru": "^2.1.2",
44
44
  "clean-webpack-plugin": "^4.0.0-alpha.0",
@@ -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",