@bigcommerce/stencil-paper
Advanced tools
Comparing version 3.0.0-rc.1 to 3.0.0-rc.2
# Changelog | ||
## 3.0.0-rc.1 (2018-01-10) | ||
Refactor rendering functionality into paper-handlebars [#130](https://github.com/bigcommerce/paper/pull/130) to | ||
## 3.0.0-rc.2 (2018-01-31) | ||
- Major refactor, moving rendering functionality into paper-handlebars [#130](https://github.com/bigcommerce/paper/pull/130) to | ||
allow for alternate template engines. | ||
- Remove access to siteSettings and themeSettings, use accessors instead [#131](https://github.com/bigcommerce/paper/pull/131) to | ||
v3.0 Contains several breaking changes: | ||
- Removed the direct access of `contentServiceContext` for setting page content. From now on, use `addContent()` and `getContent()`. | ||
- Removed the direct access of `contentServiceContext` for setting page content. From now on, use `setContent()` | ||
and `getContent()`. | ||
- Removed direct access of `siteSettings` and `themeSettings`. From now on, use `getSiteSettings()`, `setSiteSettings()`, | ||
`getThemeSettings()`, and `setThemeSettings()` if you need to get/set these values after calling the constructor. | ||
- Removed `getTemplateProcessor()`. This is an internal concern of `paper-handlebars` and is used by `loadTemplates`. | ||
- Removed `loadTemplatesSync()`. This was only used by helper tests and is no longer needed. | ||
- Removed `handlebars` instance variable. Hopefully nobody is accessing that directly. Any helpers that were accessing it have been updated in `paper-handlebars` to use the global context they are given rather than accessing Paper directly at all. | ||
- Removed `handlebars` instance variable. Hopefully nobody is accessing that directly. Any helpers that were accessing | ||
it have been updated in `paper-handlebars` to use the global context they are given rather than accessing Paper | ||
directly at all. | ||
- The `translator` attribute has been moved to `paper-handlebars` and is no longer accessible directly on Paper. | ||
@@ -16,3 +22,4 @@ - The `decorators` attribute has been moved to `paper-handlebars` and is no longer accessible directly on Paper. | ||
- The `cdnify()` function has been moved into a helper library in `paper-handlebars`. | ||
- The `inject` attribute has been removed. This is storage used by two of the helpers, and the implementation has moved to `paper-handlebars`. | ||
- The `inject` attribute has been removed. This is storage used by two of the helpers, and the implementation has | ||
moved to `paper-handlebars`. | ||
@@ -19,0 +26,0 @@ ## 2.0.7 (2017-10-17) |
109
index.js
@@ -65,5 +65,3 @@ 'use strict'; | ||
constructor(siteSettings, themeSettings, assembler, rendererType) { | ||
this.siteSettings = siteSettings || {}; | ||
this.themeSettings = themeSettings || {}; | ||
this.assembler = assembler || {}; | ||
this._assembler = assembler || {}; | ||
@@ -73,7 +71,7 @@ // Build renderer based on type | ||
case 'handlebars-v4': | ||
this.renderer = new HandlebarsRenderer(this.siteSettings, this.themeSettings, 'v4'); | ||
this.renderer = new HandlebarsRenderer(siteSettings, themeSettings, 'v4'); | ||
break; | ||
case 'handlebars-v3': | ||
default: | ||
this.renderer = new HandlebarsRenderer(this.siteSettings, this.themeSettings, 'v3'); | ||
this.renderer = new HandlebarsRenderer(siteSettings, themeSettings, 'v3'); | ||
break; | ||
@@ -86,2 +84,72 @@ } | ||
/** | ||
* Get the siteSettings object containing global site settings. | ||
* | ||
* @return {object} settings An object containing global site settings. | ||
*/ | ||
getSiteSettings() { | ||
return this.renderer.getSiteSettings(); | ||
}; | ||
/** | ||
* Set the siteSettings object containing global site settings. | ||
* | ||
* @param {object} settings An object containing global site settings. | ||
*/ | ||
setSiteSettings(settings) { | ||
this.renderer.setSiteSettings(settings); | ||
}; | ||
/** | ||
* Get the themeSettings object containing the theme configuration. | ||
* | ||
* @return {object} settings An object containing the theme configuration. | ||
*/ | ||
getThemeSettings() { | ||
return this.renderer.getThemeSettings(); | ||
}; | ||
/** | ||
* Set the themeSettings object containing the theme configuration. | ||
* | ||
* @param {object} settings An object containing the theme configuration. | ||
*/ | ||
setThemeSettings(settings) { | ||
this.renderer.setThemeSettings(settings); | ||
}; | ||
/** | ||
* Reset decorator list. | ||
*/ | ||
resetDecorators() { | ||
this.renderer.resetDecorators(); | ||
}; | ||
/** | ||
* Add a decorator to wrap output during render(). | ||
* | ||
* @param {Function} decorator | ||
*/ | ||
addDecorator(decorator) { | ||
this.renderer.addDecorator(decorator); | ||
}; | ||
/** | ||
* Get page content. | ||
* | ||
* @return {Object} Regions with widgets | ||
*/ | ||
getContent() { | ||
return this.renderer.getContent(); | ||
}; | ||
/** | ||
* Add content to be rendered in the given regions. | ||
* | ||
* @param {Object} Regions with widgets | ||
*/ | ||
setContent(regions) { | ||
this.renderer.setContent(regions); | ||
}; | ||
/** | ||
* Use the assembler to fetch partials/templates, and translations, then load them | ||
@@ -117,3 +185,3 @@ * into the renderer. | ||
loadTemplates(path, callback) { | ||
this.assembler.getTemplates(path, this.preProcessor, (err, templates) => { | ||
this._assembler.getTemplates(path, this.preProcessor, (err, templates) => { | ||
if (err) { | ||
@@ -151,3 +219,3 @@ return callback(err); | ||
// Ask assembler to fetch translations file | ||
this.assembler.getTranslations((err, translations) => { | ||
this._assembler.getTranslations((err, translations) => { | ||
if (err) { | ||
@@ -165,29 +233,2 @@ return callback(err); | ||
/** | ||
* Add a decorator to wrap output during render(). | ||
* | ||
* @param {Function} decorator | ||
*/ | ||
addDecorator(decorator) { | ||
this.renderer.addDecorator(decorator); | ||
}; | ||
/** | ||
* Add content to be rendered in the given regions. | ||
* | ||
* @param {Object} Regions with widgets | ||
*/ | ||
addContent(regions) { | ||
this.renderer.addContent(regions); | ||
}; | ||
/** | ||
* Get page content. | ||
* | ||
* @return {Object} Regions with widgets | ||
*/ | ||
getContent() { | ||
return this.renderer.getContent(); | ||
}; | ||
/** | ||
* Render a string with the given context. | ||
@@ -194,0 +235,0 @@ * |
{ | ||
"name": "@bigcommerce/stencil-paper", | ||
"version": "3.0.0-rc.1", | ||
"version": "3.0.0-rc.2", | ||
"description": "A Stencil plugin to load template files and render pages using backend renderer plugins.", | ||
@@ -26,3 +26,3 @@ "main": "index.js", | ||
"dependencies": { | ||
"@bigcommerce/stencil-paper-handlebars": "~2.0.0", | ||
"@bigcommerce/stencil-paper-handlebars": "^3.0.0", | ||
"accept-language-parser": "~1.4.1", | ||
@@ -29,0 +29,0 @@ "async": "~1.5.2", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
42644
935
0
+ Added@bigcommerce/stencil-paper-handlebars@3.0.3(transitive)
- Removed@bigcommerce/stencil-paper-handlebars@2.0.0(transitive)