This repository has been archived by the owner on Mar 29, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
package-spec.html
574 lines (495 loc) · 20.8 KB
/
package-spec.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<base href="https://addons.mozilla.org/en-US/developers/docs/sdk/1.2.1/" >
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<script type="text/javascript" src="static-files/syntaxhighlighter/scripts/shCore.js"></script>
<script type="text/javascript" src="static-files/syntaxhighlighter/scripts/shBrushCss.js"></script>
<script type="text/javascript" src="static-files/syntaxhighlighter/scripts/shBrushXml.js"></script>
<script type="text/javascript" src="static-files/syntaxhighlighter/scripts/shBrushJScript.js"></script>
<link rel="stylesheet" type="text/css" media="all" href="static-files/css/base.css">
<link rel="stylesheet" type="text/css" media="all" href="static-files/css/header.css">
<link rel="stylesheet" type="text/css" media="all" href="static-files/css/footer.css">
<link rel="stylesheet" type="text/css" media="all" href="static-files/css/sdk-docs.css">
<link rel="stylesheet" type="text/css" media="all" href="static-files/css/api-reference.css">
<link rel="stylesheet" type="text/css" href="static-files/syntaxhighlighter/styles/shCore.css">
<link rel="stylesheet" type="text/css" href="static-files/syntaxhighlighter/styles/shThemeDefault.css">
<!--[if IE]>
<style type="text/css">
.package-summary .module,
.package-entry .module,
.package-detail .module {
display: block;
}
</style>
<![endif]-->
<link rel="shortcut icon" type="image/x-icon" href="static-files/media/favicon.png">
<title>Package Specification - Add-on SDK Documentation</title>
</head>
<body>
<header id="global-header">
<div class="funnel">
<a id="mozilla-tab" href="http://www.mozilla.org/?ref=logo">Mozilla</a>
<div class="menu">
<p>
<a href="https://addons.mozilla.org/en-US/developers/">Back to Developer Hub</a>
</p>
</div>
</header>
<header id="site-header">
<div class="funnel">
<h1>
<a href="dev-guide/welcome.html">Add-on SDK<span></span></a>
</h1>
</div>
</header>
<div id="container">
<div id="columns">
<div id="main-content-column" class="column">
<div id="toc"></div>
<div id="main-content"><h1>Package Specification</h1>
<p>A <em>package</em> is a directory that, at minimum, contains a JSON file
called <code>package.json</code>. This file is also referred to as the
<em>package manifest</em>.</p>
<h2>The Package Manifest</h2>
<p><code>package.json</code> may contain the following keys:</p>
<ul>
<li>
<p><code>name</code> - the name of the package. The package system will only load
one package with a given name. This name cannot contain spaces or periods.
The name defaults to the name of the parent directory. If the package is
ever built as an XPI and the <code>fullName</code> key is not present, this is
used as the add-on's <code>em:name</code> element in its <code>install.rdf</code>.</p>
</li>
<li>
<p><code>fullName</code> - the full name of the package. It can contain spaces. If
the package is ever built as an XPI, this is used as the add-on's
<code>em:name</code> element in its <code>install.rdf</code>.</p>
</li>
<li>
<p><code>description</code> - a String describing the package. If the package is
ever built as an XPI, this is used as the add-on's
<code>em:description</code> element in its <code>install.rdf</code>.</p>
</li>
<li>
<p><code>author</code> - the original author of the package. The author may be a
String including an optional URL in parentheses and optional email
address in angle brackets. If the package is ever built as an XPI,
this is used as the add-on's <code>em:creator</code> element in its
<code>install.rdf</code>.</p>
</li>
<li>
<p><code>contributors</code> - may be an Array of additional author Strings.</p>
</li>
<li>
<p><code>homepage</code> - the URL of the package's website.</p>
</li>
<li>
<p><code>icon</code> - the relative path from the root of the package to a
PNG file containing the icon for the package. By default, this
is <code>icon.png</code>. If the package is built as an XPI, this is used
as the add-on's icon to display in the Add-on Manager's add-ons list.</p>
</li>
<li>
<p><code>icon64</code> - the relative path from the root of the package to a
PNG file containing the icon64 for the package. By default, this
is <code>icon64.png</code>. If the package is built as an XPI, this is used
as the add-on's icon to display in the Addon Manager's add-on details view.</p>
</li>
<li>
<p><code>license</code> - the name of the license as a String, with an optional
URL in parentheses.</p>
</li>
<li>
<p><code>id</code> - a globally unique identifier for the package, a String
derived from the public half of a private/public keypair, generated
the first time you run <code>cfx xpi</code>. When the package is built as an
XPI, this is used as the add-on's <code>em:id</code> element in its
<code>install.rdf</code>.</p>
</li>
<li>
<p><code>version</code> - a String representing the version of the package. If the
package is ever built as an XPI, this is used as the add-on's
<code>em:version</code> element in its <code>install.rdf</code>.</p>
</li>
<li>
<p><code>dependencies</code> - a String or Array of Strings representing package
names that this package requires in order to function properly.</p>
</li>
<li>
<p><code>lib</code> - a String representing the top-level module directory provided in
this package. Defaults to <code>"lib"</code>.</p>
</li>
<li>
<p><code>tests</code> - a String representing the top-level module directory containing
test suites for this package. Defaults to <code>"tests"</code>.</p>
</li>
<li>
<p><code>packages</code> - a String or Array of Strings representing paths to
directories containing additional packages, defaults to
<code>"packages"</code>.</p>
</li>
<li>
<p><code>main</code> - a String representing the name of a program module that is
located in one of the top-level module directories specified by
<code>lib</code>. Defaults to <code>"main"</code>.</p>
</li>
<li>
<p><code>harnessClassID</code> - a String in the GUID format:
<code>xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx</code>, where <code>x</code> represents a single
hexadecimal digit. It is used as a <code>classID</code> (CID) of the "harness service"
XPCOM component. Defaults to a random GUID generated by <code>cfx</code>.</p>
</li>
</ul>
<h2>Documentation</h2>
<p>A package may optionally contain a
<a href="http://daringfireball.net/projects/markdown/">Markdown</a>-formatted file
called <code>README.md</code> in its root directory. Package-browsing tools may display
this file to developers.</p>
<p>Additionally, Markdown files can be placed in an optional <code>docs</code>
directory. When package-browsing tools are asked to show the
documentation for a module, they will look in this directory for a
<code>.md</code> file with the module's name. Thus, for instance, if a user
browses to a module at <code>lib/foo/bar.js</code>, the package-browsing tool
will look for a file at <code>docs/foo/bar.js</code> to represent the module's
API documentation.</p>
<h2>Data Resources</h2>
<p>Packages may optionally contain a directory called <code>data</code> into which
arbitrary files may be placed, such as images or text files. The
URL for these resources may be reached using the
<a href="packages/addon-kit/docs/self.html">self</a> module.</p></div>
</div>
<div id="sidebar" class="column">
<div class="sidebar-section" id="addon-development">
<h2 class="sidebar-section-header"><a href="dev-guide/addon-development/about.html">Developer Guide</a></h2>
<div class="sidebar-section-contents" id="default-section-contents">
<div class="sidebar-subsection">
<h3><a href="dev-guide/addon-development/installation.html">Installation</a></h3>
<div class="divider"></div>
<h3 class="sidebar-subsection-header"><a href="dev-guide/addon-development/tutorials.html">Tutorials</a></h3>
<div class="sidebar-subsection-contents">
<ul>
<li><h4><a href="dev-guide/addon-development/getting-started.html">Getting Started</a></h4>
<ul>
<li><a href="dev-guide/addon-development/implementing-simple-addon.html">A Simple Add-on</a></li>
<li><a href="dev-guide/addon-development/commonjs.html">CommonJS</a></li>
<li><a href="dev-guide/addon-development/implementing-reusable-module.html">Reusable Modules</a></li>
<li><a href="dev-guide/addon-development/troubleshooting.html">Troubleshooting</a></li>
</ul></li>
<li><h4><a href="dev-guide/addon-development/api-intro.html" >Introducing the APIs</a></h4>
<ul>
<li><a href="dev-guide/addon-development/api-idioms.html">Common Idioms</a></li>
<li><a href="dev-guide/addon-development/api-modules.html">API Overview</a></li>
</ul></li>
<li><h4><a href="dev-guide/addon-development/annotator/annotator.html">Annotator: a More Complex Add-on</a></h4>
<ul>
<li><a href="dev-guide/addon-development/annotator/overview.html">Design Overview</a></li>
<li><a href="dev-guide/addon-development/annotator/widget.html">Implementing the Widget</a></li>
<li><a href="dev-guide/addon-development/annotator/creating.html">Creating Annotations</a></li>
<li><a href="dev-guide/addon-development/annotator/storing.html">Storing Annotations</a></li>
<li><a href="dev-guide/addon-development/annotator/displaying.html">Displaying Annotations</a></li>
</ul></li>
</ul>
</div>
</div>
<div class="sidebar-subsection">
<div class="divider"></div>
<h3 class="sidebar-subsection-header"><a href="dev-guide/addon-development/guides.html">Programming Guides</a></h3>
<div class="sidebar-subsection-contents">
<ul>
<li><h4><a href="dev-guide/addon-development/two-types-of-scripts.html">Two Types of Scripts</a></h4></li>
<li><h4><a href="dev-guide/addon-development/events.html">Working with Events</a></h4></li>
<li><h4><a href="dev-guide/addon-development/web-content.html">Content Scripts</a></h4>
<ul>
<li><a href="dev-guide/addon-development/content-scripts/loading.html">Loading Content Scripts</a></li>
<li><a href="dev-guide/addon-development/content-scripts/access.html">Content Script Access</a></li>
<li><a href="dev-guide/addon-development/content-scripts/using-port.html">Using <code>port</code></a></li>
<li><a href="dev-guide/addon-development/content-scripts/using-postmessage.html">Using <code>postMessage</code></a></li>
<li><a href="dev-guide/addon-development/content-scripts/reddit-example.html">Example</a></li>
</ul></li>
<li><h4><a href="dev-guide/addon-development/program-id.html">The Program ID</a></h4></li>
<li><h4><a href="dev-guide/addon-development/module-search.html">Module Search</a></h4></li>
</ul>
</div>
</div>
<div class="sidebar-subsection">
<div class="divider"></div>
<h3 class="sidebar-subsection-header"><a href="dev-guide/addon-development/reference.html">Reference</a></h3>
<div class="sidebar-subsection-contents always-show">
<ul>
<li id="high-level-package-summaries">
<div style="display: block;" class="package-summary">
<h4>
<a href="packages/addon-kit/addon-kit.html">addon-kit</a>
</h4>
<ul class="modules">
<li class="module">
<a href="packages/addon-kit/docs/clipboard.html">clipboard</a>
</li>
<li class="module">
<a href="packages/addon-kit/docs/context-menu.html">context-menu</a>
</li>
<li class="module">
<a href="packages/addon-kit/docs/hotkeys.html">hotkeys</a>
</li>
<li class="module">
<a href="packages/addon-kit/docs/notifications.html">notifications</a>
</li>
<li class="module">
<a href="packages/addon-kit/docs/page-mod.html">page-mod</a>
</li>
<li class="module">
<a href="packages/addon-kit/docs/page-worker.html">page-worker</a>
</li>
<li class="module">
<a href="packages/addon-kit/docs/panel.html">panel</a>
</li>
<li class="module">
<a href="packages/addon-kit/docs/passwords.html">passwords</a>
</li>
<li class="module">
<a href="packages/addon-kit/docs/private-browsing.html">private-browsing</a>
</li>
<li class="module">
<a href="packages/addon-kit/docs/request.html">request</a>
</li>
<li class="module">
<a href="packages/addon-kit/docs/selection.html">selection</a>
</li>
<li class="module">
<a href="packages/addon-kit/docs/self.html">self</a>
</li>
<li class="module">
<a href="packages/addon-kit/docs/simple-storage.html">simple-storage</a>
</li>
<li class="module">
<a href="packages/addon-kit/docs/tabs.html">tabs</a>
</li>
<li class="module">
<a href="packages/addon-kit/docs/timers.html">timers</a>
</li>
<li class="module">
<a href="packages/addon-kit/docs/widget.html">widget</a>
</li>
<li class="module">
<a href="packages/addon-kit/docs/windows.html">windows</a>
</li>
</ul>
</div>
</li>
<li><h4><a href="dev-guide/addon-development/console.html">console</a></h4></li>
<li><h4><a href="dev-guide/addon-development/cfx-tool.html">cfx</a></h4></li>
<li><h4><a href="dev-guide/addon-development/package-spec.html">Package Specification</a></h4></li>
</ul>
</div>
</div>
</div>
</div>
<div class="sidebar-section" id="module-development">
<h2 class="sidebar-section-header"><a href="dev-guide/module-development/about.html">Internals Guide</a></h2>
<div class="sidebar-section-contents">
<div class="sidebar-subsection">
<h3 class="sidebar-subsection-header"><a href="dev-guide/module-development/guides.html">Programming Guides</a></h3>
<div class="sidebar-subsection-contents">
<ul>
<li><h4><a href="dev-guide/module-development/best-practices.html">Low-Level Module Best Practices</a></h4>
<li><h4><a href="dev-guide/module-development/chrome.html">Chrome Authority</a></h4>
<li><h4><a href="dev-guide/module-development/xpi.html">XPI Generation</a></h4>
<li><h4><a href="dev-guide/module-development/e10s.html">Out-of-Process Add-ons</a></h4>
</ul>
</div>
</div>
<div class="sidebar-subsection">
<div class="divider"></div>
<h3 class="sidebar-subsection-header"><a href="dev-guide/module-development/reference.html">Reference</a></h3>
<div class="sidebar-subsection-contents">
<ul>
<li id="low-level-package-summaries">
<div style="display: block;" class="package-summary">
<h4>
<a href="packages/api-utils/api-utils.html">api-utils</a>
</h4>
<ul class="modules">
<li class="module">
<a href="packages/api-utils/docs/api-utils.html">api-utils</a>
</li>
<li class="module">
<a href="packages/api-utils/docs/app-strings.html">app-strings</a>
</li>
<li class="module">
<a href="packages/api-utils/docs/byte-streams.html">byte-streams</a>
</li>
<li class="module">
<a href="packages/api-utils/docs/collection.html">collection</a>
</li>
<li class="module">
<a href="packages/api-utils/docs/content.html">content</a>
</li>
<li class="module">
<a href="packages/api-utils/docs/content/loader.html">content/loader</a>
</li>
<li class="module">
<a href="packages/api-utils/docs/content/symbiont.html">content/symbiont</a>
</li>
<li class="module">
<a href="packages/api-utils/docs/content/worker.html">content/worker</a>
</li>
<li class="module">
<a href="packages/api-utils/docs/cortex.html">cortex</a>
</li>
<li class="module">
<a href="packages/api-utils/docs/cuddlefish.html">cuddlefish</a>
</li>
<li class="module">
<a href="packages/api-utils/docs/e10s.html">e10s</a>
</li>
<li class="module">
<a href="packages/api-utils/docs/errors.html">errors</a>
</li>
<li class="module">
<a href="packages/api-utils/docs/events.html">events</a>
</li>
<li class="module">
<a href="packages/api-utils/docs/file.html">file</a>
</li>
<li class="module">
<a href="packages/api-utils/docs/hidden-frame.html">hidden-frame</a>
</li>
<li class="module">
<a href="packages/api-utils/docs/light-traits.html">light-traits</a>
</li>
<li class="module">
<a href="packages/api-utils/docs/list.html">list</a>
</li>
<li class="module">
<a href="packages/api-utils/docs/match-pattern.html">match-pattern</a>
</li>
<li class="module">
<a href="packages/api-utils/docs/memory.html">memory</a>
</li>
<li class="module">
<a href="packages/api-utils/docs/observer-service.html">observer-service</a>
</li>
<li class="module">
<a href="packages/api-utils/docs/plain-text-console.html">plain-text-console</a>
</li>
<li class="module">
<a href="packages/api-utils/docs/preferences-service.html">preferences-service</a>
</li>
<li class="module">
<a href="packages/api-utils/docs/securable-module.html">securable-module</a>
</li>
<li class="module">
<a href="packages/api-utils/docs/tab-browser.html">tab-browser</a>
</li>
<li class="module">
<a href="packages/api-utils/docs/text-streams.html">text-streams</a>
</li>
<li class="module">
<a href="packages/api-utils/docs/traceback.html">traceback</a>
</li>
<li class="module">
<a href="packages/api-utils/docs/traits.html">traits</a>
</li>
<li class="module">
<a href="packages/api-utils/docs/unit-test.html">unit-test</a>
</li>
<li class="module">
<a href="packages/api-utils/docs/unload.html">unload</a>
</li>
<li class="module">
<a href="packages/api-utils/docs/url.html">url</a>
</li>
<li class="module">
<a href="packages/api-utils/docs/window-utils.html">window-utils</a>
</li>
<li class="module">
<a href="packages/api-utils/docs/xhr.html">xhr</a>
</li>
<li class="module">
<a href="packages/api-utils/docs/xpcom.html">xpcom</a>
</li>
<li class="module">
<a href="packages/api-utils/docs/xul-app.html">xul-app</a>
</li>
</ul>
</div>
<div style="display: block;" class="package-summary">
<h4>
<a href="packages/test-harness/test-harness.html">test-harness</a>
</h4>
<ul class="modules">
<li class="module">
<a href="packages/test-harness/docs/harness.html">harness</a>
</li>
<li class="module">
<a href="packages/test-harness/docs/run-tests.html">run-tests</a>
</li>
</ul>
</div>
<div style="display: block;" class="package-summary">
<h4>
<a href="packages/development-mode/development-mode.html">development-mode</a>
</h4>
<ul class="modules">
<li class="module">
<a href="packages/development-mode/docs/bootstrap.html">bootstrap</a>
</li>
<li class="module">
<a href="packages/development-mode/docs/main.html">main</a>
</li>
</ul>
</div>
</li>
<li><h4><a href="dev-guide/module-development/globals.html">Globals</a></h4></li>
</ul>
</div>
</div>
</div>
</div>
<div class="sidebar-section" id="appendices">
<h3><a href="https://wiki.mozilla.org/Labs/Jetpack/Release_Notes">Release Notes</a></h3>
<div class="divider"></div>
<h3><a href="https://wiki.mozilla.org/Labs/Jetpack">Jetpack Wiki</a></h3>
<div class="divider"></div>
<h3><a href="dev-guide/appendices/glossary.html">Glossary</a></h3>
<div class="divider"></div>
<h3><a href="dev-guide/appendices/credits.html">Credits</a></h3>
</div>
<!--end of sidebar column-->
</div>
<!--end of 'columns'-->
<div class="clearfooter"></div>
</div>
</div>
<div role="contentinfo" id="footer">
<div class="section">
<img alt="" src="static-files/media/footer-logo-med.png" class="footerlogo">
<div id="social-footer">
<ul>
<li>get to know <b>add-ons</b></li>
<li><a href="https://addons.mozilla.org/en-US/firefox/about">About</a></li>
<li><a href="http://blog.mozilla.com/addons">Blog</a></li>
<li class="footer-devhub-link"><a href="https://addons.mozilla.org/en-US/developers/">Developer Hub</a></li>
<li><a href="https://addons.mozilla.org/en-US/firefox/faq">FAQ</a></li>
<li><a href="https://forums.addons.mozilla.org">Forum</a></li>
</ul>
</div>
<div id="copyright">
<p id="footer-links">
<a href="http://mozilla.com/privacy-policy.html">Privacy Policy</a> |
<a href="http://mozilla.com/about/legal.html">Legal Notices</a> |
<a href="http://mozilla.com/legal/fraud-report/index.html">Report Trademark Abuse</a>
| <a href="https://addons.mozilla.org/z/en-US/developers/" class="mobile-link">View Mobile Site</a>
</p>
<p>
Except where otherwise <a href="http://mozilla.com/about/legal.html#site">noted</a>, content on this site is licensed under the <br> <a href="http://creativecommons.org/licenses/by-sa/3.0/"> Creative Commons Attribution Share-Alike License v3.0 </a> or any later version.
</p>
</div>
</div>
</div>
<script type="text/javascript" src="static-files/js/jquery.js"></script>
<script type="text/javascript" src="static-files/js/main.js"></script>
</body>
</html>