From 998f70769ae9a8b65b5861f1ab3d36b78cc25afa Mon Sep 17 00:00:00 2001 From: twpayne Date: Tue, 26 Mar 2013 15:54:54 -0700 Subject: [PATCH] Updated Exports Files (markdown) --- Exports-Files.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Exports-Files.md b/Exports-Files.md index b0942dc..f4265de 100644 --- a/Exports-Files.md +++ b/Exports-Files.md @@ -1,4 +1,4 @@ -Alongside js files the *src* dir includes "exports files" (e.g. `src/ol/map.exports`). An export file declares symbols and properties that are to be exported when creating builds of the library. For example the `src/ol/map.exports` file includes this: +Alongside js files, the *src* dir includes "exports files" (e.g. `src/ol/map.exports`). An export file declares symbols and properties that are to be exported when creating builds of the library. For example the `src/ol/map.exports` file includes this: ``` @exportClass ol.Map ol.MapOptions @@ -6,21 +6,21 @@ Alongside js files the *src* dir includes "exports files" (e.g. `src/ol/map.expo ``` -This declares that the `ol.Map` symbol, and that the `ol.Map.prototype.addLayer` property, should be *exported*, i.e. made available to lib users. +This declares that the `ol.Map` symbol, and that the `ol.Map.prototype.addLayer` property, should be *exported*, i.e. made available to library's users. Exports files are processed by the `bin/generate-exports` script, using its `--exports` switch. This script receives a list of exports files as its input, and outputs `@exportSymbol` and `@exportProperty` statements. The output of `generate-exports --exports` goes into `build/src/external/src/exports.js`, which is then used as an input file for the `ol.js` build (see `build/ol.json`). Note: the `src/google.exports` file just makes the `goog.require` function be exported as a null function. This is just to be able to execute the examples both with Plovr in raw mode (`?mode=RAW`) – where `goog.require` statements are required – and against the `ol.js` build. -The `src/objectliterals.exports` file is specific. This file declares the config objects and properties for the lib's single-arg constructors. These declarations are done with the `@exportObjectLiteral` and `@exportObjectLiteralProperty` directives. This file is also processed with the `bin/generate-exports` script, but using the `--externs` and `--typedef` switches. +The `src/objectliterals.exports` file is specific. This file declares the config objects and properties for the library's single-argument constructors. These declarations are done with the `@exportObjectLiteral` and `@exportObjectLiteralProperty` directives. This file is also processed with the `bin/generate-exports` script, but using the `--externs` and `--typedef` switches. The `generate-exports --externs` generates Closure externs from the `@exportObjectLiteral` and `@exportObjectLiteralProperty` directives. The `build.py` script places these externs in the `build/src/external/externs/types.js` file, which is used as a regular externs file by the Closure compiler (see `build/ol.json`). The `generate-exports --typedef` command generate typedef's for the object literals declared with `@exportObjectLiteral` and `@exportObjectLiteralProperty`. The `build.py` script places the typedef's in the `build/src/external/src/types.js`, which, like `exports.js`, is used as an input file for the ol.js build (see `build/ol.json`). -Externs define types for config objects created by lib users, while typedef's define types created internally by the lib. +Externs define types for config objects created by library's users, while typedef's define types created internally by the library. -OL3 devs and contributors need to create new exports files when adding new API elements to the lib. They also need to declare single-arg constructors' config objects and properties in `src/objectliterals.exports`. +OL3 devs and contributors need to create new exports files when adding new API elements to the library. They also need to declare single-arg constructors' config objects and properties in `src/objectliterals.exports`. ## Under the hood