Socket
Socket
Sign inDemoInstall

polymer-project-config

Package Overview
Dependencies
Maintainers
1
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

polymer-project-config - npm Package Compare versions

Comparing version 3.9.0 to 3.10.0

3

CHANGELOG.md

@@ -11,2 +11,5 @@ # Change Log

## [3.10.0] - 2018-03-12
* Added new option: `moduleResolution`. Determines algorithm used for resolving module specifiers. Can be 'none' or 'node'.
## [3.9.0] - 2018-02-23

@@ -13,0 +16,0 @@ * Added new options: `npm` and `componentDir`. Setting `npm` automatically sets `componentDir` to "node_modules/", unless explicitly set otherwise.

@@ -7,2 +7,3 @@ import { ProjectBuildOptions } from './builds';

export declare const defaultSourceGlobs: string[];
export declare type ModuleResolutionStrategy = 'none' | 'node';
export interface LintOptions {

@@ -90,2 +91,10 @@ /**

componentDir?: string;
/**
* Algorithm to use for resolving module specifiers in import and export
* statements when rewriting them to be web-compatible. Valid values are:
*
* "none": Disable module specifier rewriting. This is the default.
* "node": Use Node.js resolution to find modules.
*/
moduleResolution?: ModuleResolutionStrategy;
}

@@ -101,2 +110,3 @@ export declare class ProjectConfig {

readonly npm?: boolean;
readonly moduleResolution: ModuleResolutionStrategy;
readonly builds: ProjectBuildOptions[];

@@ -103,0 +113,0 @@ readonly autoBasePath: boolean;

13

lib/index.js

@@ -29,2 +29,3 @@ "use strict";

exports.defaultSourceGlobs = ['src/**/*'];
const moduleResolutionStrategies = new Set(['none', 'node']);
/**

@@ -105,5 +106,9 @@ * Resolve any glob or path from the given path, even if glob

if (this.npm) {
this.componentDir = "node_modules/";
this.componentDir = 'node_modules/';
}
/**
* moduleResolution
*/
this.moduleResolution = options.moduleResolution || 'none';
/**
* root

@@ -303,4 +308,6 @@ */

});
// TODO(fks) 11-14-2016: Validate that files actually exist in the file
// system. Potentially become async function for this.
console.assert(moduleResolutionStrategies.has(this.moduleResolution), `${validateErrorPrefix}: "moduleResolution" must be one of: ` +
`${[...moduleResolutionStrategies].join(', ')}.`);
// TODO(fks) 11-14-2016: Validate that files actually exist in the
// file system. Potentially become async function for this.
if (this.builds) {

@@ -307,0 +314,0 @@ console.assert(Array.isArray(this.builds), `${validateErrorPrefix}: "builds" (${this.builds}) ` +

@@ -37,2 +37,9 @@ {

},
"ModuleResolutionStrategy": {
"enum": [
"node",
"none"
],
"type": "string"
},
"ProjectBuildOptions": {

@@ -258,2 +265,6 @@ "properties": {

},
"moduleResolution": {
"$ref": "#/definitions/ModuleResolutionStrategy",
"description": "Algorithm to use for resolving module specifiers in import and export\nstatements when rewriting them to be web-compatible. Valid values are:\n\n\"none\": Disable module specifier rewriting. This is the default.\n\"node\": Use Node.js resolution to find modules."
},
"npm": {

@@ -260,0 +271,0 @@ "description": "Sets other options' defaults to NPM-appropriate values:\n\n - 'componentDir': 'node_modules/'",

{
"name": "polymer-project-config",
"version": "3.9.0",
"version": "3.10.0",
"description": "reads, validates, and shapes your polymer.json project configuration",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

@@ -31,2 +31,6 @@ /**

export type ModuleResolutionStrategy = 'none'|'node';
const moduleResolutionStrategies =
new Set<ModuleResolutionStrategy>(['none', 'node']);
/**

@@ -190,2 +194,11 @@ * Resolve any glob or path from the given path, even if glob

componentDir?: string;
/**
* Algorithm to use for resolving module specifiers in import and export
* statements when rewriting them to be web-compatible. Valid values are:
*
* "none": Disable module specifier rewriting. This is the default.
* "node": Use Node.js resolution to find modules.
*/
moduleResolution?: ModuleResolutionStrategy;
}

@@ -202,2 +215,3 @@

readonly npm?: boolean;
readonly moduleResolution: ModuleResolutionStrategy;

@@ -296,6 +310,11 @@ readonly builds: ProjectBuildOptions[];

if (this.npm) {
this.componentDir = "node_modules/";
this.componentDir = 'node_modules/';
}
/**
* moduleResolution
*/
this.moduleResolution = options.moduleResolution || 'none';
/**
* root

@@ -449,5 +468,9 @@ */

});
console.assert(
moduleResolutionStrategies.has(this.moduleResolution),
`${validateErrorPrefix}: "moduleResolution" must be one of: ` +
`${[...moduleResolutionStrategies].join(', ')}.`);
// TODO(fks) 11-14-2016: Validate that files actually exist in the file
// system. Potentially become async function for this.
// TODO(fks) 11-14-2016: Validate that files actually exist in the
// file system. Potentially become async function for this.

@@ -454,0 +477,0 @@ if (this.builds) {

@@ -18,7 +18,4 @@ /**

suite('Project Config', () => {
suite('ProjectConfig', () => {
suite('constructor', () => {
test('sets minimum set of defaults when no options are provided', () => {

@@ -41,2 +38,3 @@ const absoluteRoot = process.cwd();

npm: undefined,
moduleResolution: 'none',
});

@@ -65,2 +63,3 @@ });

npm: undefined,
moduleResolution: 'none',
});

@@ -88,2 +87,3 @@ });

npm: undefined,
moduleResolution: 'none',
});

@@ -110,2 +110,3 @@ });

npm: undefined,
moduleResolution: 'none',
});

@@ -138,2 +139,3 @@ });

npm: undefined,
moduleResolution: 'none',
});

@@ -162,2 +164,3 @@ });

npm: undefined,
moduleResolution: 'none',
});

@@ -195,2 +198,3 @@ });

npm: undefined,
moduleResolution: 'none',
});

@@ -231,2 +235,3 @@ });

npm: undefined,
moduleResolution: 'none',
});

@@ -291,6 +296,4 @@ });

test('npm option does not override other explicitly set values', () => {
const config = new ProjectConfig({
npm: true,
componentDir: '../some_other_dir/over_here/'
});
const config = new ProjectConfig(
{npm: true, componentDir: '../some_other_dir/over_here/'});
config.validate();

@@ -301,6 +304,26 @@

});
suite('module resolution', () => {
test('defaults to none', () => {
const config = new ProjectConfig({});
config.validate();
assert.equal(config.moduleResolution, 'none');
});
test('can be set to node', () => {
const config = new ProjectConfig({moduleResolution: 'node'});
config.validate();
assert.equal(config.moduleResolution, 'node');
});
test('cannot be set to something invalid', () => {
const config = new ProjectConfig({moduleResolution: 'magic'});
assert.throws(() => {
config.validate();
});
});
});
});
suite('isFragment()', () => {
test('matches all fragments and does not match other file paths', () => {

@@ -328,7 +351,5 @@ const relativeRoot = 'public';

});
});
suite('isShell()', () => {
test('matches the shell path and does not match other file paths', () => {

@@ -353,7 +374,5 @@ const relativeRoot = 'public';

});
});
suite('isSource()', () => {
test(

@@ -381,7 +400,5 @@ 'matches source file paths and does not match other file paths',

});
});
suite('validate()', () => {
test('returns true for valid configuration', () => {

@@ -546,9 +563,6 @@ const relativeRoot = 'public';

});
});
});
suite('loadOptionsFromFile()', () => {
test('throws an exception for polymer.json with invalid syntax', () => {

@@ -586,7 +600,5 @@ const filepath = path.join(__dirname, 'polymer-invalid-syntax.json');

});
});
suite('loadConfigFromFile()', () => {
test('throws an exception for polymer.json with invalid syntax', () => {

@@ -628,2 +640,3 @@ const filepath = path.join(__dirname, 'polymer-invalid-syntax.json');

npm: undefined,
moduleResolution: 'none',
});

@@ -637,3 +650,2 @@ });

});
});

@@ -644,3 +656,3 @@

try {
ProjectConfig.validateAndCreate({ lint: [] });
ProjectConfig.validateAndCreate({lint: []});
} catch (e) {

@@ -719,8 +731,4 @@ assert.deepEqual(

js: {
minify: {
exclude: [
'js/unminifiable.js',
'js/already-minified.js'
]
},
minify:
{exclude: ['js/unminifiable.js', 'js/already-minified.js']},
compile: {

@@ -738,3 +746,3 @@ exclude: [

warningsToIgnore: ['some-warning'],
filesToIgnore: ["some .* glob"]
filesToIgnore: ['some .* glob']
}

@@ -741,0 +749,0 @@ });

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc