@jetshop/core 1.1.13-no-proxy.5 → 1.1.13-no-proxy.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -79,11 +79,6 @@ export default function createApolloServer({ apolloConfig, extensions = [] }) {
79
79
  schemas,
80
80
  resolvers
81
81
  });
82
- const engine = apolloConfig.engineApiKey
83
- ? {
84
- apiKey: apolloConfig.engineApiKey
85
- }
86
- : false;
87
82
  const apolloServer = new ApolloServer({
88
83
  schema,
89
84
  // Disable introspection in production
@@ -98,9 +93,13 @@ export default function createApolloServer({ apolloConfig, extensions = [] }) {
98
93
  persistedQueries: {
99
94
  cache: new InMemoryLRUCache()
100
95
  },
101
- tracing: false,
96
+ // Enable tracing if Apollo Engine is configured
97
+ tracing: !!apolloConfig.engineApiKey,
102
98
  cacheControl: true,
103
- engine
99
+ // By setting this to "false", we avoid using Apollo Server 2's
100
+ // integrated metric reporting and fall-back to using the Apollo
101
+ // Engine Proxy (running separately) for metric collection.
102
+ engine: false
104
103
  });
105
104
  return { apolloServer, schema };
106
105
  });
@@ -1 +1 @@
1
- {"version":3,"file":"createApolloServer.js","sourceRoot":"","sources":["createApolloServer.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAO,EACL,YAAY,EACZ,gBAAgB,EAChB,0BAA0B,EAC1B,YAAY,EAEb,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,KAAK,MAAM,YAAY,CAAC;AAG/B,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,EAAE,4BAA4B,EAAE,MAAM,uDAAuD,CAAC;AACrG,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD,MAAM,GAAG,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;AAClC,MAAM,IAAI,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;AACpC,MAAM,KAAK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AAC,MAAM,CAAC,CAAC;aAC7B;YACD,IAAI,MAAM,CAAC,SAAS,EAAE;gBACpB,KAAK,CAAC,SAAS,EAAE,MAAM,CAAC,SAAS,CAAC,CAAC;aACpC;SACF;QAED,MAAM,MAAM,GAAG,YAAY,CAAC;YAC1B,OAAO;YACP,SAAS;SACV,CAAC,CAAC;QAEH,MAAM,YAAY,GAAG,IAAI,YAAY,CAAC;YACpC,MAAM;YACN,sCAAsC;YACtC,aAAa,EAAE,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY;YACpD,OAAO,EAAE,CAAC,EAAE,GAAG,EAAqB,EAAW,EAAE;gBAC/C,MAAM,eAAe,GAAwB,GAAG,CAAC,GAAG,EAAE,SAAS,EAAE,EAAE,CAAC,CAAC;gBACrE,MAAM,OAAO,GAAyB,IAAI,CACxC,eAAe,EACf,gBAAgB,CACjB,CAAC;gBAEF,OAAO;oBACL,OAAO;iBACR,CAAC;YACJ,CAAC;YACD,gBAAgB,EAAE;gBAChB,KAAK,EAAE,IAAI,gBAAgB,EAAE;aAC9B;YACD,gDAAgD;YAChD,OAAO,EAAE,CAAC,CAAC,YAAY,CAAC,YAAY;YACpC,YAAY,EAAE,IAAI;YAClB,+DAA+D;YAC/D,gEAAgE;YAChE,2DAA2D;YAC3D,MAAM,EAAE,KAAK;SACd,CAAC,CAAC;QAEH,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,CAAC;IAClC,CAAC;CAAA"}
@@ -19,6 +19,7 @@ export const createDevServer = ({ apolloConfig, port, schemaExtensions }) => __a
19
19
  });
20
20
  apolloServer.applyMiddleware({ app: app });
21
21
  const { port: listenPort } = yield listen({
22
+ apolloConfig,
22
23
  app,
23
24
  port
24
25
  });
@@ -1 +1 @@
1
- {"version":3,"file":"createDevServer.js","sourceRoot":"","sources":["createDevServer.ts"],"names":[],"mappings":";;;;;;;;AACA,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AACnC,OAAO,kBAAwC,MAAM,sBAAsB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,CAAC,CAAC;IAEH,YAAY,CAAC,eAAe,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC;IAE3C,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,GAAG,MAAM,MAAM,CAAC;QACxC,YAAY;QACZ,GAAG;QACH,IAAI;KACL,CAAC,CAAC;IAEH,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,YAAY,EAAE,CAAC;AAC5C,CAAC,CAAA,CAAC;AAEF,eAAe,eAAe,CAAC"}
@@ -1,4 +1,10 @@
1
- declare const createServer: () => Promise<{
1
+ import { Client } from 'raven';
2
+ export interface CreateServerOptions {
3
+ Raven: Client;
4
+ }
5
+ declare const createServer: ({ Raven }: {
6
+ Raven: Client;
7
+ }) => Promise<{
2
8
  app: import("express-serve-static-core").Express;
3
9
  }>;
4
10
  export default createServer;
@@ -7,6 +7,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
7
7
  });
8
8
  };
9
9
  import express from 'express';
10
+ import compression from 'compression';
10
11
  import paths from '@jetshop/react-scripts/config/paths';
11
12
  import breakpointMiddleware from '@jetshop/core/boot/server/breakpointMiddleware';
12
13
  import cookiesMiddleware from 'universal-cookie-express';
@@ -18,13 +19,18 @@ process.on('unhandledRejection', err => {
18
19
  report(err, { reason: 'unhandledRejection' });
19
20
  throw err;
20
21
  });
21
- const createServer = () => __awaiter(this, void 0, void 0, function* () {
22
+ const createServer = ({ Raven }) => __awaiter(this, void 0, void 0, function* () {
22
23
  const app = express();
24
+ // hook up Sentry.io, Raven as the first middleware
25
+ app.use(Raven.requestHandler());
26
+ app.use(compression());
23
27
  app.use(breakpointMiddleware);
24
28
  app.use(cookiesMiddleware());
25
29
  app.use(express.static(paths.appBuild + '/client', {
26
30
  maxAge: '365d'
27
31
  }));
32
+ // hook in Raven error handler as the first error middleware
33
+ app.use(Raven.errorHandler());
28
34
  return { app };
29
35
  });
30
36
  export default createServer;
@@ -1 +1 @@
1
- {"version":3,"file":"createServer.js","sourceRoot":"","sources":["createServer.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,MAAM,qCAAqC,CAAC;AACxD,OAAO,oBAAoB,MAAM,gDAAgD,CAAC;AAClF,OAAO,iBAAiB,MAAM,0BAA0B,CAAC;AACzD,OAAO,MAAM,MAAM,sBAAsB,CAAC;AAE1C,qEAAqE;AACrE,6EAA6E;AAC7E,2DAA2D;AAC3D,OAAO,CAAC,EAAE,CAAC,oBAAoB,EAAE,GAAG,CAAC,EAAE;IACrC,MAAM,CAAC,GAAG,EAAE,EAAE,MAAM,EAAE,oBAAoB,EAAE,CAAC,CAAC;IAC9C,MAAM,GAAG,CAAC;AACZ,CAAC,CAAC,CAAC;AAEH,MAAM,YAAY,GAAG,GAAS,EAAE;IAC9B,MAAM,GAAG,GAAG,OAAO,EAAE,CAAC;IAEtB,GAAG,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;IAC9B,GAAG,CAAC,GAAG,CAAC,iBAAiB,EAAE,CAAC,CAAC;IAE7B,GAAG,CAAC,GAAG,CACL,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,GAAG,SAAS,EAAE;QACzC,MAAM,EAAE,MAAM;KACf,CAAC,CACH,CAAC;IAEF,OAAO,EAAE,GAAG,EAAE,CAAC;AACjB,CAAC,CAAA,CAAC;AAEF,eAAe,YAAY,CAAC"}
1
+ {"version":3,"file":"createServer.js","sourceRoot":"","sources":["createServer.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,OAAO,WAAW,MAAM,aAAa,CAAC;AACtC,OAAO,KAAK,MAAM,qCAAqC,CAAC;AACxD,OAAO,oBAAoB,MAAM,gDAAgD,CAAC;AAClF,OAAO,iBAAiB,MAAM,0BAA0B,CAAC;AACzD,OAAO,MAAM,MAAM,sBAAsB,CAAC;AAG1C,qEAAqE;AACrE,6EAA6E;AAC7E,2DAA2D;AAC3D,OAAO,CAAC,EAAE,CAAC,oBAAoB,EAAE,GAAG,CAAC,EAAE;IACrC,MAAM,CAAC,GAAG,EAAE,EAAE,MAAM,EAAE,oBAAoB,EAAE,CAAC,CAAC;IAC9C,MAAM,GAAG,CAAC;AACZ,CAAC,CAAC,CAAC;AAMH,MAAM,YAAY,GAAG,CAAO,EAAE,KAAK,EAAqB,EAAE,EAAE;IAC1D,MAAM,GAAG,GAAG,OAAO,EAAE,CAAC;IAEtB,mDAAmD;IACnD,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,cAAc,EAAE,CAAC,CAAC;IAEhC,GAAG,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC,CAAC;IACvB,GAAG,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;IAC9B,GAAG,CAAC,GAAG,CAAC,iBAAiB,EAAE,CAAC,CAAC;IAE7B,GAAG,CAAC,GAAG,CACL,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,GAAG,SAAS,EAAE;QACzC,MAAM,EAAE,MAAM;KACf,CAAC,CACH,CAAC;IAEF,4DAA4D;IAC5D,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,YAAY,EAAE,CAAC,CAAC;IAE9B,OAAO,EAAE,GAAG,EAAE,CAAC;AACjB,CAAC,CAAA,CAAC;AAEF,eAAe,YAAY,CAAC"}
@@ -12,6 +12,7 @@ import createServer from './createServer';
12
12
  import createRenderer from './createRenderer';
13
13
  import listen from './listen';
14
14
  import asyncErrorHandler from './asyncErrorHandler';
15
+ import Raven from 'raven';
15
16
  import paths from '@jetshop/react-scripts/config/paths';
16
17
  // Increase global max sockets to fix issues with pending requests queuing up.
17
18
  // See http://glynnbird.tumblr.com/post/54587194641/increasing-number-of-outgoing-http-sockets-in
@@ -31,9 +32,12 @@ const boot = (Component, { apolloConfig, trackingID, tagManagerID, sentryServerD
31
32
  'Check your shop.config.js for sentryServerDSN');
32
33
  process.exit(1);
33
34
  }
35
+ Raven.config(sentryServerDSN, { tags: { BUILD_TARGET: 'server' } }).install();
34
36
  const template = fs.readFileSync(templatePath, 'utf8');
35
37
  const preloadStats = JSON.parse(fs.readFileSync(loadableStatsPath, 'utf8'));
36
- const { app } = yield createServer();
38
+ const { app } = yield createServer({
39
+ Raven: Raven
40
+ });
37
41
  const renderer = createRenderer(template, Component, {
38
42
  preloadStats,
39
43
  apolloConfig,
@@ -44,7 +48,7 @@ const boot = (Component, { apolloConfig, trackingID, tagManagerID, sentryServerD
44
48
  });
45
49
  app.use(asyncErrorHandler(renderer));
46
50
  const port = parseInt(process.env.PORT, 10) || 3000;
47
- yield listen({ app, port });
51
+ yield listen({ app, port, apolloConfig });
48
52
  console.log(`🚀 App ready at http://localhost:${port}`);
49
53
  });
50
54
  export default boot;
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAO,EAAE,MAAM,IAAI,CAAC;AAEpB,OAAO,kBAAkB,MAAM,oCAAoC,CAAC;AAEpE,OAAO,YAAY,MAAM,gBAAgB,CAAC;AAC1C,OAAO,cAAc,MAAM,kBAAkB,CAAC;AAC9C,OAAO,MAAM,MAAM,UAAU,CAAC;AAG9B,OAAO,iBAAiB,MAAM,qBAAqB,CAAC;AAEpD,OAAO,KAAK,MAAM,qCAAqC,CAAC;AAExD,8EAA8E;AAC9E,iGAAiG;AACjG,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,IAAI,CAAC,WAAW,CAAC,UAAU,GAAG,KAAK,CAAC,WAAW,CAAC,UAAU,GAAG,QAAQ,CAAC;AAEtE,MAAM,YAAY,GAAG,KAAK,CAAC,QAAQ,GAAG,aAAa,CAAC;AACpD,MAAM,iBAAiB,GAAG,KAAK,CAAC,QAAQ,GAAG,sBAAsB,CAAC;AA2BlE,MAAM,cAAc,GAAG,CAAC,GAAW,EAAE,EAAE,CAAC,CAAC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,CAAC,KAAK,KAAK,EAAE;QAC7C,OAAO,CAAC,KAAK,CACX,kDAAkD;YAChD,+CAA+C,CAClD,CAAC;QACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;KACjB;IAED,KAAK,CAAC,MAAM,CAAC,eAAe,EAAE,EAAE,IAAI,EAAE,EAAE,YAAY,EAAE,QAAQ,EAAE,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC;IAE9E,MAAM,QAAQ,GAAG,EAAE,CAAC,YAAY,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;IACvD,MAAM,YAAY,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,iBAAiB,EAAE,MAAM,CAAC,CAAC,CAAC;IAE5E,MAAM,EAAE,GAAG,EAAE,GAAG,MAAM,YAAY,CAAC;QACjC,KAAK,EAAE,KAAY;KACpB,CAAC,CAAC;IAEH,MAAM,QAAQ,GAAG,cAAc,CAAC,QAAQ,EAAE,SAAS,EAAE;QACnD,YAAY;QACZ,YAAY;QACZ,UAAU;QACV,YAAY;QACZ,IAAI;QACJ,gBAAgB;KACjB,CAAC,CAAC;IAEH,GAAG,CAAC,GAAG,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAC,CAAC;IAErC,MAAM,IAAI,GAAG,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,IAAI,CAAC;IAEpD,MAAM,MAAM,CAAC,EAAE,GAAG,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC,CAAC;IAE1C,OAAO,CAAC,GAAG,CAAC,qCAAqC,IAAI,EAAE,CAAC,CAAC;AAC3D,CAAC,CAAA,CAAC;AAEF,eAAe,IAAI,CAAC"}
@@ -1,10 +1,13 @@
1
+ import { ApolloConfig } from '@jetshop/core/boot/apollo';
1
2
  import { Application as ExpressApp } from 'express';
2
3
  export interface ListenOptions {
3
4
  app: ExpressApp;
4
5
  port: number;
6
+ apolloConfig: ApolloConfig;
5
7
  }
6
8
  /**
7
9
  * - Starts listening to `port`
10
+ * - Wraps Express server in Apollo Engine if `apolloConfig.engineApiKey` is set
8
11
  */
9
12
  declare const listen: ({ app, port }: ListenOptions) => Promise<{
10
13
  port: number;
@@ -1,5 +1,6 @@
1
1
  /**
2
2
  * - Starts listening to `port`
3
+ * - Wraps Express server in Apollo Engine if `apolloConfig.engineApiKey` is set
3
4
  */
4
5
  const listen = ({ app, port }) => new Promise((resolve, reject) => {
5
6
  const http = app.listen({ port }, (err) => {
@@ -1 +1 @@
1
- {"version":3,"file":"listen.js","sourceRoot":"","sources":["listen.ts"],"names":[],"mappings":"AAOA;;GAEG;AACH,MAAM,MAAM,GAAG,CAAC,EAAE,GAAG,EAAE,IAAI,EAAiB,EAA6B,EAAE,CACzE,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;IAC9B,MAAM,IAAI,GAAG,GAAG,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,EAAE,CAAC,GAAW,EAAE,EAAE;QAChD,GAAG;YACD,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC;YACb,CAAC,CAAC,OAAO,CAAC;gBACN,IAAI,EAAG,IAAI,CAAC,OAAO,EAAoB,CAAC,IAAI;aAC7C,CAAC,CAAC;IACT,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEL,eAAe,MAAM,CAAC"}
1
+ {"version":3,"file":"listen.js","sourceRoot":"","sources":["listen.ts"],"names":[],"mappings":"AASA;;;GAGG;AACH,MAAM,MAAM,GAAG,CAAC,EAAE,GAAG,EAAE,IAAI,EAAiB,EAA6B,EAAE,CACzE,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;IAC9B,MAAM,IAAI,GAAG,GAAG,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,EAAE,CAAC,GAAW,EAAE,EAAE;QAChD,GAAG;YACD,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC;YACb,CAAC,CAAC,OAAO,CAAC;gBACN,IAAI,EAAG,IAAI,CAAC,OAAO,EAAoB,CAAC,IAAI;aAC7C,CAAC,CAAC;IACT,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEL,eAAe,MAAM,CAAC"}
@@ -1,2 +1,4 @@
1
- declare const report: (error: Error, info?: any) => void;
1
+ declare const report: (error: Error, info?: {
2
+ [key: string]: any;
3
+ }) => string;
2
4
  export default report;
package/errorReporting.js CHANGED
@@ -1,3 +1,37 @@
1
- const report = (error, info) => console.error(error, info);
1
+ /*
2
+ use process.env.BUILD_TARGET as compile variable and not the
3
+ imported from @jetshop/core/inServer, because they get different behavior.
4
+ when the state is evaluated at compile time only one
5
+ of the lines will be picked and transpiled into the final code.
6
+ this is important because raven (not raven-js) cant be compiled in
7
+ the client due to non-existing modules in the browser and causes a
8
+ crash in webpack when building it.
9
+ */
10
+ let Raven;
11
+ if (process.env.BUILD_TARGET === 'server') {
12
+ Raven = require('raven');
13
+ }
14
+ else {
15
+ Raven = require('raven-js');
16
+ }
17
+ const convertAnyToError = (error) => {
18
+ const errorType = Object.prototype.toString.call(error);
19
+ try {
20
+ switch (errorType) {
21
+ case '[object Error]':
22
+ return error;
23
+ case '[object String]':
24
+ return new Error(error);
25
+ default:
26
+ return new Error(JSON.stringify(error));
27
+ }
28
+ }
29
+ catch (err) {
30
+ return err;
31
+ }
32
+ };
33
+ const report = (error, info = {}) => Raven.captureException(convertAnyToError(error), {
34
+ extra: info
35
+ });
2
36
  export default report;
3
37
  //# sourceMappingURL=errorReporting.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"errorReporting.js","sourceRoot":"","sources":["errorReporting.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,GAAG,CAAC,KAAY,EAAE,IAAU,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;AAExE,eAAe,MAAM,CAAC"}
1
+ {"version":3,"file":"errorReporting.js","sourceRoot":"","sources":["errorReporting.ts"],"names":[],"mappings":"AAEA;;;;;;;;EAQE;AACF,IAAI,KAAa,CAAC;AAClB,IAAI,OAAO,CAAC,GAAG,CAAC,YAAY,KAAK,QAAQ,EAAE;IACzC,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CAC1B;KAAM;IACL,KAAK,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;CAC7B;AAED,MAAM,iBAAiB,GAAG,CAAC,KAAU,EAAE,EAAE;IACvC,MAAM,SAAS,GAAG,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACxD,IAAI;QACF,QAAQ,SAAS,EAAE;YACjB,KAAK,gBAAgB;gBACnB,OAAO,KAAK,CAAC;YAEf,KAAK,iBAAiB;gBACpB,OAAO,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC;YAE1B;gBACE,OAAO,IAAI,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC;SAC3C;KACF;IAAC,OAAO,GAAG,EAAE;QACZ,OAAO,GAAG,CAAC;KACZ;AACH,CAAC,CAAC;AAEF,MAAM,MAAM,GAAG,CAAC,KAAY,EAAE,OAAgC,EAAE,EAAE,EAAE,CAClE,KAAK,CAAC,gBAAgB,CAAC,iBAAiB,CAAC,KAAK,CAAC,EAAE;IAC/C,KAAK,EAAE,IAAI;CACZ,CAAC,CAAC;AAEL,eAAe,MAAM,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetshop/core",
3
- "version": "1.1.13-no-proxy.5",
3
+ "version": "1.1.13-no-proxy.1",
4
4
  "main": "index.js",
5
5
  "license": "MIT",
6
6
  "dependencies": {
@@ -10,15 +10,17 @@
10
10
  "@types/lodash.get": "^4.4.4",
11
11
  "@types/lodash.merge": "^4.6.4",
12
12
  "@types/lodash.pick": "^4.4.4",
13
- "@types/node": "^10.12.12",
13
+ "@types/node": "^8.0.53",
14
14
  "@types/node-fetch": "^2.1.2",
15
15
  "@types/qs": "^6.5.1",
16
+ "@types/raven": "^2.5.1",
16
17
  "@types/react": "^16.4.18",
17
18
  "@types/react-dom": "^16.0.9",
18
19
  "@types/react-helmet-async": "^0.0.0",
19
20
  "@types/react-loadable": "^5.4.1",
20
21
  "apollo-cache-inmemory": "^1.3.9",
21
22
  "apollo-client": "^2.4.5",
23
+ "apollo-engine": "^1.1.2",
22
24
  "apollo-link": "^1.2.3",
23
25
  "apollo-link-context": "^1.0.9",
24
26
  "apollo-link-error": "^1.1.1",
@@ -52,6 +54,8 @@
52
54
  "nodemon": "^1.18.7",
53
55
  "prop-types": "^15.6.2",
54
56
  "qs": "^6.5.2",
57
+ "raven": "^2.6.4",
58
+ "raven-js": "^3.27.0",
55
59
  "react": "^16.6.0",
56
60
  "react-apollo": "^2.2.4",
57
61
  "react-cookie": "^3.0.8",
package/polyfills.js CHANGED
@@ -11,11 +11,7 @@ const polyfills = (locale) => [
11
11
  'String.prototype.endsWith',
12
12
  'String.prototype.startsWith',
13
13
  'Object.keys',
14
- 'IntersectionObserver',
15
14
  `Intl.~locale.${locale}`
16
15
  ];
17
- export const createPolyfill = (locale) => {
18
- const features = polyfills(locale).join(',');
19
- return `<script async defer src="//cdn.polyfill.io/v2/polyfill${process.env.NODE_ENV === 'production' ? '.min' : ''}.js?features=${features}&flags=gated&callback=bootShop"></script>`;
20
- };
16
+ export const createPolyfill = (locale) => `<script src="//cdn.polyfill.io/v2/polyfill${process.env.NODE_ENV === 'production' ? '.min' : ''}.js?features=${polyfills(locale).join(',')}&flags=gated"></script>`;
21
17
  //# sourceMappingURL=polyfills.js.map
package/polyfills.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"polyfills.js","sourceRoot":"","sources":["polyfills.ts"],"names":[],"mappings":"AAAA,MAAM,SAAS,GAAG,CAAC,MAAc,EAAE,EAAE,CAAC;IACpC,KAAK;IACL,YAAY;IACZ,sBAAsB;IACtB,eAAe;IACf,gBAAgB;IAChB,sBAAsB;IACtB,2BAA2B;IAC3B,0BAA0B;IAC1B,sBAAsB;IACtB,2BAA2B;IAC3B,6BAA6B;IAC7B,aAAa;IACb,sBAAsB;IACtB,gBAAgB,MAAM,EAAE;CACzB,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,MAAc,EAAE,EAAE;IAC/C,MAAM,QAAQ,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC7C,OAAO,yDACL,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EACnD,gBAAgB,QAAQ,2CAA2C,CAAC;AACtE,CAAC,CAAC"}
1
+ {"version":3,"file":"polyfills.js","sourceRoot":"","sources":["polyfills.ts"],"names":[],"mappings":"AAAA,MAAM,SAAS,GAAG,CAAC,MAAc,EAAE,EAAE,CAAC;IACpC,KAAK;IACL,YAAY;IACZ,sBAAsB;IACtB,eAAe;IACf,gBAAgB;IAChB,sBAAsB;IACtB,2BAA2B;IAC3B,0BAA0B;IAC1B,sBAAsB;IACtB,2BAA2B;IAC3B,6BAA6B;IAC7B,aAAa;IACb,gBAAgB,MAAM,EAAE;CACzB,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,MAAc,EAAE,EAAE,CAC/C,6CACE,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EACnD,gBAAgB,SAAS,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,yBAAyB,CAAC"}