_prepareBundleDocument(bundle) {
        return __awaiter(this, void 0, void 0, function* () {
            if (!bundle.bundle.files.has(bundle.url)) {
                return this._analyzeContents(bundle.url, '');
            }
            const analysis = yield this.analyzer.analyze([bundle.url]);
            const document = analyzer_utils_1.getAnalysisDocument(analysis, bundle.url);
            const ast = clone(document.parsedDocument.ast);
            this._moveOrderedImperativesFromHeadIntoHiddenDiv(ast);
            this._moveUnhiddenHtmlImportsIntoHiddenDiv(ast);
            dom5.removeFakeRootElements(ast);
            return this._analyzeContents(document.url, parse5_1.serialize(ast));
        });
    }
/**
     * Generate a fresh document (ASTNode) to bundle contents into.
     * If we're building a bundle which is based on an existing file, we
     * should load that file and prepare it as the bundle document, otherwise
     * we'll create a clean/empty html document.
     */
Generate a fresh document (ASTNode) to bundle contents into.
If we're building a bundle which is based on an existing file, we
should load that file and prepare it as the bundle document, otherwise
we'll create a clean/empty html document.
Generate a fresh document ( ASTNode ) to bundle contents into . If we ' re building a bundle which is based on an existing file we should load that file and prepare it as the bundle document otherwise we ' ll create a clean / empty html document .
_prepareBundleDocument(bundle) {
        return __awaiter(this, void 0, void 0, function* () {
            if (!bundle.bundle.files.has(bundle.url)) {
                return this._analyzeContents(bundle.url, '');
            }
            const analysis = yield this.analyzer.analyze([bundle.url]);
            const document = analyzer_utils_1.getAnalysisDocument(analysis, bundle.url);
            const ast = clone(document.parsedDocument.ast);
            this._moveOrderedImperativesFromHeadIntoHiddenDiv(ast);
            this._moveUnhiddenHtmlImportsIntoHiddenDiv(ast);
            dom5.removeFakeRootElements(ast);
            return this._analyzeContents(document.url, parse5_1.serialize(ast));
        });
    }
_prepareBundleDocument ( bundle ) { return __awaiter ( this , void 0 , void 0 , function * ( ) { if ( ! bundle . bundle . files . has ( bundle . url ) ) { return this . _analyzeContents ( bundle . url , '' ) ; } const analysis = yield this . analyzer . analyze ( [ bundle . url ] ) ; const document = analyzer_utils_1 . getAnalysisDocument ( analysis , bundle . url ) ; const ast = clone ( document . parsedDocument . ast ) ; this . _moveOrderedImperativesFromHeadIntoHiddenDiv ( ast ) ; this . _moveUnhiddenHtmlImportsIntoHiddenDiv ( ast ) ; dom5 . removeFakeRootElements ( ast ) ; return this . _analyzeContents ( document . url , parse5_1 . serialize ( ast ) ) ; } ) ; }
Generate a fresh document (ASTNode) to bundle contents into.
Generate a fresh document ( ASTNode ) to bundle contents into .