Skip to content
This repository has been archived by the owner on Sep 14, 2021. It is now read-only.

Commit

Permalink
Initial move from polymer-cli.
Browse files Browse the repository at this point in the history
Only minimal changes to make tests and lint pass.
  • Loading branch information
justinfagnani committed Jun 10, 2016
1 parent 861ecdc commit 6cff2f3
Show file tree
Hide file tree
Showing 46 changed files with 2,949 additions and 36 deletions.
2 changes: 2 additions & 0 deletions .eslintignore
@@ -0,0 +1,2 @@
test/precache-data/*
test/analyzer-data/*
29 changes: 29 additions & 0 deletions .github/ISSUE_TEMPLATE.md
@@ -0,0 +1,29 @@
<!--
If you are asking a question rather than filing a bug, you'll get better results
using one of these instead:
- Stack Overflow (http://stackoverflow.com/questions/tagged/polymer)
- Polymer Slack Channel (https://bit.ly/polymerslack)
- Mailing List (https://groups.google.com/forum/#!forum/polymer-dev)
-->

<!-- Instructions For Filing a Bug: https://github.com/Polymer/polymer/blob/master/CONTRIBUTING.md#filing-bugs -->

### Description
<!-- Example: Build failure when loading scripts from CDNs -->

### Versions & Environment
<!--
`npm list` will the version of polymer-build
`node --version` will show the version for node
-->
- polymer-build:
- node:
- Operating System:

#### Steps to Reproduce

#### Expected Results
<!-- Example: No error is throw -->

#### Actual Results
<!-- Example: Error is thrown -->
41 changes: 5 additions & 36 deletions .gitignore
@@ -1,37 +1,6 @@
# Logs
logs
*.log
.DS_Store
.vscode
npm-debug.log*

# Runtime data
pids
*.pid
*.seed

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# node-waf configuration
.lock-wscript

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules
jspm_packages

# Optional npm cache directory
.npm

# Optional REPL history
.node_repl_history
node_modules/
lib/
typings/
Empty file added .npmignore
Empty file.
12 changes: 12 additions & 0 deletions .travis.yml
@@ -0,0 +1,12 @@
language: node_js
node_js:
- "6"
- "5"
- "4"
sudo: false
before_script:
- npm install
- npm run init
- npm run build
script:
- npm run test
5 changes: 5 additions & 0 deletions LICENSE
@@ -0,0 +1,5 @@
Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
21 changes: 21 additions & 0 deletions appveyor.yml
@@ -0,0 +1,21 @@
# Test against this version of Node.js
environment:
nodejs_version: "4.4.4"

# Install scripts. (runs after repo cloning)
install:
# Get the latest stable version of Node.js or io.js
- ps: Install-Product node $env:nodejs_version
# install modules
- npm install

# Post-install test scripts.
test_script:
# Output useful info for debugging.
- node --version
- npm --version
# run tests
- npm run test

# Don't actually build.
build: off
4 changes: 4 additions & 0 deletions custom_typings/fs-extra.d.ts
@@ -0,0 +1,4 @@
declare module 'fs-extra' {
export function copySync(source: string, dest: string);
export function readdirSync(path: string): string;
}
127 changes: 127 additions & 0 deletions custom_typings/hydrolysis.d.ts
@@ -0,0 +1,127 @@
declare module 'hydrolysis' {
import {Node} from 'dom5';
interface Options {
filter?: (path: string) => boolean;
}
interface Element {
is: string;
contentHref: string;
desc?: string;
}
interface Behavior {
is: string;
contentHref: string;
desc?: string;
}

/**
* The metadata for all features and elements defined in one document
*/
interface DocumentDescriptor {
/**
* The elements from the document.
*/
// elements: ElementDescriptor[];

/**
* The features from the document
*/
// features: FeatureDescriptor[];

/**
* The behaviors from the document
*/
// behaviors: BehaviorDescriptor[];

href?: string;

imports?: DocumentDescriptor[];

// parsedScript?: estree.Program;

html?: {
script: Node[],
style: Node[],
ast: Node
};
}

/**
* The metadata of an entire HTML document, in promises.
*/
interface AnalyzedDocument {
/**
* The url of the document.
*/
href: string;
/**
* The parsed representation of the doc. Use the `ast` property to get
* the full `parse5` ast.
*/
// htmlLoaded: Promise<ParsedImport>;

/**
* Resolves to the list of this Document's transitive import dependencies.
*/
depsLoaded: Promise<string[]>;

/**
* The direct dependencies of the document.
*/
depHrefs: string[];
/**
* Resolves to the list of this Document's import dependencies
*/
metadataLoaded: Promise<DocumentDescriptor>;
}

export class Analyzer {
static analyze(path: string, options: Options): Promise<Analyzer>;

constructor(attachAST: boolean, loader: Loader);

metadataTree(path: string): Promise<DocumentDescriptor>;
annotate(): void;
elements: Element[];
behaviors: Behavior[];
html: {[path: string]: AnalyzedDocument};
parsedDocuments: {[path: string]: Node};

load(href: string):Promise<AnalyzedDocument>;

_getDependencies(
href: string,
found?: {[url:string]: boolean},
transitive?: boolean)
: Promise<string[]>
}
// }
// declare module 'hydrolysis/loader/resolver' {
export class Deferred<T> {
promise: Promise<T>;
resolve: (val:(T|PromiseLike<T>))=>void;
reject: (err:any)=>void;
}

/**
* An object that knows how to resolve resources.
*/
export interface Resolver {
/**
* Attempt to resolve `deferred` with the contents the specified URL. Returns
* false if the Resolver is unable to resolve the URL.
*/
accept(path:string, deferred:Deferred<string>):boolean;
}

class FSResolver implements Resolver {
constructor(options: any);
accept(path:string, deferred:Deferred<string>):boolean;
}

export class Loader {
resolvers: Resolver[];
addResolver(resolver:Resolver): void;
request(uri:string): Promise<string>;
}
}

0 comments on commit 6cff2f3

Please sign in to comment.