polymer-project-config
Advanced tools
Comparing version 3.3.0 to 3.4.0
@@ -8,5 +8,8 @@ # Change Log | ||
<!-- ## Unreleased --> | ||
## Unreleased | ||
<!-- Add new, unreleased changes here. --> | ||
## [3.4.0] - 2017-06-21 | ||
* Modified the `bundle` property in project build options to support the subset of `polymer-bundler` options which can be serialized in a JSON file. | ||
## [3.3.0] - 2017-06-09 | ||
@@ -13,0 +16,0 @@ * Removed `insertPrefetchLinks` from build presets. See https://github.com/Polymer/polymer-build/issues/239 for details. |
@@ -76,3 +76,19 @@ /** | ||
*/ | ||
bundle?: boolean; | ||
bundle?: boolean | { | ||
/** URLs of files and/or folders that should not be inlined. */ | ||
excludes?: string[]; | ||
/** Inline external CSS file contents into <style> tags. */ | ||
inlineCss?: boolean; | ||
/** Inline external Javascript file contents into <script> tags. */ | ||
inlineScripts?: boolean; | ||
/** Rewrite element attributes inside of templates when inlining html. */ | ||
rewriteUrlsInTemplates?: boolean; | ||
/** Create identity source maps for inline scripts. */ | ||
sourcemaps?: boolean; | ||
/** | ||
* Remove all comments except those tagged '@license', or starting with | ||
* `<!--!` or `<!--#`, when true. | ||
*/ | ||
stripComments?: boolean; | ||
}; | ||
/** Options for processing HTML. */ | ||
@@ -79,0 +95,0 @@ html?: { |
@@ -30,6 +30,6 @@ "use strict"; | ||
/** | ||
* Resolve any glob to the given path, even if glob | ||
* Resolve any glob or path from the given path, even if glob | ||
* is negative (begins with '!'). | ||
*/ | ||
function resolveGlob(fromPath, glob) { | ||
function globResolve(fromPath, glob) { | ||
if (glob.startsWith('!')) { | ||
@@ -44,2 +44,12 @@ const includeGlob = glob.substring(1); | ||
/** | ||
* Returns a relative path for a glob or path, even if glob | ||
* is negative (begins with '!'). | ||
*/ | ||
function globRelative(fromPath, glob) { | ||
if (glob.startsWith('!')) { | ||
return '!' + path.relative(fromPath, glob.substr(1)); | ||
} | ||
return path.relative(fromPath, glob); | ||
} | ||
/** | ||
* Returns a positive glob, even if glob is negative (begins with '!') | ||
@@ -118,3 +128,3 @@ */ | ||
this.extraDependencies = (options.extraDependencies || | ||
[]).map((glob) => resolveGlob(this.root, glob)); | ||
[]).map((glob) => globResolve(this.root, glob)); | ||
/** | ||
@@ -124,3 +134,3 @@ * sources | ||
this.sources = (options.sources || exports.defaultSourceGlobs) | ||
.map((glob) => resolveGlob(this.root, glob)); | ||
.map((glob) => globResolve(this.root, glob)); | ||
this.sources.push(this.entrypoint); | ||
@@ -264,9 +274,14 @@ if (this.shell) { | ||
toJSON() { | ||
const relative = (p) => p ? path.relative(this.root, p) : undefined; | ||
const obj = { | ||
entrypoint: relative(this.entrypoint), | ||
shell: relative(this.shell), | ||
fragments: (this.fragments || []).map(relative), | ||
sources: (this.sources || []).map(relative), | ||
extraDependencies: (this.extraDependencies || []).map(relative), | ||
entrypoint: globRelative(this.root, this.entrypoint), | ||
shell: this.shell ? globRelative(this.root, this.shell) : undefined, | ||
fragments: this.fragments.map((absolutePath) => { | ||
return globRelative(this.root, absolutePath); | ||
}), | ||
sources: this.sources.map((absolutePath) => { | ||
return globRelative(this.root, absolutePath); | ||
}), | ||
extraDependencies: this.extraDependencies.map((absolutePath) => { | ||
return globRelative(this.root, absolutePath); | ||
}), | ||
builds: this.builds, | ||
@@ -273,0 +288,0 @@ lint: this.lint, |
@@ -48,4 +48,40 @@ { | ||
"bundle": { | ||
"description": "By default, fragments are unbundled. This is optimal for HTTP/2-compatible\nservers and clients.\n\nIf the --bundle flag is supplied, all fragments are bundled together to\nreduce the number of file requests. This is optimal for sending to clients\nor serving from servers that are not HTTP/2 compatible.", | ||
"type": "boolean" | ||
"anyOf": [ | ||
{ | ||
"properties": { | ||
"excludes": { | ||
"description": "URLs of files and/or folders that should not be inlined.", | ||
"items": { | ||
"type": "string" | ||
}, | ||
"type": "array" | ||
}, | ||
"inlineCss": { | ||
"description": "Inline external CSS file contents into <style> tags.", | ||
"type": "boolean" | ||
}, | ||
"inlineScripts": { | ||
"description": "Inline external Javascript file contents into <script> tags.", | ||
"type": "boolean" | ||
}, | ||
"rewriteUrlsInTemplates": { | ||
"description": "Rewrite element attributes inside of templates when inlining html.", | ||
"type": "boolean" | ||
}, | ||
"sourcemaps": { | ||
"description": "Create identity source maps for inline scripts.", | ||
"type": "boolean" | ||
}, | ||
"stripComments": { | ||
"description": "Remove all comments except those tagged '@license', or starting with\n`<!--!` or `<!--#`, when true.", | ||
"type": "boolean" | ||
} | ||
}, | ||
"type": "object" | ||
}, | ||
{ | ||
"type": "boolean" | ||
} | ||
], | ||
"description": "By default, fragments are unbundled. This is optimal for HTTP/2-compatible\nservers and clients.\n\nIf the --bundle flag is supplied, all fragments are bundled together to\nreduce the number of file requests. This is optimal for sending to clients\nor serving from servers that are not HTTP/2 compatible." | ||
}, | ||
@@ -52,0 +88,0 @@ "css": { |
{ | ||
"name": "polymer-project-config", | ||
"version": "3.3.0", | ||
"version": "3.4.0", | ||
"description": "reads, validates, and shapes your polymer.json project configuration", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -83,4 +83,26 @@ /** | ||
*/ | ||
bundle?: boolean; | ||
bundle?: boolean|{ | ||
/** URLs of files and/or folders that should not be inlined. */ | ||
excludes?: string[], | ||
/** Inline external CSS file contents into <style> tags. */ | ||
inlineCss?: boolean, | ||
/** Inline external Javascript file contents into <script> tags. */ | ||
inlineScripts?: boolean, | ||
/** Rewrite element attributes inside of templates when inlining html. */ | ||
rewriteUrlsInTemplates?: boolean, | ||
/** Create identity source maps for inline scripts. */ | ||
sourcemaps?: boolean, | ||
/** | ||
* Remove all comments except those tagged '@license', or starting with | ||
* `<!--!` or `<!--#`, when true. | ||
*/ | ||
stripComments?: boolean, | ||
}; | ||
/** Options for processing HTML. */ | ||
@@ -87,0 +109,0 @@ html?: { |
@@ -32,6 +32,6 @@ /** | ||
/** | ||
* Resolve any glob to the given path, even if glob | ||
* Resolve any glob or path from the given path, even if glob | ||
* is negative (begins with '!'). | ||
*/ | ||
function resolveGlob(fromPath: string, glob: string): string { | ||
function globResolve(fromPath: string, glob: string): string { | ||
if (glob.startsWith('!')) { | ||
@@ -46,2 +46,13 @@ const includeGlob = glob.substring(1); | ||
/** | ||
* Returns a relative path for a glob or path, even if glob | ||
* is negative (begins with '!'). | ||
*/ | ||
function globRelative(fromPath: string, glob: string): string { | ||
if (glob.startsWith('!')) { | ||
return '!' + path.relative(fromPath, glob.substr(1)); | ||
} | ||
return path.relative(fromPath, glob); | ||
} | ||
/** | ||
* Returns a positive glob, even if glob is negative (begins with '!') | ||
@@ -239,3 +250,3 @@ */ | ||
this.extraDependencies = (options.extraDependencies || | ||
[]).map((glob) => resolveGlob(this.root, glob)); | ||
[]).map((glob) => globResolve(this.root, glob)); | ||
@@ -246,3 +257,3 @@ /** | ||
this.sources = (options.sources || defaultSourceGlobs) | ||
.map((glob) => resolveGlob(this.root, glob)); | ||
.map((glob) => globResolve(this.root, glob)); | ||
this.sources.push(this.entrypoint); | ||
@@ -374,10 +385,14 @@ if (this.shell) { | ||
toJSON(): string { | ||
const relative = (p: string | null | undefined) => | ||
p ? path.relative(this.root, p) : undefined; | ||
const obj = { | ||
entrypoint: relative(this.entrypoint), | ||
shell: relative(this.shell), | ||
fragments: (this.fragments || []).map(relative), | ||
sources: (this.sources || []).map(relative), | ||
extraDependencies: (this.extraDependencies || []).map(relative), | ||
entrypoint: globRelative(this.root, this.entrypoint), | ||
shell: this.shell ? globRelative(this.root, this.shell) : undefined, | ||
fragments: this.fragments.map((absolutePath) => { | ||
return globRelative(this.root, absolutePath); | ||
}), | ||
sources: this.sources.map((absolutePath) => { | ||
return globRelative(this.root, absolutePath); | ||
}), | ||
extraDependencies: this.extraDependencies.map((absolutePath) => { | ||
return globRelative(this.root, absolutePath); | ||
}), | ||
builds: this.builds, | ||
@@ -384,0 +399,0 @@ lint: this.lint, |
@@ -617,3 +617,3 @@ /** | ||
'src/**/*', | ||
'images/**/*', | ||
'!images/**/*', | ||
'entrypoint.html', | ||
@@ -620,0 +620,0 @@ 'shell.html', |
@@ -13,3 +13,3 @@ { | ||
"src/**/*", | ||
"images/**/*" | ||
"!images/**/*" | ||
], | ||
@@ -16,0 +16,0 @@ "builds": [ |
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
86607
2165