@vue-storefront/nuxt 2.7.0 → 2.7.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.
- package/lib/index.cjs.js +1 -1
- package/lib/index.es.js +1 -1
- package/package.json +1 -1
- package/plugins/i18n-cookies.js +4 -1
package/lib/index.cjs.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("fs"),t=require("path"),n=require("consola"),r=require("chalk"),s=require("lodash");function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var u=o(e),i=o(t),c=o(n),l=o(r),a=Object.freeze({info:function(e){return c.default.info(l.default.bold("VSF"),e)},success:function(e){return c.default.success(l.default.bold("VSF"),e)},warning:function(e){return c.default.warn(l.default.bold("VSF"),e)},error:function(e){return c.default.error(l.default.bold("VSF"),e)}}),d=function(e,t){return s.mergeWith(e,t,(function(e,t){if(s.isArray(e))return e.concat(t)}))};function p(e){try{return require.resolve(e,{paths:[process.cwd()]})}catch(e){return""}}function f(){this.options.render=s.merge(this.options.render,{http2:{push:!0,pushAssets:function(e,t,n,r){return r.filter((function(e){return"script"===e.asType})).map((function(e){var t=e.file,r=e.asType;return"<".concat(n).concat(t,">; rel=preload; as=").concat(r)}))}}})}function h(e){this.nuxt.hook("modules:done",(function(t){return t.addModule(["nuxt-purgecss",e])}))}function g(e){var t=e.performance,n=t.httpPush,r=t.purgeCSS;n&&f.call(this),r&&r.enabled&&h.call(this,r)}function v(e){var t=["@storefront-ui/vue","@storefront-ui/shared"];e.useRawSource=d(e.useRawSource,{dev:t,prod:t})}function m(e){v.call(this,e)}function S(e){var t=this;e.useRawSource[function(e){return"production"===process.env.NODE_ENV||e.coreDevelopment}(e)?"prod":"dev"].map((function(e){return function(e){var n=p("".concat(e,"/package.json")),r=require(n||"");r.module&&t.extendBuild((function(t){t.resolve.alias[r.name+"$"]=p("".concat(e,"/").concat(r.module))})),t.options.build.transpile.push(e),a.info("Using raw source/ESM for ".concat(r.name))}(e)}))}var x={name:"@vue-storefront/nuxt",version:"2.7.
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("fs"),t=require("path"),n=require("consola"),r=require("chalk"),s=require("lodash");function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var u=o(e),i=o(t),c=o(n),l=o(r),a=Object.freeze({info:function(e){return c.default.info(l.default.bold("VSF"),e)},success:function(e){return c.default.success(l.default.bold("VSF"),e)},warning:function(e){return c.default.warn(l.default.bold("VSF"),e)},error:function(e){return c.default.error(l.default.bold("VSF"),e)}}),d=function(e,t){return s.mergeWith(e,t,(function(e,t){if(s.isArray(e))return e.concat(t)}))};function p(e){try{return require.resolve(e,{paths:[process.cwd()]})}catch(e){return""}}function f(){this.options.render=s.merge(this.options.render,{http2:{push:!0,pushAssets:function(e,t,n,r){return r.filter((function(e){return"script"===e.asType})).map((function(e){var t=e.file,r=e.asType;return"<".concat(n).concat(t,">; rel=preload; as=").concat(r)}))}}})}function h(e){this.nuxt.hook("modules:done",(function(t){return t.addModule(["nuxt-purgecss",e])}))}function g(e){var t=e.performance,n=t.httpPush,r=t.purgeCSS;n&&f.call(this),r&&r.enabled&&h.call(this,r)}function v(e){var t=["@storefront-ui/vue","@storefront-ui/shared"];e.useRawSource=d(e.useRawSource,{dev:t,prod:t})}function m(e){v.call(this,e)}function S(e){var t=this;e.useRawSource[function(e){return"production"===process.env.NODE_ENV||e.coreDevelopment}(e)?"prod":"dev"].map((function(e){return function(e){var n=p("".concat(e,"/package.json")),r=require(n||"");r.module&&t.extendBuild((function(t){t.resolve.alias[r.name+"$"]=p("".concat(e,"/").concat(r.module))})),t.options.build.transpile.push(e),a.info("Using raw source/ESM for ".concat(r.name))}(e)}))}var x={name:"@vue-storefront/nuxt",version:"2.7.1",main:"lib/index.cjs.js",module:"lib/index.es.js",types:"lib/src/index.d.ts",scripts:{build:"rimraf lib && rollup -c",test:'echo "Error: no test specified" && exit 1',prepublish:"yarn build"},author:"Vue Storefront",license:"MIT",dependencies:{"@nuxt/typescript-build":"^2.0.0","@nuxtjs/composition-api":"^0.29.3","@nuxtjs/style-resources":"^1.0.0",chalk:"^2.4.2",chokidar:"^3.3.1",consola:"^2.10.1",lodash:"^4.17.15","nuxt-purgecss":"^1.0.0"},devDependencies:{"@nuxt/types":"^2.15.8","@rollup/plugin-json":"~4.1.0"},publishConfig:{access:"public"},files:["lib/**/*","plugins/**/*"],engines:{node:">=14 <=16"}};exports.default=function(e){var t=d({coreDevelopment:!1,i18nExtension:!0,e2e:!0,logger:!0,ssr:!0,context:!0,sfui:!0,performance:{httpPush:!0,purgeCSS:{enabled:!1,paths:["**/*.vue"]}},useRawSource:{dev:[],prod:[]}},e);this.options.head.meta.push({name:"generator",content:"Vue Storefront 2"}),a.info("Starting Vue Storefront Nuxt Module"),t.performance.httpPush&&(this.options.render=d(this.options.render,{http2:{push:!0,pushAssets:function(e,t,n,r){return r.filter((function(e){return"script"===e.asType})).map((function(e){var t=e.file,r=e.asType;return"<".concat(n).concat(t,">; rel=preload; as=").concat(r)}))}}})),t.context&&(this.addPlugin(i.default.resolve(__dirname,"../plugins/context.js")),a.success("Installed Vue Storefront Context plugin")),t.ssr&&(this.addPlugin(i.default.resolve(__dirname,"../plugins/ssr.js")),a.success("Installed Vue Storefront SSR plugin")),t.logger&&(this.addPlugin({src:i.default.resolve(__dirname,"../plugins/logger.js"),options:e.logger||{}}),a.success("Installed VSF Logger plugin")),t.e2e&&(this.addPlugin(i.default.resolve(__dirname,"../plugins/e2e-testing.js")),a.success("Installed Vue Storefront E2E testing plugin")),t.i18nExtension&&(this.addPlugin({src:i.default.resolve(__dirname,"../plugins/i18n-cookies.js"),options:this.options.i18n}),a.success("Installed Internationalization Cookies plugin")),u.default.existsSync(p("@storefront-ui/vue"))&&t.sfui&&(m.call(this,t),a.success("Installed StorefrontUI Module")),g.call(this,t),a.success("Installed Performance Module"),S.call(this,t)},exports.meta=x;
|
|
2
2
|
//# sourceMappingURL=index.cjs.js.map
|
package/lib/index.es.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import e from"fs";import n from"path";import t from"consola";import s from"chalk";import{mergeWith as o,isArray as r,merge as i}from"lodash";var u=Object.freeze({info:function(e){return t.info(s.bold("VSF"),e)},success:function(e){return t.success(s.bold("VSF"),e)},warning:function(e){return t.warn(s.bold("VSF"),e)},error:function(e){return t.error(s.bold("VSF"),e)}}),c=function(e,n){return o(e,n,(function(e,n){if(r(e))return e.concat(n)}))};function l(e){try{return require.resolve(e,{paths:[process.cwd()]})}catch(e){return""}}function a(){this.options.render=i(this.options.render,{http2:{push:!0,pushAssets:function(e,n,t,s){return s.filter((function(e){return"script"===e.asType})).map((function(e){var n=e.file,s=e.asType;return"<".concat(t).concat(n,">; rel=preload; as=").concat(s)}))}}})}function p(e){this.nuxt.hook("modules:done",(function(n){return n.addModule(["nuxt-purgecss",e])}))}function d(e){var n=e.performance,t=n.httpPush,s=n.purgeCSS;t&&a.call(this),s&&s.enabled&&p.call(this,s)}function f(e){var n=["@storefront-ui/vue","@storefront-ui/shared"];e.useRawSource=c(e.useRawSource,{dev:n,prod:n})}function h(e){f.call(this,e)}function g(e){var n=this;e.useRawSource[function(e){return"production"===process.env.NODE_ENV||e.coreDevelopment}(e)?"prod":"dev"].map((function(e){return function(e){var t=l("".concat(e,"/package.json")),s=require(t||"");s.module&&n.extendBuild((function(n){n.resolve.alias[s.name+"$"]=l("".concat(e,"/").concat(s.module))})),n.options.build.transpile.push(e),u.info("Using raw source/ESM for ".concat(s.name))}(e)}))}var m={name:"@vue-storefront/nuxt",version:"2.7.
|
|
1
|
+
import e from"fs";import n from"path";import t from"consola";import s from"chalk";import{mergeWith as o,isArray as r,merge as i}from"lodash";var u=Object.freeze({info:function(e){return t.info(s.bold("VSF"),e)},success:function(e){return t.success(s.bold("VSF"),e)},warning:function(e){return t.warn(s.bold("VSF"),e)},error:function(e){return t.error(s.bold("VSF"),e)}}),c=function(e,n){return o(e,n,(function(e,n){if(r(e))return e.concat(n)}))};function l(e){try{return require.resolve(e,{paths:[process.cwd()]})}catch(e){return""}}function a(){this.options.render=i(this.options.render,{http2:{push:!0,pushAssets:function(e,n,t,s){return s.filter((function(e){return"script"===e.asType})).map((function(e){var n=e.file,s=e.asType;return"<".concat(t).concat(n,">; rel=preload; as=").concat(s)}))}}})}function p(e){this.nuxt.hook("modules:done",(function(n){return n.addModule(["nuxt-purgecss",e])}))}function d(e){var n=e.performance,t=n.httpPush,s=n.purgeCSS;t&&a.call(this),s&&s.enabled&&p.call(this,s)}function f(e){var n=["@storefront-ui/vue","@storefront-ui/shared"];e.useRawSource=c(e.useRawSource,{dev:n,prod:n})}function h(e){f.call(this,e)}function g(e){var n=this;e.useRawSource[function(e){return"production"===process.env.NODE_ENV||e.coreDevelopment}(e)?"prod":"dev"].map((function(e){return function(e){var t=l("".concat(e,"/package.json")),s=require(t||"");s.module&&n.extendBuild((function(n){n.resolve.alias[s.name+"$"]=l("".concat(e,"/").concat(s.module))})),n.options.build.transpile.push(e),u.info("Using raw source/ESM for ".concat(s.name))}(e)}))}var m={name:"@vue-storefront/nuxt",version:"2.7.1",main:"lib/index.cjs.js",module:"lib/index.es.js",types:"lib/src/index.d.ts",scripts:{build:"rimraf lib && rollup -c",test:'echo "Error: no test specified" && exit 1',prepublish:"yarn build"},author:"Vue Storefront",license:"MIT",dependencies:{"@nuxt/typescript-build":"^2.0.0","@nuxtjs/composition-api":"^0.29.3","@nuxtjs/style-resources":"^1.0.0",chalk:"^2.4.2",chokidar:"^3.3.1",consola:"^2.10.1",lodash:"^4.17.15","nuxt-purgecss":"^1.0.0"},devDependencies:{"@nuxt/types":"^2.15.8","@rollup/plugin-json":"~4.1.0"},publishConfig:{access:"public"},files:["lib/**/*","plugins/**/*"],engines:{node:">=14 <=16"}};function v(t){var s=c({coreDevelopment:!1,i18nExtension:!0,e2e:!0,logger:!0,ssr:!0,context:!0,sfui:!0,performance:{httpPush:!0,purgeCSS:{enabled:!1,paths:["**/*.vue"]}},useRawSource:{dev:[],prod:[]}},t);this.options.head.meta.push({name:"generator",content:"Vue Storefront 2"}),u.info("Starting Vue Storefront Nuxt Module"),s.performance.httpPush&&(this.options.render=c(this.options.render,{http2:{push:!0,pushAssets:function(e,n,t,s){return s.filter((function(e){return"script"===e.asType})).map((function(e){var n=e.file,s=e.asType;return"<".concat(t).concat(n,">; rel=preload; as=").concat(s)}))}}})),s.context&&(this.addPlugin(n.resolve(__dirname,"../plugins/context.js")),u.success("Installed Vue Storefront Context plugin")),s.ssr&&(this.addPlugin(n.resolve(__dirname,"../plugins/ssr.js")),u.success("Installed Vue Storefront SSR plugin")),s.logger&&(this.addPlugin({src:n.resolve(__dirname,"../plugins/logger.js"),options:t.logger||{}}),u.success("Installed VSF Logger plugin")),s.e2e&&(this.addPlugin(n.resolve(__dirname,"../plugins/e2e-testing.js")),u.success("Installed Vue Storefront E2E testing plugin")),s.i18nExtension&&(this.addPlugin({src:n.resolve(__dirname,"../plugins/i18n-cookies.js"),options:this.options.i18n}),u.success("Installed Internationalization Cookies plugin")),e.existsSync(l("@storefront-ui/vue"))&&s.sfui&&(h.call(this,s),u.success("Installed StorefrontUI Module")),d.call(this,s),u.success("Installed Performance Module"),g.call(this,s)}export{v as default,m as meta};
|
|
2
2
|
//# sourceMappingURL=index.es.js.map
|
package/package.json
CHANGED
package/plugins/i18n-cookies.js
CHANGED
|
@@ -7,6 +7,7 @@ const i18nCookiesPlugin = ({ $cookies, i18n, app, redirect }) => {
|
|
|
7
7
|
const acceptedLanguage = app.context.req?.headers?.['accept-language'] || navigator?.languages || '';
|
|
8
8
|
const isRouteValid = !!app.context.route.name;
|
|
9
9
|
const autoRedirectByLocale = i18nOptions.autoRedirectByLocale ?? true;
|
|
10
|
+
const reloadOnLanguageChange = i18nOptions.reloadOnLanguageChange ?? true;
|
|
10
11
|
const cookieNames = {
|
|
11
12
|
currency: i18nOptions.cookies?.currencyCookieName || VSF_CURRENCY_COOKIE,
|
|
12
13
|
country: i18nOptions.cookies?.countryCookieName || VSF_COUNTRY_COOKIE,
|
|
@@ -101,7 +102,9 @@ const i18nCookiesPlugin = ({ $cookies, i18n, app, redirect }) => {
|
|
|
101
102
|
$cookies.set(cookieNames.currency, getCurrencyByLocale(newLocale), cookieOptions);
|
|
102
103
|
}
|
|
103
104
|
|
|
104
|
-
|
|
105
|
+
if (reloadOnLanguageChange) {
|
|
106
|
+
window.location.href = context.route.fullPath;
|
|
107
|
+
}
|
|
105
108
|
}
|
|
106
109
|
}
|
|
107
110
|
|