gdu 4.1.3 → 4.1.6
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.
|
@@ -31,9 +31,10 @@ const hosts = ['localhost', localhost];
|
|
|
31
31
|
const runSPA = async (guruConfig) => {
|
|
32
32
|
const hooks = hooks_1.getHooks();
|
|
33
33
|
console.log(`${kleur_1.cyan('Starting dev server...')}`);
|
|
34
|
+
const appEnv = process.env.APP_ENV || 'dev';
|
|
34
35
|
const webpackConfig = hooks.webpackConfig
|
|
35
36
|
.call(webpack_config_1.default())
|
|
36
|
-
.find(({ name }) => name ===
|
|
37
|
+
.find(({ name }) => name === appEnv);
|
|
37
38
|
const consumerHtmlTemplate = getConsumerHtmlTemplate(guruConfig);
|
|
38
39
|
webpackConfig.plugins.push(new html_webpack_plugin_1.default({
|
|
39
40
|
template: consumerHtmlTemplate !== null && consumerHtmlTemplate !== void 0 ? consumerHtmlTemplate : 'auto',
|
|
@@ -56,6 +56,7 @@ const allowedScriptSources = [
|
|
|
56
56
|
'*.gstatic.com',
|
|
57
57
|
'*.googleadservices.com',
|
|
58
58
|
'*.heapanalytics.com',
|
|
59
|
+
'heapanalytics.com',
|
|
59
60
|
'*.doubleclick.net',
|
|
60
61
|
'*.mapbox.com',
|
|
61
62
|
'*.quantserve.com',
|
|
@@ -98,7 +99,7 @@ exports.defaultSecurityHeaders = [
|
|
|
98
99
|
},
|
|
99
100
|
{
|
|
100
101
|
key: 'Content-Security-Policy',
|
|
101
|
-
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}
|
|
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};`,
|
|
102
103
|
},
|
|
103
104
|
];
|
|
104
105
|
const createNextJSConfig = (buildEnv) => {
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const replacer = (filepath) => filepath.replace(/\\/g, '/');
|
|
3
|
+
const PathNormaliserPlugin = function (api) {
|
|
4
|
+
if (process.platform === 'win32') {
|
|
5
|
+
const t = api.types;
|
|
6
|
+
return {
|
|
7
|
+
name: 'path-normaliser',
|
|
8
|
+
visitor: {
|
|
9
|
+
CallExpression: {
|
|
10
|
+
enter: function (nodePath) {
|
|
11
|
+
const callee = nodePath.get('callee');
|
|
12
|
+
if (callee.isIdentifier() &&
|
|
13
|
+
callee.equals('name', 'require')) {
|
|
14
|
+
const arg = nodePath.get('arguments.0');
|
|
15
|
+
if (arg && arg.isStringLiteral()) {
|
|
16
|
+
const sourcePath = arg.node.value;
|
|
17
|
+
const targetPath = replacer(sourcePath);
|
|
18
|
+
if (sourcePath !== targetPath) {
|
|
19
|
+
arg.replaceWith(t.stringLiteral(targetPath));
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
return {
|
|
29
|
+
name: 'path-normaliser',
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
module.exports = PathNormaliserPlugin;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gdu",
|
|
3
|
-
"version": "4.1.
|
|
3
|
+
"version": "4.1.6",
|
|
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",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"@vanilla-extract/next-plugin": "^1.0.1",
|
|
39
39
|
"@vanilla-extract/webpack-plugin": "^2.1.0",
|
|
40
40
|
"babel-loader": "^8.2.2",
|
|
41
|
-
"babel-plugin-relay": "^
|
|
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",
|