@tramvai/module-progressive-web-app 3.15.1 → 3.17.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.
@@ -14,6 +14,7 @@ const TramvaiPwaManifestModule = declareModule({
14
14
  var _a, _b;
15
15
  return {
16
16
  context: [manifestUrl],
17
+ // appConfig.assetsPrefix available in 'development' mode
17
18
  target: (_b = (_a = appConfig.assetsPrefix) !== null && _a !== void 0 ? _a : process.env.ASSETS_PREFIX) !== null && _b !== void 0 ? _b : '',
18
19
  pathRewrite: (path) => {
19
20
  return path.replace(swScope, '/');
@@ -18,6 +18,7 @@ const TramvaiPwaManifestModule = core.declareModule({
18
18
  var _a, _b;
19
19
  return {
20
20
  context: [manifestUrl],
21
+ // appConfig.assetsPrefix available in 'development' mode
21
22
  target: (_b = (_a = config.appConfig.assetsPrefix) !== null && _a !== void 0 ? _a : process.env.ASSETS_PREFIX) !== null && _b !== void 0 ? _b : '',
22
23
  pathRewrite: (path) => {
23
24
  return path.replace(swScope, '/');
@@ -1,9 +1,7 @@
1
1
  import { declareModule, provide } from '@tramvai/core';
2
2
  import { RENDER_SLOTS, ResourceType, ResourceSlot } from '@tramvai/tokens-render';
3
- import { appConfig } from '@tramvai/cli/lib/external/config';
4
3
  import { PWA_META_TOKEN } from '../tokens.es.js';
5
4
 
6
- var _a, _b, _c;
7
5
  const metaMap = {
8
6
  viewport: 'viewport',
9
7
  themeColor: 'theme-color',
@@ -17,7 +15,16 @@ const TramvaiPwaMetaModule = declareModule({
17
15
  providers: [
18
16
  provide({
19
17
  provide: PWA_META_TOKEN,
20
- useValue: (_c = (_b = (_a = appConfig.experiments) === null || _a === void 0 ? void 0 : _a.pwa) === null || _b === void 0 ? void 0 : _b.meta) !== null && _c !== void 0 ? _c : {},
18
+ useFactory: () => {
19
+ let meta = {};
20
+ try {
21
+ if (process.env.TRAMVAI_PWA_META) {
22
+ meta = JSON.parse(process.env.TRAMVAI_PWA_META);
23
+ }
24
+ }
25
+ catch (e) { }
26
+ return meta;
27
+ },
21
28
  }),
22
29
  provide({
23
30
  provide: RENDER_SLOTS,
@@ -4,10 +4,8 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var core = require('@tramvai/core');
6
6
  var tokensRender = require('@tramvai/tokens-render');
7
- var config = require('@tramvai/cli/lib/external/config');
8
7
  var tokens = require('../tokens.js');
9
8
 
10
- var _a, _b, _c;
11
9
  const metaMap = {
12
10
  viewport: 'viewport',
13
11
  themeColor: 'theme-color',
@@ -21,7 +19,16 @@ const TramvaiPwaMetaModule = core.declareModule({
21
19
  providers: [
22
20
  core.provide({
23
21
  provide: tokens.PWA_META_TOKEN,
24
- useValue: (_c = (_b = (_a = config.appConfig.experiments) === null || _a === void 0 ? void 0 : _a.pwa) === null || _b === void 0 ? void 0 : _b.meta) !== null && _c !== void 0 ? _c : {},
22
+ useFactory: () => {
23
+ let meta = {};
24
+ try {
25
+ if (process.env.TRAMVAI_PWA_META) {
26
+ meta = JSON.parse(process.env.TRAMVAI_PWA_META);
27
+ }
28
+ }
29
+ catch (e) { }
30
+ return meta;
31
+ },
25
32
  }),
26
33
  core.provide({
27
34
  provide: tokensRender.RENDER_SLOTS,
@@ -41,6 +41,7 @@ const TramvaiPwaWorkboxModule = declareModule({
41
41
  var _a, _b;
42
42
  return {
43
43
  context: [swUrl, swUrl.replace(/\.js$/, '.modern.js')],
44
+ // appConfig.assetsPrefix available in 'development' mode
44
45
  target: (_b = (_a = appConfig.assetsPrefix) !== null && _a !== void 0 ? _a : process.env.ASSETS_PREFIX) !== null && _b !== void 0 ? _b : '',
45
46
  pathRewrite: (path) => {
46
47
  return path.replace(swScope, '/');
@@ -45,6 +45,7 @@ const TramvaiPwaWorkboxModule = core.declareModule({
45
45
  var _a, _b;
46
46
  return {
47
47
  context: [swUrl, swUrl.replace(/\.js$/, '.modern.js')],
48
+ // appConfig.assetsPrefix available in 'development' mode
48
49
  target: (_b = (_a = config.appConfig.assetsPrefix) !== null && _a !== void 0 ? _a : process.env.ASSETS_PREFIX) !== null && _b !== void 0 ? _b : '',
49
50
  pathRewrite: (path) => {
50
51
  return path.replace(swScope, '/');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tramvai/module-progressive-web-app",
3
- "version": "3.15.1",
3
+ "version": "3.17.0",
4
4
  "description": "Pwa integration - SW, manifest, icons and meta",
5
5
  "browser": "lib/browser.js",
6
6
  "main": "lib/server.js",
@@ -23,15 +23,15 @@
23
23
  "registry": "https://registry.npmjs.org/"
24
24
  },
25
25
  "dependencies": {
26
- "@tramvai/tokens-common": "3.15.1",
27
- "@tramvai/tokens-render": "3.15.1",
28
- "@tramvai/tokens-server": "3.15.1",
26
+ "@tramvai/tokens-common": "3.17.0",
27
+ "@tramvai/tokens-render": "3.17.0",
28
+ "@tramvai/tokens-server": "3.17.0",
29
29
  "workbox-window": "^6.6.1"
30
30
  },
31
31
  "devDependencies": {},
32
32
  "peerDependencies": {
33
- "@tramvai/cli": "3.15.1",
34
- "@tramvai/core": "3.15.1",
33
+ "@tramvai/cli": "3.17.0",
34
+ "@tramvai/core": "3.17.0",
35
35
  "@tinkoff/dippy": "0.9.1",
36
36
  "tslib": "^2.4.0"
37
37
  }