Giter VIP home page Giter VIP logo

qxl.apiviewer's Introduction

Qooxdoo API Viewer

This is the API Viewer package for Qooxdoo, which you can use to generate an API Viewer for your own application.

Online version (qx namespace)

http://api.qooxdoo.org

Adding an API viewer for your own code

$ qx pkg update
$ qx pkg install qooxdoo/qxl.apiviewer
$ qx serve -S

Then open http://localhost:8080. You will see that you now have a new application listed, the "API Viewer", that you can click on the link to run it.

Environment variables

You can control the behavior of the API Viewer via settings in the "environment" map in compile.json:

  "environment": {
    // list of applications to scan
    "qxl.apiviewer.applications": [],
    // name of app for which to create the API Viewer, defaults to first application
    "qxl.apiviewer.applicationName": "",
    // array of classes which should be excluded
    "qxl.apiviewer.exclude": [
      "qx.*",
      "namespace.*" 
    ],
    // array of classes which should be included despite the "exclude" setting
    "qxl.apiviewer.include": [
      "namespace.subnamespace.*"
    ]
  },

Developing API Viewer

Clone this repo and compile it:

$ git clone https://github.com/qooxdoo/qxl.apiviewer
$ cd qxl.apiviewer
$ npm install --no-save --no-package-lock @qooxdoo/framework
$ npx qx serve

qxl.apiviewer's People

Contributors

cboulanger avatar goldim avatar hkollmann avatar johnspackman avatar voger avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

qxl.apiviewer's Issues

Some functions are displayed like constants

The problem was noticed for API page of qx.lang.String. There are two constants: firstLow and firstUp. In source code they are functions and work like functions. This happens probably because @Signature hint is not properly processed by the API documentation generator and the compiler has to support these hints.

apiviewer hangs in some situation, showing the spinning wheel in the main window

e.g when navigating to https://qooxdoo.org/qxl.apiviewer/#qx.ui.core.Widget~clone!method_public
the right region where the information is showing has obviously fully loaded, but remains covered by the grey blocker with the spinning wheel.

This may be due to the errors shown in console like this:

004286 qx.Promise: Unhandled promise rejection: TypeError: e.isPrivate is not a function
    at i.qxl.apiviewer.ui.ClassViewer.prototype.__enableSection() [as __enableSection] (https://qooxdoo.org/qxl.apiviewer/apiviewer/part-0.js:1:2681266)
    at i.qxl.apiviewer.ui.ClassViewer.prototype.showItem() [as showItem] (https://qooxdoo.org/qxl.apiviewer/apiviewer/part-0.js:1:2680528)
    at i.qxl.apiviewer.TabViewController.prototype.showItem() [as showItem] (https://qooxdoo.org/qxl.apiviewer/apiviewer/part-0.js:1:2632169)
    at https://qooxdoo.org/qxl.apiviewer/apiviewer/part-0.js:1:2613676
    at https://qooxdoo.org/qxl.apiviewer/apiviewer/part-0.js:1:2613134
From previous event:
    at T.B [as _captureStackTrace] (https://qooxdoo.org/qxl.apiviewer/apiviewer/part-0.js:1:297757)
    at T._then (https://qooxdoo.org/qxl.apiviewer/apiviewer/part-0.js:1:322696)
    at T.then (https://qooxdoo.org/qxl.apiviewer/apiviewer/part-0.js:1:321029)
    at i.qx.Promise.prototype._callMethod() [as _callMethod] (https://qooxdoo.org/qxl.apiviewer/apiviewer/part-0.js:1:278359)
    at i.qx.Promise.prototype.then() [as then] (https://qooxdoo.org/qxl.apiviewer/apiviewer/part-0.js:1:276590)
    at i.qxl.apiviewer.Controller.prototype.__selectItem() [as __selectItem] (https://qooxdoo.org/qxl.apiviewer/apiviewer/part-0.js:1:2613438)
    at https://qooxdoo.org/qxl.apiviewer/apiviewer/part-0.js:1:2610500

qx.Promise: Unhandled promise rejection: Error: Cannot find a package for q

I get this error in console in both google chrome and firefox when I visit this url
http://www.qooxdoo.org/qxl.apiviewer/#qx.lang.normalize.Array

offcourse the log output has much more lines but I am quoting the part that I think is most relevant.

Native.js:58 019491 qxl.apiviewer.Controller[505-0]: Time to build data tree: 1191ms
Native.js:58 019528 qxl.apiviewer.Controller[505-0]: Time to update tree: 24ms
part-0.js:1 [Violation] 'setTimeout' handler took 1232ms
Native.js:58 020122 qx.Promise: Unhandled promise rejection: Error: Cannot find a package for q
    at Function.getClassByName (http://www.qooxdoo.org/qxl.apiviewer/apiviewer/part-0.js:1:2636440)
    at e.<anonymous> (http://www.qooxdoo.org/qxl.apiviewer/apiviewer/part-0.js:1:2605403)
    at b (http://www.qooxdoo.org/qxl.apiviewer/apiviewer/part-0.js:1:138741)
    at Generator.c._invoke (http://www.qooxdoo.org/qxl.apiviewer/apiviewer/part-0.js:1:138536)
    at Generator.e.(anonymous function) [as next] (http://www.qooxdoo.org/qxl.apiviewer/apiviewer/part-0.js:1:138920)
    at t (http://www.qooxdoo.org/qxl.apiviewer/apiviewer/part-0.js:1:2581797)
    at http://www.qooxdoo.org/qxl.apiviewer/apiviewer/part-0.js:1:2581936
    at new Promise (<anonymous>)
    at http://www.qooxdoo.org/qxl.apiviewer/apiviewer/part-0.js:1:2581734
    at http://www.qooxdoo.org/qxl.apiviewer/apiviewer/part-0.js:1:2606044
    at Array.forEach (http://www.qooxdoo.org/qxl.apiviewer/apiviewer/part-0.js:1:154699)
    at e.__setDocTree (http://www.qooxdoo.org/qxl.apiviewer/apiviewer/part-0.js:1:2605214)
    at http://www.qooxdoo.org/qxl.apiviewer/apiviewer/part-0.js:1:2601813
qx.log.appender.Native.process() @ Native.js:58
qx.log.Logger.__log() @ Logger.js:597
qx.log.Logger.error() @ Logger.js:299
qx.Promise.__onUnhandledRejection() @ Promise.js:915
e @ Function.js:152

apiviewer does not work

I created an empty qx application with the steps described in the documentation:

mkdir myapp
cd myapp
npm init
npm install --save-dev @qooxdoo/framework
npx qx create myapp --type desktop --noninteractive --out=.
npx qx pkg update
npx qx pkg install qooxdoo/qxl.apiviewer
npx qx serve -S

The compiling shows a lot of warnings and errors:

Making applications...
>>> Making the applications...
qx.tool.cli.Application: [36,8] warning: Unresolved use of symbol process.exit
qx.tool.cli.Cli: [253,8] warning: Unresolved use of symbol process.exit
qx.tool.cli.Cli: [283,37] warning: Unresolved use of symbol process.argv
qx.tool.cli.Cli: [285,6] warning: Unresolved use of symbol process.title
qx.tool.cli.Cli: [301,8] warning: Unresolved use of symbol process.chdir
qx.tool.cli.Cli: [649,15] warning: Unresolved use of symbol process.argv.indexOf
qx.tool.cli.Watch: [286,16] warning: Unresolved use of symbol setImmediate
qx.tool.cli.api.AbstractApi: [70,26] warning: Unresolved use of symbol process.cwd
qx.tool.cli.commands.Compile: [681,12] warning: Unresolved use of symbol setImmediate
qx.tool.cli.commands.Es6ify: [100,10] warning: Unresolved use of symbol process.cwd
qx.tool.cli.commands.Es6ify: [113,10] warning: Unresolved use of symbol process.exit
qx.tool.cli.commands.package.List: [450,14] warning: Unresolved use of symbol process.cwd
qx.tool.cli.commands.package.Update: [330,12] warning: Unresolved use of symbol manifest_path
qx.tool.compiler.makers.Maker: [131,29] warning: Unresolved use of symbol process.cwd
qx.tool.compiler.resources.Asset: [81,8] warning: Unresolved use of symbol process.cwd
qx.tool.compiler.resources.ScssConverter: [30,13] warning: Unresolved use of symbol loadSass
qx.tool.compiler.resources.ScssFile: [31,13] warning: Unresolved use of symbol loadSass
qx.tool.config.Utils: [200,34] warning: Unresolved use of symbol __dirname
qx.tool.utils.Website: [37,13] warning: Unresolved use of symbol loadSass
qx.tool.utils.files.Utils: [259,10] warning: Unresolved use of symbol process.platform
Assets required for webfont MaterialIcons are not available in application myapp, consider using @asset to include qx/iconfont/MaterialIcons/materialicons-v126.eot,qx/iconfont/MaterialIcons/materialicons-v126.woff2,qx/iconfont/MaterialIcons/materialicons-v126.woff,qx/iconfont/MaterialIcons/materialicons-v126.ttf
Assets required for webfont MaterialIconsOutlined are not available in application myapp, consider using @asset to include qx/iconfont/MaterialIcons/materialiconsoutlined-v101.eot,qx/iconfont/MaterialIcons/materialiconsoutlined-v101.woff2,qx/iconfont/MaterialIcons/materialiconsoutlined-v101.woff,qx/iconfont/MaterialIcons/materialiconsoutlined-v101.otf
Assets required for webfont MaterialIconsRound are not available in application myapp, consider using @asset to include qx/iconfont/MaterialIcons/materialiconsround-v100.eot,qx/iconfont/MaterialIcons/materialiconsround-v100.woff2,qx/iconfont/MaterialIcons/materialiconsround-v100.woff,qx/iconfont/MaterialIcons/materialiconsround-v100.otf
Assets required for webfont MaterialIconsSharp are not available in application myapp, consider using @asset to include qx/iconfont/MaterialIcons/materialiconssharp-v101.eot,qx/iconfont/MaterialIcons/materialiconssharp-v101.woff2,qx/iconfont/MaterialIcons/materialiconssharp-v101.woff,qx/iconfont/MaterialIcons/materialiconssharp-v101.otf
Assets required for webfont MaterialIconsDuoTone are not available in application myapp, consider using @asset to include qx/iconfont/MaterialIcons/materialiconstwotone-v104.eot,qx/iconfont/MaterialIcons/materialiconstwotone-v104.woff2,qx/iconfont/MaterialIcons/materialiconstwotone-v104.woff,qx/iconfont/MaterialIcons/materialiconstwotone-v104.otf
Writing application myapp
[BABEL] Note: The code generator has deoptimised the styling of /home/tobiasb/develop/tmp/myapp/node_modules/terser/dist/bundle.min.js as it exceeds the max of 500KB.
Unable to browserify - this is probably because a module is being require()'d which is not compatible with Browserify: Cannot find module 'babel-preset-es2015'
Require stack:
- /home/tobiasb/develop/tmp/myapp/node_modules/@babel/core/lib/config/files/plugins.js
- /home/tobiasb/develop/tmp/myapp/node_modules/@babel/core/lib/config/files/index.js
- /home/tobiasb/develop/tmp/myapp/node_modules/@babel/core/lib/index.js
- /home/tobiasb/develop/tmp/myapp/node_modules/@qooxdoo/framework/lib/compiler/index.js
- /home/tobiasb/develop/tmp/myapp/node_modules/@qooxdoo/framework/bin/deploy/qx while parsing file: /home/tobiasb/develop/tmp/myapp/node_modules/replace-in-file/index.js
Unable to browserify - this is probably because a module is being require()'d which is not compatible with Browserify: Line 72: Unexpected token = while parsing file: /home/tobiasb/develop/tmp/myapp/node_modules/@foliojs-fork/fontkit/index.js
DEPRECATED: Using the Qooxdoo v5 style of SASS Compilation; this is backwards compatible but the default will change in v7 to use the new style (see https://git.io/JfTPV for details, and how to disable this warning).
Deprecation Warning on line 120, column 11 of node_modules/@qooxdoo/framework/source/resource/qx/mobile/scss/common/_gradients.scss: 
This operation is parsed as:

    $i + 1

but you may have intended it to mean:

    $i (+1)

Add a space after + to clarify that it's meant to be a binary operation, or wrap
it in parentheses to make it a unary operation. This will be an error in future
versions of Sass.

More info and automated migrator: https://sass-lang.com/d/strict-unary
    ╷
120 │       $i: $i +1;
    │           ^^^^^
    ╵

Writing application apiviewer
[BABEL] Note: The code generator has deoptimised the styling of /home/tobiasb/develop/tmp/myapp/node_modules/terser/dist/bundle.min.js as it exceeds the max of 500KB.
Unable to browserify - this is probably because a module is being require()'d which is not compatible with Browserify: Cannot find module 'babel-preset-es2015'
Require stack:
- /home/tobiasb/develop/tmp/myapp/node_modules/@babel/core/lib/config/files/plugins.js
- /home/tobiasb/develop/tmp/myapp/node_modules/@babel/core/lib/config/files/index.js
- /home/tobiasb/develop/tmp/myapp/node_modules/@babel/core/lib/index.js
- /home/tobiasb/develop/tmp/myapp/node_modules/@qooxdoo/framework/lib/compiler/index.js
- /home/tobiasb/develop/tmp/myapp/node_modules/@qooxdoo/framework/bin/deploy/qx while parsing file: /home/tobiasb/develop/tmp/myapp/node_modules/replace-in-file/index.js
Unable to browserify - this is probably because a module is being require()'d which is not compatible with Browserify: Line 72: Unexpected token = while parsing file: /home/tobiasb/develop/tmp/myapp/node_modules/@foliojs-fork/fontkit/index.js
>>> Compiled 1058 classes in 01m 84.997s
Applications are made
Web server started, please browse to http://localhost:8080

When I open the apiviewer in the browser it does not load, on the browser console I see the error:

index.js:54241 Uncaught TypeError: Cannot read properties of undefined (reading 'forEach')
    at Object.init (index.js:54241:23)
    at index.js:254731:13

Which points to this line: l.parts[l.boot].forEach(function(pkg) {
and l.parts is empty.

Trying to fix that by adding parts to the config.json:

"parts": {
        "boot" : {
          "include": [
            "qx.*"
          ]
        },
        "tool" : {
          "include": [
            "qx.tool.*"
          ]
        }
      }

Just leads to new errors:

Decoration.js:23 Uncaught TypeError: Cannot read properties of undefined (reading 'MDecoration')
    at Decoration.js:23:21
    at Decoration.js:1:58
(anonym) @ Decoration.js:23
(anonym) @ Decoration.js:1
Button.js:49 Uncaught TypeError: Cannot read properties of undefined (reading 'Widget')
    at Button.js:49:21
    at Button.js:1:2
(anonym) @ Button.js:49
(anonym) @ Button.js:1
Class.js:848 Uncaught Error: Invalid key "extend" in class "qxl.apiviewer.ui.PackageTree"! The value is undefined/null!
    at Object._true [as __validateConfig__P_4_2] (Class.js:848:19)
    at Object.__defineImpl__P_4_1 (Class.js:209:16)
    at Object.define (Class.js:163:21)
    at PackageTree.js:29:10
    at PackageTree.js:1:60

The first error is related to the default setting "exclude": [ "qx.test.*",... but qx.theme.simple uses Mixins from qx.test., which is generally a bad idea. The should not exist dependencies from any "real" code to anything in "qx.test".

API generation is confused by interfaces extending multiple interfaces

Suppose you have an interface definition with an array in extend key and one or more properties:

qx.Interface.define("qookery.IFormComponent", {
    extend: [ qookery.IContainerComponent, qookery.IVariableProvider ],
    properties: {
        /** Some documentation */
        icon: { check: "String", nullable: true },
...

Then the generator.py api-verify job cannot correctly create documentation for the interface properties. The error message, which appears multiple times for each property, is

Warning: qookery.IFormComponent: Unknown link target: '#icon'

Add "qxl.apiviewer.include" environment variable

It would be good to have a counterpart to "excludeFromAPIViewer" (which should be renamed to "qxl.apiviewer.exclude", see #36) named "qxl.apiviewer.include" to be able to create an API for a part of a namespace, like so:

{
  "environment": {
    "qxl.apiviewer.exclude" : ["qx.*"],
    "qxl.apiviewer.include" : ["qx.io.*"]
  }
}

Methods arguments not shown in API viewer

Hi,
I just migrated an app from qooxdoo 5.0.2 with generate.py to qooxdoo-compiler with qooxdoo 6.0.0-alpha-20181116-263f2cc9. I've added the qooxdoo/qxl.apiviewer contrib.
When compiling the app, the API viewer works well but method arguments are not shown.
For exemple, the constructor of qx.ui.basic.Label looks like this with generate.py api :
Label(String value)
but with the new api viewer it looks like that :
qx.ui.basic.Label()
When clicking on the + sign on the left of the method signature nothing is shown where it should be Parameters and Overrides sections.
Sylvain

markdown in jsdoc

full support for markdown including source code formatting would be great.

Opening some methods causes error

To reproduce the problem:

  1. Open qx.core.MLogging mixin
  2. Press plus button on debug method
  3. See error in console
index.js:13 Uncaught TypeError: this.getWindow is not a function
    at construct.__P_128_22 (index.js:13:305576)
    at construct.gestureFinish (index.js:13:304238)
    at construct.checkAndFireGesture (index.js:13:302652)
    at construct.<anonymous> (index.js:13:78986)
    at index.js:13:233407
    at Function.true [as then] (index.js:1:1653815)
    at construct._fireEvent (index.js:13:233379)
    at construct._onPointerEvent (index.js:13:229622)
    at HTMLDivElement.<anonymous> (index.js:1:1481969)

Also this error happens with other functions.

Add an option to hide qx.core.MObjectId methods

Since the qx.core.MObjectId API methods are attached to qx.core.Object, they show up everywhere in the API viewer, even though in the rarest of cases people will be looking for the documentation of these methods in the case of the current class. We should maybe add an option that hide them by default (maybe except in qx.core.Object). Most elegantly, but also quite complex in implementation would be to be able to have a dropdown that allowed to hide individual mixins that are present in the class that is currently being displayed.

Support @inheritDoc and fix documentation for methods without jsdoc documentation

The ApiViewer should support the JsDoc @inheritDoc tag and use the documentation of the parent class (see http://usejsdoc.org/tags-inheritdoc.html) or (extending the jsdoc useage), its qx Interface class.

In addition, the current behavior needs to be fixed where methods without documentation will use the closes comment block even though there are empty lines before the method declaration:

Bildschirmfoto 2019-03-09 um 10 12 22

@johnspackman Is that technically possible with the AST? Or do we need to enforce at least a

/**
 * @inheritdoc
 */

before the method?

Events missing for TreeFolder

If you navigate to qx.ui.tree.TreeFolder you will not see any events. If you click on Includes/Inherited you will see some but not all events -- changeOpen is not there. If you unselect Includes/Inherited and trace back in the inheritance hierarchy you will not see any events until you reach qx.ui.core.Widget. In version 5.0.2 of the api viewer you see changeOpen (along with other events) in qx.ui.tree.core.AbstractItem.

API viewer is broken when added to projects

This code will produce an API viewer which crashes during startup:

qx create myFirstApp --noninteractive
cd myFirstApp
qx package install qooxdoo/qxl.apiviewer
qx serve --show-startpage

speed up starting

In the original version where only classes transferred to Client which are needed.
In the current version this filtering is done on the Client side.

Unfortunately this requieres metadata loading for each class which is time cosoumting.
The idea is to do this filtering during compile time so that metadata loading could be done on demand

Add object ids and child control ids to information displayed by the API Viewer

Even though object ids and child controls are part of the API of a library or an application, the API consumer currently needs to read the source code to discover them, unless the developer has explicitly included them in the JSDOC comments (which is prone to obsolescence). It would be great if the API Viewer (based on compiler data) could display this information. Ideally, the compiler could pick it up from the code itself; if that is technically difficult or impossible, we could add compiler hints which are easier to maintain than plain documentation.

HTML markup and code sections in source code docblocks not correctly converted

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.