com.google.javascript.jscomp.gwt.client.JsfileParserMain Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of closure-compiler-linter Show documentation
Show all versions of closure-compiler-linter Show documentation
Closure Compiler is a JavaScript optimizing compiler. It parses your
JavaScript, analyzes it, removes dead code and rewrites and minimizes
what's left. It also checks syntax, variable references, and types, and
warns about common JavaScript pitfalls. It is used in many of Google's
JavaScript apps, including Gmail, Google Web Search, Google Maps, and
Google Docs.
This binary checks for style issues such as incorrect or missing JSDoc
usage, and missing goog.require() statements. It does not do more advanced
checks such as typechecking.
/*
* Copyright 2015 The Closure Compiler Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.javascript.jscomp.gwt.client;
import com.google.common.collect.Multimap;
import com.google.javascript.jscomp.deps.JsFileFullParser;
import elemental2.core.JsArray;
import java.util.Map;
import javax.annotation.Nullable;
import jsinterop.annotations.JsFunction;
import jsinterop.annotations.JsMethod;
import jsinterop.base.JsPropertyMap;
/**
* GWT module to parse files for dependency and {@literal @}{@code fileoverview} annotation
* information.
*/
public class JsfileParserMain {
/**
* Exports the {@link #gjd} method via JSNI.
*
* This will be placed on {@code module.exports.gjd} or the global {@code jscomp.gjd}.
*/
public static native void exportGjd() /*-{
var fn = $entry(@com.google.javascript.jscomp.gwt.client.JsfileParserMain::gjd(*));
if (typeof module !== 'undefined' && module.exports) {
module.exports.gjd = fn;
}
}-*/;
/**
* Method exported to JS to parse a file for dependencies and annotations.
*
*
The result is a JSON object:
*
*
{@code {
* "custom_annotations": {?Array<[string, string]>}, @.*
* "goog": {?bool}, whether 'goog' is implicitly required
* "has_soy_delcalls": {?Array}, @fileoverview @hassoydelcall {.*}
* "has_soy_deltemplates": {?Array}, @fileoverview @hassoydeltemplate {.*}
* "imported_modules": {?Array}, import ... from .*
* "is_config": {?bool}, @fileoverview @config
* "is_externs": {?bool}, @fileoverview @externs
* "load_flags": {?Array<[string, string]>},
* "mod_name": {?Array}, @fileoverview @modName .*, @modName {.*}
* "mods": {?Array}, @fileoverview @mods {.*}
* "provide_goog": {?bool}, @fileoverview @provideGoog
* "provides": {?Array},
* "requires": {?Array}, note: look for goog.* for 'goog'
* "requires_css": {?Array}, @fileoverview @requirecss {.*}
* "testonly": {?bool}, goog.setTestOnly
* "type_requires": {?Array},
* "visibility: {?Array}, @fileoverview @visibility {.*}
* }}
*
* Any trivial values are omitted.
*/
@JsMethod
public static JsPropertyMap