Compare commits
58 Commits
Author | SHA1 | Date | |
---|---|---|---|
495a051f09 | |||
d70c2feedb | |||
d228a9bab3 | |||
7e9efc138c | |||
699f36c95c | |||
c94c64e65f | |||
f9a9a60e6f | |||
c37342d6ee | |||
61babfcc53 | |||
792aea12c4 | |||
e56e77dce0 | |||
0402252029 | |||
f45e890fdd | |||
34c11dd6ae | |||
f189928634 | |||
d92f538129 | |||
f2aa9576ba | |||
96b3c864e4 | |||
830bb54e9f | |||
a578df5184 | |||
4c06425cd2 | |||
ac34432269 | |||
fce53a629a | |||
b234299e6b | |||
d872a39394 | |||
9d010d452c | |||
58e94e6cbd | |||
63e736152b | |||
ad5d7d98c4 | |||
d8c4680e16 | |||
49b6407ce6 | |||
9472a5537a | |||
f4e9b16792 | |||
c261652ce6 | |||
a0224b9870 | |||
ae93f365d5 | |||
93cb83e33e | |||
9fe6f34ba3 | |||
3f60d618ff | |||
39c4244668 | |||
34aa390f2c | |||
0e81b6ca24 | |||
6cd6798609 | |||
be2bb0c6fa | |||
0e43c28c67 | |||
2265014db3 | |||
100da38493 | |||
0b8f8f996d | |||
5d860eed3c | |||
c31728a92b | |||
e5c9e8dbf0 | |||
a2164dc303 | |||
1ff4a2cd6c | |||
c5d51edf57 | |||
526c47a643 | |||
2360566063 | |||
0c8ccce950 | |||
2e8dd202d9 |
8
.gitignore
vendored
Normal file
8
.gitignore
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
out/
|
||||
conf.ini
|
||||
log/
|
||||
reports/
|
||||
.idea/dataSources*
|
||||
doxygendoc/
|
||||
javadoc/
|
||||
TourplanerImages/
|
8
.idea/.gitignore
generated
vendored
Normal file
8
.idea/.gitignore
generated
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# Datasource local storage ignored files
|
||||
/../../../../:\FH_OFFLINE\Tourplaner\.idea/dataSources/
|
||||
/dataSources.local.xml
|
||||
# Editor-based HTTP Client requests
|
||||
/httpRequests/
|
36
.idea/inspectionProfiles/Project_Default.xml
generated
Normal file
36
.idea/inspectionProfiles/Project_Default.xml
generated
Normal file
@ -0,0 +1,36 @@
|
||||
<component name="InspectionProjectProfileManager">
|
||||
<profile version="1.0">
|
||||
<option name="myName" value="Project Default" />
|
||||
<inspection_tool class="JavaDoc" enabled="true" level="WARNING" enabled_by_default="true">
|
||||
<option name="TOP_LEVEL_CLASS_OPTIONS">
|
||||
<value>
|
||||
<option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
|
||||
<option name="REQUIRED_TAGS" value="" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="INNER_CLASS_OPTIONS">
|
||||
<value>
|
||||
<option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
|
||||
<option name="REQUIRED_TAGS" value="" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="METHOD_OPTIONS">
|
||||
<value>
|
||||
<option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
|
||||
<option name="REQUIRED_TAGS" value="@return@param@throws or @exception" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="FIELD_OPTIONS">
|
||||
<value>
|
||||
<option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
|
||||
<option name="REQUIRED_TAGS" value="" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="IGNORE_DEPRECATED" value="false" />
|
||||
<option name="IGNORE_JAVADOC_PERIOD" value="true" />
|
||||
<option name="IGNORE_DUPLICATED_THROWS" value="false" />
|
||||
<option name="IGNORE_POINT_TO_ITSELF" value="false" />
|
||||
<option name="myAdditionalJavadocTags" value="return,return,return,return,return,return,return,return,return" />
|
||||
</inspection_tool>
|
||||
</profile>
|
||||
</component>
|
10
.idea/libraries/com_google_code_gson_gson_2_8_6.xml
generated
Normal file
10
.idea/libraries/com_google_code_gson_gson_2_8_6.xml
generated
Normal file
@ -0,0 +1,10 @@
|
||||
<component name="libraryTable">
|
||||
<library name="com.google.code.gson:gson:2.8.6" type="repository">
|
||||
<properties maven-id="com.google.code.gson:gson:2.8.6" />
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/com/google/code/gson/gson/2.8.6/gson-2.8.6.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</component>
|
9
.idea/libraries/iText_4_2_0_com_itextpdf.xml
generated
Normal file
9
.idea/libraries/iText_4_2_0_com_itextpdf.xml
generated
Normal file
@ -0,0 +1,9 @@
|
||||
<component name="libraryTable">
|
||||
<library name="iText-4.2.0-com.itextpdf">
|
||||
<CLASSES>
|
||||
<root url="jar://$PROJECT_DIR$/lib/iText-4.2.0-com.itextpdf.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</component>
|
11
.idea/libraries/javadoc.xml
generated
Normal file
11
.idea/libraries/javadoc.xml
generated
Normal file
@ -0,0 +1,11 @@
|
||||
<component name="libraryTable">
|
||||
<library name="javadoc">
|
||||
<CLASSES>
|
||||
<root url="jar://$PROJECT_DIR$/javadoc/type-search-index.zip!/" />
|
||||
<root url="jar://$PROJECT_DIR$/javadoc/member-search-index.zip!/" />
|
||||
<root url="jar://$PROJECT_DIR$/javadoc/package-search-index.zip!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</component>
|
17
.idea/libraries/lib.xml
generated
Normal file
17
.idea/libraries/lib.xml
generated
Normal file
@ -0,0 +1,17 @@
|
||||
<component name="libraryTable">
|
||||
<library name="lib">
|
||||
<CLASSES>
|
||||
<root url="jar://$PROJECT_DIR$/lib/javafx-sdk-11.0.2/lib/javafx.fxml.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/lib/javafx-sdk-11.0.2/lib/javafx.swing.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/lib/javafx-sdk-11.0.2/lib/javafx-swt.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/lib/javafx-sdk-11.0.2/lib/javafx.controls.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/lib/javafx-sdk-11.0.2/lib/javafx.graphics.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/lib/javafx-sdk-11.0.2/lib/javafx.web.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/lib/javafx-sdk-11.0.2/lib/javafx.media.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/lib/javafx-sdk-11.0.2/lib/src.zip!/" />
|
||||
<root url="jar://$PROJECT_DIR$/lib/javafx-sdk-11.0.2/lib/javafx.base.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</component>
|
10
.idea/libraries/log4j_log4j_1_2_17.xml
generated
Normal file
10
.idea/libraries/log4j_log4j_1_2_17.xml
generated
Normal file
@ -0,0 +1,10 @@
|
||||
<component name="libraryTable">
|
||||
<library name="log4j:log4j:1.2.17" type="repository">
|
||||
<properties maven-id="log4j:log4j:1.2.17" />
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/log4j/log4j/1.2.17/log4j-1.2.17.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</component>
|
10
.idea/libraries/org_ini4j_ini4j_0_5_4.xml
generated
Normal file
10
.idea/libraries/org_ini4j_ini4j_0_5_4.xml
generated
Normal file
@ -0,0 +1,10 @@
|
||||
<component name="libraryTable">
|
||||
<library name="org.ini4j:ini4j:0.5.4" type="repository">
|
||||
<properties maven-id="org.ini4j:ini4j:0.5.4" />
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/ini4j/ini4j/0.5.4/ini4j-0.5.4.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</component>
|
11
.idea/libraries/org_postgresql_postgresql_42_2_19.xml
generated
Normal file
11
.idea/libraries/org_postgresql_postgresql_42_2_19.xml
generated
Normal file
@ -0,0 +1,11 @@
|
||||
<component name="libraryTable">
|
||||
<library name="org.postgresql:postgresql:42.2.19" type="repository">
|
||||
<properties maven-id="org.postgresql:postgresql:42.2.19" />
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/postgresql/postgresql/42.2.19/postgresql-42.2.19.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/checkerframework/checker-qual/3.5.0/checker-qual-3.5.0.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</component>
|
10
.idea/misc.xml
generated
Normal file
10
.idea/misc.xml
generated
Normal file
@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="JavadocGenerationManager">
|
||||
<option name="OUTPUT_DIRECTORY" value="$PROJECT_DIR$/javadoc" />
|
||||
<option name="OTHER_OPTIONS" value="-encoding utf8 -docencoding utf8 -charset utf8" />
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" project-jdk-name="11" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
</project>
|
8
.idea/modules.xml
generated
Normal file
8
.idea/modules.xml
generated
Normal file
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/tourplaner.iml" filepath="$PROJECT_DIR$/tourplaner.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
8
.idea/sqldialects.xml
generated
Normal file
8
.idea/sqldialects.xml
generated
Normal file
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="SqlDialectMappings">
|
||||
<file url="file://$PROJECT_DIR$/TourplanerTabellen.sql" dialect="PostgreSQL" />
|
||||
<file url="file://$PROJECT_DIR$/src/tourplaner/data/PostgresHelper.java" dialect="GenericSQL" />
|
||||
<file url="PROJECT" dialect="PostgreSQL" />
|
||||
</component>
|
||||
</project>
|
124
.idea/uiDesigner.xml
generated
Normal file
124
.idea/uiDesigner.xml
generated
Normal file
@ -0,0 +1,124 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Palette2">
|
||||
<group name="Swing">
|
||||
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
|
||||
</item>
|
||||
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.png" removable="false" auto-create-binding="false" can-attach-label="true">
|
||||
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
|
||||
<initial-values>
|
||||
<property name="text" value="Button" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="RadioButton" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="CheckBox" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="Label" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||
<preferred-size width="200" height="200" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||
<preferred-size width="200" height="200" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
|
||||
<preferred-size width="-1" height="20" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
|
||||
</item>
|
||||
</group>
|
||||
</component>
|
||||
</project>
|
7
.idea/vcs.xml
generated
Normal file
7
.idea/vcs.xml
generated
Normal file
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="" vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
16
README.md
16
README.md
@ -0,0 +1,16 @@
|
||||
# Tourplaner
|
||||
* JavaDoc: https://dergeorg.at/javadoc
|
||||
* DoxygenDoc: https://dergeorg.at/doxygendoc/html
|
||||
|
||||
# Config
|
||||
* DB informationen müssen in das config.ini.sample unter ```[db]``` eingetragen werden
|
||||
* Datei muss in config.ini umbenannt werden
|
||||
* ```langde.ini``` beinhaltet alle Deutschen Texte der Gui
|
||||
* ```langen.ini``` beinhaltet alle Englischen Texte der Gui
|
||||
* Bei ```[map] -> key``` muss ein API Key zu Mapquest eingegeben werden
|
||||
* Bei ```[report] -> path``` kann der Path eingestellt werden, wo die Reports gespeichert werden
|
||||
* Bei ```[map] -> path``` kann der Path eingestellt werden, wo die Maps gespeichert werden
|
||||
|
||||
# UML
|
||||
```[UML.svg]``` (https://git.dergeorg.at/dergeorg/tourplaner/src/branch/master/UML2021.png)
|
||||

|
@ -5,8 +5,30 @@
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||
</content>
|
||||
<orderEntry type="jdk" jdkName="11" jdkType="JavaSDK" />
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" name="lib" level="project" />
|
||||
<orderEntry type="library" name="org.ini4j:ini4j:0.5.4" level="project" />
|
||||
<orderEntry type="library" name="log4j:log4j:1.2.17" level="project" />
|
||||
<orderEntry type="library" name="org.postgresql:postgresql:42.2.19" level="project" />
|
||||
<orderEntry type="library" name="iText-4.2.0-com.itextpdf" level="project" />
|
||||
<orderEntry type="library" name="org.json:json:20180130" level="project" />
|
||||
<orderEntry type="library" name="com.google.code.gson:gson:2.8.6" level="project" />
|
||||
<orderEntry type="module-library">
|
||||
<library name="JUnit5.4">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/junit/jupiter/junit-jupiter/5.7.1/junit-jupiter-5.7.1.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/junit/jupiter/junit-jupiter-api/5.7.1/junit-jupiter-api-5.7.1.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/apiguardian/apiguardian-api/1.1.0/apiguardian-api-1.1.0.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/opentest4j/opentest4j/1.2.0/opentest4j-1.2.0.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/junit/platform/junit-platform-commons/1.7.1/junit-platform-commons-1.7.1.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/junit/jupiter/junit-jupiter-params/5.7.1/junit-jupiter-params-5.7.1.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/junit/jupiter/junit-jupiter-engine/5.7.1/junit-jupiter-engine-5.7.1.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/junit/platform/junit-platform-engine/1.7.1/junit-platform-engine-1.7.1.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
</component>
|
||||
</module>
|
20
TourplanerTabellen.sql
Normal file
20
TourplanerTabellen.sql
Normal file
@ -0,0 +1,20 @@
|
||||
-- // Tour Tabelle
|
||||
|
||||
create table tour
|
||||
(
|
||||
tourname varchar not null,
|
||||
dauer decimal,
|
||||
mapjson varchar,
|
||||
start varchar,
|
||||
ziel varchar,
|
||||
strecke decimal
|
||||
);
|
||||
|
||||
create unique index tour_tourname_uindex
|
||||
on tour (tourname);
|
||||
|
||||
alter table tour add constraint tour_pk primary key (tourname);
|
||||
|
||||
-- // Log Table
|
||||
|
||||
create table log(tourname varchar constraint log_tour_tourname_fk references tour,id varchar,bemerkung varchar,datum date,strecke decimal,avg decimal,hightmeter decimal,pause decimal,gegangen decimal,dauer decimal, rating varchar);
|
BIN
UML2021.png
Normal file
BIN
UML2021.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 15 MiB |
39
conf.ini.sample
Normal file
39
conf.ini.sample
Normal file
@ -0,0 +1,39 @@
|
||||
[start]
|
||||
message = Tour Planer App gestartet
|
||||
apptitle = Tour Planer
|
||||
logo = logo.png
|
||||
|
||||
[lang]
|
||||
lang = langde
|
||||
|
||||
[settings]
|
||||
openpdf = 1
|
||||
openmap = 0
|
||||
|
||||
[einheiten]
|
||||
zeit = min
|
||||
strecke = km
|
||||
meter = m
|
||||
speed = km/h
|
||||
|
||||
[db]
|
||||
dbname = tourplaner
|
||||
url =
|
||||
port = 5432
|
||||
user =
|
||||
pw =
|
||||
|
||||
[report]
|
||||
path = ./reports/
|
||||
|
||||
[hilfe]
|
||||
gitrepo = https://git.dergeorg.at/dergeorg/tourplaner
|
||||
doxygendoc = https://git.dergeorg.at/dergeorg/tourplaner
|
||||
javadoc = https://git.dergeorg.at/dergeorg/tourplaner
|
||||
|
||||
[map]
|
||||
key =
|
||||
size = 1500,400
|
||||
sizePdf = 600,400
|
||||
path = D:\\TourplanerImages\\
|
||||
file_pre = file:///
|
114
langde.ini
Normal file
114
langde.ini
Normal file
@ -0,0 +1,114 @@
|
||||
;suppress inspection "DuplicateKeyInSection" for whole file
|
||||
;suppress inspection "DuplicateKeyInSection" for whole file
|
||||
[langde]
|
||||
achtung = ACHTUNG
|
||||
openbrowsererror = TourplanerController -> Browser:
|
||||
browserexception = Browser Exception
|
||||
browserexceptionmsg = Error beim öffnen des Browsers
|
||||
suchfeldleer = Suchfeld ist leer!
|
||||
suchtextzuerst = Bitte zuerst den Suchtext in das Suchfeld eingeben!
|
||||
keinetourselected = Keine Tour ausgewählt!
|
||||
tournametitle = Tourname
|
||||
tournameheader = Bitte geben Sie den Namen der Tour an!
|
||||
tournamemsg = Name:
|
||||
namevergebenheader = Name bereits vergeben!
|
||||
namevergebenmsg1 = Der Name '
|
||||
namevergebenmsg2 = ' ist bereits vergeben, bitte verwenden Sie einen andern!
|
||||
startpunkttitle = Tour Startpunkt
|
||||
startpunktheader = Bitte geben Sie den Startpunkt der Tour an!
|
||||
startpunktmsg = Startpunkt:
|
||||
zielpunkttitle = Tour zielpunkt
|
||||
zielpunktheader = Bitte geben Sie den Zielpunkt der Tour an!
|
||||
zielpunktmsg = Zielpunkt:
|
||||
deltournoselect = ViewModel -> DelTour
|
||||
deltournoselectmsg = Bitte wählen Sie zuerst eine Tour aus!
|
||||
exceptionstackheader = Exception stacktrace:
|
||||
keinelogsvorhanden = Fügen Sie erst ein Log hinzu um es anzuzeigen!
|
||||
datum = Datum
|
||||
dauer = Dauer
|
||||
strecke = Strecke
|
||||
streckemsg = Strecke des Logeintrages
|
||||
dauermsg = Dauer des Logeintrages
|
||||
doppelpunkt = :
|
||||
fktnichtimplementiert = Diese Funktion ist noch nicht Implementiert
|
||||
vergessenodernochnichtsoweit = Entweder hat DerGeorg darauf vergessen oder ist noch nicht so weit gekommen um das zu machen!
|
||||
logtournotselectedmsg = Bitte wählen Sie zuerst eine Tour aus, bevor sie einen log Eintrag erstellen!
|
||||
keintextimfeld = Bitte tragen Sie einen Text in das Feld ein!
|
||||
nurzahlen = Bitte geben Sie nur Zahlen an!
|
||||
nurpositivezahlen = Bitte geben Sie nur positive Zahlen an!
|
||||
pause = Pause
|
||||
pausemsg = Dauer der Pause
|
||||
hightmeter = Höhenmeter
|
||||
hightmetermsg = Höhenmeter des Abschnitts
|
||||
bemerkung = Bemerkung
|
||||
bemerkungheader = Bitte geben Sie die Bemerkungen zu diesem Log eintrag ein, kann auch leer bleiben.
|
||||
tourreportvon = Tour Report von ->
|
||||
tourplanervon = Tourplaner by DerGeorg
|
||||
reportkeywords = Tourplaner, Tour, Report
|
||||
tourplaner = Tourplaner"
|
||||
tour = Tour
|
||||
reportvon = Report erstellt von:
|
||||
reportstart = Startpunkt der Tour:
|
||||
reportziel = Zielpunkt der Tour:
|
||||
reportdauercal = Berechnete Dauer der Tour:
|
||||
reportstreckecal = Berechnete Strecke der Tour:
|
||||
logs = Logs
|
||||
countlog = Anzahl der Logeinträge:
|
||||
logvom = Log vom:
|
||||
logdauer = Dauer:
|
||||
logpause = Davon Pause:
|
||||
loggegangen = Davon gegangen:
|
||||
logavg = Berechnete Durchschnittliche Geschwindigkeit:
|
||||
logstrecke = Entfernung:
|
||||
loghight = Höhenmeter:
|
||||
logbemerkung = Bemerkung:
|
||||
|
||||
fkarte = Karte
|
||||
fbeschreibung = Beschreibung
|
||||
fedit = Bearbeiten
|
||||
fname = Tourname
|
||||
fstrecke = Berechnete Strecke
|
||||
fdauer = Berechnete Dauer
|
||||
fziel = Ziel
|
||||
fstart = Start
|
||||
favg = Durchschnittsgeschwindigkeit
|
||||
fbemerkung = Bemerkung
|
||||
fdatum = Datum
|
||||
fdauer = Dauer
|
||||
fgegangen = Davon gegangen
|
||||
fhight = Höhenmeter
|
||||
fpause = Davon Pause
|
||||
fstrecke = Strecke
|
||||
|
||||
keinlogselected = Kein Logeintrag ausgewählt
|
||||
keinlogselectedmsg = Bitte zuerst einen Logeintrag auswählen
|
||||
|
||||
fsuche = Suchen
|
||||
fopenmapsetting = Map automatisch öffnen
|
||||
fopenpdfsetting = Report automatisch öffnen
|
||||
flangenglisch = Englisch
|
||||
flangdeutsch = Deutsch
|
||||
fdatei = Datei
|
||||
fbearbeiten = Bearbeiten
|
||||
foptionen = Optionen
|
||||
fsprache = Sprache auswählen
|
||||
fhilfe = Hilfe
|
||||
freposum = Erstelle Report über alle Touren
|
||||
frepotour = Erstelle Report über aktuelle Tour
|
||||
fbeenden = Beenden
|
||||
fpunkte = ...
|
||||
|
||||
rzeitallerlogs = Gesammte Zeit aller Logs:
|
||||
rstreckeallerlogs = gesammte Strecke aller Logs:
|
||||
rcalzeitallerlogs = Berechnete Zeit aller Logs:
|
||||
calstreckeallerloggs = Berechnete Strecke aller Touren:
|
||||
rdaten = Daten
|
||||
rsummrepo = Zusammengefasster Report
|
||||
|
||||
bewertung = Bewertung
|
||||
bewertungmsg = Bitte die Bewertung zwischen 0 und 5 eingeben
|
||||
bewertungeror = Bitte nur Bewertungen von 0 und 5 eingeben
|
||||
bewertungerror2 = Bitte nur Zahlen zum Bewerten
|
||||
|
||||
copybtn = Kopieren
|
||||
rating = Bewertung
|
115
langen.ini
Normal file
115
langen.ini
Normal file
@ -0,0 +1,115 @@
|
||||
;suppress inspection "DuplicateKeyInSection" for whole file
|
||||
;suppress inspection "DuplicateKeyInSection" for whole file
|
||||
[langen]
|
||||
achtung = ATTENTION
|
||||
openbrowsererror = TourplanerController -> Browser:
|
||||
browserexception = Browser Exception
|
||||
browserexceptionmsg = Error at opening Browser
|
||||
suchfeldleer = Search field is empty!
|
||||
suchtextzuerst = Please enter search term first!
|
||||
keinetourselected = No Tour selected
|
||||
tournametitle = Tour name
|
||||
tournameheader = Please enter a Tourname!
|
||||
tournamemsg = Name:
|
||||
namevergebenheader = Name is already occupied!
|
||||
namevergebenmsg1 = The name '
|
||||
namevergebenmsg2 = ' is already in use!
|
||||
startpunkttitle = Tour start
|
||||
startpunktheader = Please enter the start of the Tour
|
||||
startpunktmsg = Start:
|
||||
zielpunkttitle = Tour destination:
|
||||
zielpunktheader = Please enter the tour destination!
|
||||
zielpunktmsg = Destination:
|
||||
deltournoselect = ViewModel -> DelTour
|
||||
deltournoselectmsg = Please select a tour first!
|
||||
exceptionstackheader = Exception stacktrace:
|
||||
keinelogsvorhanden = First add a Log!
|
||||
datum = Date
|
||||
dauer = Duration
|
||||
strecke = Distance
|
||||
streckemsg = Distance of the log entry
|
||||
dauermsg = Duration of the log entry
|
||||
doppelpunkt = :
|
||||
fktnichtimplementiert = Not implementet jet
|
||||
vergessenodernochnichtsoweit = Not implementet jet
|
||||
logtournotselectedmsg = Please select a tour first!
|
||||
keintextimfeld = Please enter a text!
|
||||
nurzahlen = Only numbers!
|
||||
nurpositivezahlen = Only positiv numbers!
|
||||
pause = Break
|
||||
pausemsg = Duration of the break
|
||||
hightmeter = Vertical meters
|
||||
hightmetermsg = Vertical meters of the etape
|
||||
bemerkung = Comment
|
||||
bemerkungheader = Please enter a Comment, can also be empty!
|
||||
tourreportvon = Tour Report from ->
|
||||
tourplanervon = Tourplaner by DerGeorg
|
||||
reportkeywords = Tourplaner, Tour, Report
|
||||
tourplaner = Tourplaner
|
||||
tour = Tour
|
||||
reportvon = Report created by:
|
||||
reportstart = Start of the tour:
|
||||
reportziel = Destination of the tour:
|
||||
reportdauercal = Calculated duration of the tour:
|
||||
reportstreckecal = Calculated distance of the tour:
|
||||
logs = Logs
|
||||
countlog = Number of log entries:
|
||||
logvom = Log from:
|
||||
logdauer = Duration:
|
||||
logpause = Break from that:
|
||||
loggegangen = Gone away:
|
||||
logavg = Calculated averrage speed:
|
||||
logstrecke = Distance:
|
||||
loghight = Vertical meters:
|
||||
logbemerkung = Comment:
|
||||
|
||||
fkarte = Map
|
||||
fbeschreibung = Description
|
||||
fedit = Edit
|
||||
fname = Tourname
|
||||
fstrecke = Calculated Distance
|
||||
fdauer = Calculated Duration
|
||||
fziel = Destination
|
||||
fstart = Start
|
||||
favg = Average speed
|
||||
fbemerkung = Comment
|
||||
fdatum = Date
|
||||
fdauer = Duration
|
||||
fgegangen = Gone away
|
||||
fhight = Vertical meters
|
||||
fpause = Break from that
|
||||
fstrecke = Distance
|
||||
|
||||
keinlogselected = No log selected
|
||||
keinlogselectedmsg = Please select a log first!
|
||||
|
||||
|
||||
fsuche = Search
|
||||
fopenmapsetting = Open map automatic
|
||||
fopenpdfsetting = Open report automatic
|
||||
flangenglisch = English
|
||||
flangdeutsch = German
|
||||
fdatei = File
|
||||
fbearbeiten = Edit
|
||||
foptionen = Options
|
||||
fsprache = Choose Language
|
||||
fhilfe = Help
|
||||
freposum = Generate summarize-report
|
||||
frepotour = Generate tour-report
|
||||
fbeenden = Quit
|
||||
fpunkte = ...
|
||||
|
||||
rzeitallerlogs = Time of all logs:
|
||||
rstreckeallerlogs = Distance of all logs:
|
||||
rcalzeitallerlogs = Calculated time of all logs:
|
||||
calstreckeallerloggs = Calculated distance of all logs:
|
||||
rdaten = Data
|
||||
rsummrepo = Summary Report
|
||||
|
||||
bewertung = Rating
|
||||
bewertungmsg = Please enter a rating from 0 to 5
|
||||
bewertungeror = Please enter only a rating from 0 to 5
|
||||
bewertungerror2 = Please only enter numbers for rating
|
||||
|
||||
copybtn = Copy
|
||||
rating = Rating
|
BIN
lib/iText-4.2.0-com.itextpdf.jar
Normal file
BIN
lib/iText-4.2.0-com.itextpdf.jar
Normal file
Binary file not shown.
@ -1,6 +1,7 @@
|
||||
## GNU Glib v2.56.1
|
||||
|
||||
### Glib Notice
|
||||
<!--suppress ALL -->
|
||||
<pre>
|
||||
You are receiving a copy of GNU Glib, Version: 2.56.1 in either source or
|
||||
object code in the JavaFX runtime or JavaFX SDK. The terms of the
|
||||
|
@ -1,6 +1,7 @@
|
||||
## GStreamer v1.14.0
|
||||
|
||||
### GStreamer Notice
|
||||
<!--suppress ALL -->
|
||||
<pre>
|
||||
You are receiving a copy of GStreamer, Version: 1.14.0 in either source or
|
||||
object code in the JavaFX runtime or JavaFX SDK. The terms of the
|
||||
|
@ -1,6 +1,7 @@
|
||||
## WebKit Open Source Project: WebKit v606.1
|
||||
|
||||
### WebKit Notice
|
||||
<!--suppress ALL -->
|
||||
<pre>
|
||||
You are receiving a copy of WebKit in either source or
|
||||
object code in the JavaFX runtime or JavaFX SDK. The terms of the
|
||||
|
BIN
logo_sm.png
Normal file
BIN
logo_sm.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.8 KiB |
58
node_modules/.package-lock.json
generated
vendored
Normal file
58
node_modules/.package-lock.json
generated
vendored
Normal file
@ -0,0 +1,58 @@
|
||||
{
|
||||
"name": "tourplaner",
|
||||
"version": "1.0.0",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"node_modules/inherits": {
|
||||
"version": "2.0.4",
|
||||
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
|
||||
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
|
||||
},
|
||||
"node_modules/readable-stream": {
|
||||
"version": "3.6.0",
|
||||
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz",
|
||||
"integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==",
|
||||
"dependencies": {
|
||||
"inherits": "^2.0.3",
|
||||
"string_decoder": "^1.1.1",
|
||||
"util-deprecate": "^1.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 6"
|
||||
}
|
||||
},
|
||||
"node_modules/safe-buffer": {
|
||||
"version": "5.2.1",
|
||||
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
|
||||
"integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==",
|
||||
"funding": [
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/feross"
|
||||
},
|
||||
{
|
||||
"type": "patreon",
|
||||
"url": "https://www.patreon.com/feross"
|
||||
},
|
||||
{
|
||||
"type": "consulting",
|
||||
"url": "https://feross.org/support"
|
||||
}
|
||||
]
|
||||
},
|
||||
"node_modules/string_decoder": {
|
||||
"version": "1.3.0",
|
||||
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz",
|
||||
"integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==",
|
||||
"dependencies": {
|
||||
"safe-buffer": "~5.2.0"
|
||||
}
|
||||
},
|
||||
"node_modules/util-deprecate": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
|
||||
"integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8="
|
||||
}
|
||||
}
|
||||
}
|
20
node_modules/immediate/LICENSE.txt
generated
vendored
Normal file
20
node_modules/immediate/LICENSE.txt
generated
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
Copyright (c) 2012 Barnesandnoble.com, llc, Donavon West, Domenic Denicola, Brian Cavalier
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
93
node_modules/immediate/README.md
generated
vendored
Normal file
93
node_modules/immediate/README.md
generated
vendored
Normal file
@ -0,0 +1,93 @@
|
||||
# immediate [](https://travis-ci.org/calvinmetcalf/immediate)
|
||||
|
||||
```
|
||||
npm install immediate --save
|
||||
```
|
||||
|
||||
then
|
||||
|
||||
```js
|
||||
var immediate = require("immediate");
|
||||
|
||||
immediate(function () {
|
||||
// this will run soon
|
||||
});
|
||||
|
||||
immediate(function (arg1, arg2) {
|
||||
// get your args like in iojs
|
||||
}, thing1, thing2);
|
||||
```
|
||||
|
||||
## Introduction
|
||||
|
||||
**immediate** is a microtask library, decended from [NobleJS's setImmediate](https://github.com/NobleJS/setImmediate), but including ideas from [Cujo's When](https://github.com/cujojs/when) and [RSVP][RSVP].
|
||||
|
||||
immediate takes the tricks from setImmedate and RSVP and combines them with the schedualer inspired (vaugly) by whens.
|
||||
|
||||
Note versions 2.6.5 and earlier were strictly speaking a 'macrotask' library not a microtask one, [see this for the difference](https://github.com/YuzuJS/setImmediate#macrotasks-and-microtasks), if you need a macrotask library, [I got you covered](https://github.com/calvinmetcalf/macrotask).
|
||||
|
||||
Several new features were added in versions 3.1.0 and 3.2.0 to maintain parity with
|
||||
process.nextTick, but the 3.0.x series is still being kept up to date if you just need
|
||||
the small barebones version.
|
||||
|
||||
|
||||
## The Tricks
|
||||
|
||||
### `process.nextTick`
|
||||
|
||||
Note that we check for *actual* Node.js environments, not emulated ones like those produced by browserify or similar.
|
||||
|
||||
### `MutationObserver`
|
||||
|
||||
This is what [RSVP][RSVP] uses, it's very fast, details on [MDN](https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver).
|
||||
|
||||
|
||||
### `MessageChannel`
|
||||
|
||||
Unfortunately, `postMessage` has completely different semantics inside web workers, and so cannot be used there. So we
|
||||
turn to [`MessageChannel`][MessageChannel], which has worse browser support, but does work inside a web worker.
|
||||
|
||||
### `<script> onreadystatechange`
|
||||
|
||||
For our last trick, we pull something out to make things fast in Internet Explorer versions 6 through 8: namely,
|
||||
creating a `<script>` element and firing our calls in its `onreadystatechange` event. This does execute in a future
|
||||
turn of the event loop, and is also faster than `setTimeout(…, 0)`, so hey, why not?
|
||||
|
||||
## Tricks we don't use
|
||||
|
||||
### `setImmediate`
|
||||
We avoid this process.nextTick in node is better suited to our needs and in Internet Explorer 10 there is a broken version of setImmediate we avoid using this.
|
||||
|
||||
|
||||
In Node.js, do
|
||||
|
||||
```
|
||||
npm install immediate
|
||||
```
|
||||
|
||||
then
|
||||
|
||||
```js
|
||||
var immediate = require("immediate");
|
||||
```
|
||||
|
||||
|
||||
## Reference and Reading
|
||||
|
||||
* [Efficient Script Yielding W3C Editor's Draft][spec]
|
||||
* [W3C mailing list post introducing the specification][list-post]
|
||||
* [IE Test Drive demo][ie-demo]
|
||||
* [Introductory blog post by Nicholas C. Zakas][ncz]
|
||||
* I wrote a couple blog pots on this, [part 1][my-blog-1] and [part 2][my-blog-2]
|
||||
|
||||
[RSVP]: https://github.com/tildeio/rsvp.js
|
||||
[spec]: https://dvcs.w3.org/hg/webperf/raw-file/tip/specs/setImmediate/Overview.html
|
||||
[list-post]: http://lists.w3.org/Archives/Public/public-web-perf/2011Jun/0100.html
|
||||
[ie-demo]: http://ie.microsoft.com/testdrive/Performance/setImmediateSorting/Default.html
|
||||
[ncz]: http://www.nczonline.net/blog/2011/09/19/script-yielding-with-setimmediate/
|
||||
[nextTick]: http://nodejs.org/docs/v0.8.16/api/process.html#process_process_nexttick_callback
|
||||
[postMessage]: http://www.whatwg.org/specs/web-apps/current-work/multipage/web-messaging.html#posting-messages
|
||||
[MessageChannel]: http://www.whatwg.org/specs/web-apps/current-work/multipage/web-messaging.html#channel-messaging
|
||||
[cross-browser-demo]: http://calvinmetcalf.github.io/setImmediate-shim-demo
|
||||
[my-blog-1]:http://calvinmetcalf.com/post/61672207151/setimmediate-etc
|
||||
[my-blog-2]:http://calvinmetcalf.com/post/61761231881/javascript-schedulers
|
75
node_modules/immediate/dist/immediate.js
generated
vendored
Normal file
75
node_modules/immediate/dist/immediate.js
generated
vendored
Normal file
@ -0,0 +1,75 @@
|
||||
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.immediate = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){
|
||||
(function (global){
|
||||
'use strict';
|
||||
var Mutation = global.MutationObserver || global.WebKitMutationObserver;
|
||||
|
||||
var scheduleDrain;
|
||||
|
||||
{
|
||||
if (Mutation) {
|
||||
var called = 0;
|
||||
var observer = new Mutation(nextTick);
|
||||
var element = global.document.createTextNode('');
|
||||
observer.observe(element, {
|
||||
characterData: true
|
||||
});
|
||||
scheduleDrain = function () {
|
||||
element.data = (called = ++called % 2);
|
||||
};
|
||||
} else if (!global.setImmediate && typeof global.MessageChannel !== 'undefined') {
|
||||
var channel = new global.MessageChannel();
|
||||
channel.port1.onmessage = nextTick;
|
||||
scheduleDrain = function () {
|
||||
channel.port2.postMessage(0);
|
||||
};
|
||||
} else if ('document' in global && 'onreadystatechange' in global.document.createElement('script')) {
|
||||
scheduleDrain = function () {
|
||||
|
||||
// Create a <script> element; its readystatechange event will be fired asynchronously once it is inserted
|
||||
// into the document. Do so, thus queuing up the task. Remember to clean up once it's been called.
|
||||
var scriptEl = global.document.createElement('script');
|
||||
scriptEl.onreadystatechange = function () {
|
||||
nextTick();
|
||||
|
||||
scriptEl.onreadystatechange = null;
|
||||
scriptEl.parentNode.removeChild(scriptEl);
|
||||
scriptEl = null;
|
||||
};
|
||||
global.document.documentElement.appendChild(scriptEl);
|
||||
};
|
||||
} else {
|
||||
scheduleDrain = function () {
|
||||
setTimeout(nextTick, 0);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
var draining;
|
||||
var queue = [];
|
||||
//named nextTick for less confusing stack traces
|
||||
function nextTick() {
|
||||
draining = true;
|
||||
var i, oldQueue;
|
||||
var len = queue.length;
|
||||
while (len) {
|
||||
oldQueue = queue;
|
||||
queue = [];
|
||||
i = -1;
|
||||
while (++i < len) {
|
||||
oldQueue[i]();
|
||||
}
|
||||
len = queue.length;
|
||||
}
|
||||
draining = false;
|
||||
}
|
||||
|
||||
module.exports = immediate;
|
||||
function immediate(task) {
|
||||
if (queue.push(task) === 1 && !draining) {
|
||||
scheduleDrain();
|
||||
}
|
||||
}
|
||||
|
||||
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
||||
},{}]},{},[1])(1)
|
||||
});
|
1
node_modules/immediate/dist/immediate.min.js
generated
vendored
Normal file
1
node_modules/immediate/dist/immediate.min.js
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var n;n="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,n.immediate=e()}}(function(){return function e(n,t,o){function r(f,u){if(!t[f]){if(!n[f]){var a="function"==typeof require&&require;if(!u&&a)return a(f,!0);if(i)return i(f,!0);var d=new Error("Cannot find module '"+f+"'");throw d.code="MODULE_NOT_FOUND",d}var s=t[f]={exports:{}};n[f][0].call(s.exports,function(e){var t=n[f][1][e];return r(t?t:e)},s,s.exports,e,n,t,o)}return t[f].exports}for(var i="function"==typeof require&&require,f=0;f<o.length;f++)r(o[f]);return r}({1:[function(e,n,t){(function(e){"use strict";function t(){s=!0;for(var e,n,t=c.length;t;){for(n=c,c=[],e=-1;++e<t;)n[e]();t=c.length}s=!1}function o(e){1!==c.push(e)||s||r()}var r,i=e.MutationObserver||e.WebKitMutationObserver;if(i){var f=0,u=new i(t),a=e.document.createTextNode("");u.observe(a,{characterData:!0}),r=function(){a.data=f=++f%2}}else if(e.setImmediate||"undefined"==typeof e.MessageChannel)r="document"in e&&"onreadystatechange"in e.document.createElement("script")?function(){var n=e.document.createElement("script");n.onreadystatechange=function(){t(),n.onreadystatechange=null,n.parentNode.removeChild(n),n=null},e.document.documentElement.appendChild(n)}:function(){setTimeout(t,0)};else{var d=new e.MessageChannel;d.port1.onmessage=t,r=function(){d.port2.postMessage(0)}}var s,c=[];n.exports=o}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}]},{},[1])(1)});
|
69
node_modules/immediate/lib/browser.js
generated
vendored
Normal file
69
node_modules/immediate/lib/browser.js
generated
vendored
Normal file
@ -0,0 +1,69 @@
|
||||
'use strict';
|
||||
var Mutation = global.MutationObserver || global.WebKitMutationObserver;
|
||||
|
||||
var scheduleDrain;
|
||||
|
||||
{
|
||||
if (Mutation) {
|
||||
var called = 0;
|
||||
var observer = new Mutation(nextTick);
|
||||
var element = global.document.createTextNode('');
|
||||
observer.observe(element, {
|
||||
characterData: true
|
||||
});
|
||||
scheduleDrain = function () {
|
||||
element.data = (called = ++called % 2);
|
||||
};
|
||||
} else if (!global.setImmediate && typeof global.MessageChannel !== 'undefined') {
|
||||
var channel = new global.MessageChannel();
|
||||
channel.port1.onmessage = nextTick;
|
||||
scheduleDrain = function () {
|
||||
channel.port2.postMessage(0);
|
||||
};
|
||||
} else if ('document' in global && 'onreadystatechange' in global.document.createElement('script')) {
|
||||
scheduleDrain = function () {
|
||||
|
||||
// Create a <script> element; its readystatechange event will be fired asynchronously once it is inserted
|
||||
// into the document. Do so, thus queuing up the task. Remember to clean up once it's been called.
|
||||
var scriptEl = global.document.createElement('script');
|
||||
scriptEl.onreadystatechange = function () {
|
||||
nextTick();
|
||||
|
||||
scriptEl.onreadystatechange = null;
|
||||
scriptEl.parentNode.removeChild(scriptEl);
|
||||
scriptEl = null;
|
||||
};
|
||||
global.document.documentElement.appendChild(scriptEl);
|
||||
};
|
||||
} else {
|
||||
scheduleDrain = function () {
|
||||
setTimeout(nextTick, 0);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
var draining;
|
||||
var queue = [];
|
||||
//named nextTick for less confusing stack traces
|
||||
function nextTick() {
|
||||
draining = true;
|
||||
var i, oldQueue;
|
||||
var len = queue.length;
|
||||
while (len) {
|
||||
oldQueue = queue;
|
||||
queue = [];
|
||||
i = -1;
|
||||
while (++i < len) {
|
||||
oldQueue[i]();
|
||||
}
|
||||
len = queue.length;
|
||||
}
|
||||
draining = false;
|
||||
}
|
||||
|
||||
module.exports = immediate;
|
||||
function immediate(task) {
|
||||
if (queue.push(task) === 1 && !draining) {
|
||||
scheduleDrain();
|
||||
}
|
||||
}
|
73
node_modules/immediate/lib/index.js
generated
vendored
Normal file
73
node_modules/immediate/lib/index.js
generated
vendored
Normal file
@ -0,0 +1,73 @@
|
||||
'use strict';
|
||||
var Mutation = global.MutationObserver || global.WebKitMutationObserver;
|
||||
|
||||
var scheduleDrain;
|
||||
|
||||
if (process.browser) {
|
||||
if (Mutation) {
|
||||
var called = 0;
|
||||
var observer = new Mutation(nextTick);
|
||||
var element = global.document.createTextNode('');
|
||||
observer.observe(element, {
|
||||
characterData: true
|
||||
});
|
||||
scheduleDrain = function () {
|
||||
element.data = (called = ++called % 2);
|
||||
};
|
||||
} else if (!global.setImmediate && typeof global.MessageChannel !== 'undefined') {
|
||||
var channel = new global.MessageChannel();
|
||||
channel.port1.onmessage = nextTick;
|
||||
scheduleDrain = function () {
|
||||
channel.port2.postMessage(0);
|
||||
};
|
||||
} else if ('document' in global && 'onreadystatechange' in global.document.createElement('script')) {
|
||||
scheduleDrain = function () {
|
||||
|
||||
// Create a <script> element; its readystatechange event will be fired asynchronously once it is inserted
|
||||
// into the document. Do so, thus queuing up the task. Remember to clean up once it's been called.
|
||||
var scriptEl = global.document.createElement('script');
|
||||
scriptEl.onreadystatechange = function () {
|
||||
nextTick();
|
||||
|
||||
scriptEl.onreadystatechange = null;
|
||||
scriptEl.parentNode.removeChild(scriptEl);
|
||||
scriptEl = null;
|
||||
};
|
||||
global.document.documentElement.appendChild(scriptEl);
|
||||
};
|
||||
} else {
|
||||
scheduleDrain = function () {
|
||||
setTimeout(nextTick, 0);
|
||||
};
|
||||
}
|
||||
} else {
|
||||
scheduleDrain = function () {
|
||||
process.nextTick(nextTick);
|
||||
};
|
||||
}
|
||||
|
||||
var draining;
|
||||
var queue = [];
|
||||
//named nextTick for less confusing stack traces
|
||||
function nextTick() {
|
||||
draining = true;
|
||||
var i, oldQueue;
|
||||
var len = queue.length;
|
||||
while (len) {
|
||||
oldQueue = queue;
|
||||
queue = [];
|
||||
i = -1;
|
||||
while (++i < len) {
|
||||
oldQueue[i]();
|
||||
}
|
||||
len = queue.length;
|
||||
}
|
||||
draining = false;
|
||||
}
|
||||
|
||||
module.exports = immediate;
|
||||
function immediate(task) {
|
||||
if (queue.push(task) === 1 && !draining) {
|
||||
scheduleDrain();
|
||||
}
|
||||
}
|
42
node_modules/immediate/package.json
generated
vendored
Normal file
42
node_modules/immediate/package.json
generated
vendored
Normal file
@ -0,0 +1,42 @@
|
||||
{
|
||||
"name": "immediate",
|
||||
"version": "3.0.6",
|
||||
"description": "A cross browser microtask library",
|
||||
"contributors": [
|
||||
"Domenic Denicola <domenic@domenicdenicola.com> (http://domenicdenicola.com)",
|
||||
"Donavon West <github@donavon.com> (http://donavon.com)",
|
||||
"Yaffle",
|
||||
"Calvin Metcalf <calvin.metcalf@gmail.com>"
|
||||
],
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/calvinmetcalf/immediate.git"
|
||||
},
|
||||
"files": [
|
||||
"lib",
|
||||
"dist"
|
||||
],
|
||||
"bugs": "https://github.com/calvinmetcalf/immediate/issues",
|
||||
"main": "lib/index.js",
|
||||
"scripts": {
|
||||
"build": "npm run build-node && npm run build-js && npm run uglify",
|
||||
"build-node": "browserify-transform-cli inline-process-browser unreachable-branch-transform < ./lib/index.js > ./lib/browser.js",
|
||||
"uglify": "uglifyjs dist/immediate.js -mc > dist/immediate.min.js",
|
||||
"build-js": "browserify -s immediate ./lib/browser.js | derequire > dist/immediate.js",
|
||||
"test": "jshint lib/*.js && node test/tests.js"
|
||||
},
|
||||
"browser": {
|
||||
"./lib/index.js": "./lib/browser.js"
|
||||
},
|
||||
"devDependencies": {
|
||||
"browserify": "^13.0.0",
|
||||
"browserify-transform-cli": "^1.1.1",
|
||||
"derequire": "^2.0.0",
|
||||
"inline-process-browser": "^2.0.0",
|
||||
"jshint": "^2.5.1",
|
||||
"tape": "^4.0.0",
|
||||
"uglify-js": "^2.4.13",
|
||||
"unreachable-branch-transform": "^0.5.1"
|
||||
}
|
||||
}
|
16
node_modules/inherits/LICENSE
generated
vendored
Normal file
16
node_modules/inherits/LICENSE
generated
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
The ISC License
|
||||
|
||||
Copyright (c) Isaac Z. Schlueter
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
PERFORMANCE OF THIS SOFTWARE.
|
||||
|
42
node_modules/inherits/README.md
generated
vendored
Normal file
42
node_modules/inherits/README.md
generated
vendored
Normal file
@ -0,0 +1,42 @@
|
||||
Browser-friendly inheritance fully compatible with standard node.js
|
||||
[inherits](http://nodejs.org/api/util.html#util_util_inherits_constructor_superconstructor).
|
||||
|
||||
This package exports standard `inherits` from node.js `util` module in
|
||||
node environment, but also provides alternative browser-friendly
|
||||
implementation through [browser
|
||||
field](https://gist.github.com/shtylman/4339901). Alternative
|
||||
implementation is a literal copy of standard one located in standalone
|
||||
module to avoid requiring of `util`. It also has a shim for old
|
||||
browsers with no `Object.create` support.
|
||||
|
||||
While keeping you sure you are using standard `inherits`
|
||||
implementation in node.js environment, it allows bundlers such as
|
||||
[browserify](https://github.com/substack/node-browserify) to not
|
||||
include full `util` package to your client code if all you need is
|
||||
just `inherits` function. It worth, because browser shim for `util`
|
||||
package is large and `inherits` is often the single function you need
|
||||
from it.
|
||||
|
||||
It's recommended to use this package instead of
|
||||
`require('util').inherits` for any code that has chances to be used
|
||||
not only in node.js but in browser too.
|
||||
|
||||
## usage
|
||||
|
||||
```js
|
||||
var inherits = require('inherits');
|
||||
// then use exactly as the standard one
|
||||
```
|
||||
|
||||
## note on version ~1.0
|
||||
|
||||
Version ~1.0 had completely different motivation and is not compatible
|
||||
neither with 2.0 nor with standard node.js `inherits`.
|
||||
|
||||
If you are using version ~1.0 and planning to switch to ~2.0, be
|
||||
careful:
|
||||
|
||||
* new version uses `super_` instead of `super` for referencing
|
||||
superclass
|
||||
* new version overwrites current prototype while old one preserves any
|
||||
existing fields on it
|
9
node_modules/inherits/inherits.js
generated
vendored
Normal file
9
node_modules/inherits/inherits.js
generated
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
try {
|
||||
var util = require('util');
|
||||
/* istanbul ignore next */
|
||||
if (typeof util.inherits !== 'function') throw '';
|
||||
module.exports = util.inherits;
|
||||
} catch (e) {
|
||||
/* istanbul ignore next */
|
||||
module.exports = require('./inherits_browser.js');
|
||||
}
|
27
node_modules/inherits/inherits_browser.js
generated
vendored
Normal file
27
node_modules/inherits/inherits_browser.js
generated
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
if (typeof Object.create === 'function') {
|
||||
// implementation from standard node.js 'util' module
|
||||
module.exports = function inherits(ctor, superCtor) {
|
||||
if (superCtor) {
|
||||
ctor.super_ = superCtor
|
||||
ctor.prototype = Object.create(superCtor.prototype, {
|
||||
constructor: {
|
||||
value: ctor,
|
||||
enumerable: false,
|
||||
writable: true,
|
||||
configurable: true
|
||||
}
|
||||
})
|
||||
}
|
||||
};
|
||||
} else {
|
||||
// old school shim for old browsers
|
||||
module.exports = function inherits(ctor, superCtor) {
|
||||
if (superCtor) {
|
||||
ctor.super_ = superCtor
|
||||
var TempCtor = function () {}
|
||||
TempCtor.prototype = superCtor.prototype
|
||||
ctor.prototype = new TempCtor()
|
||||
ctor.prototype.constructor = ctor
|
||||
}
|
||||
}
|
||||
}
|
29
node_modules/inherits/package.json
generated
vendored
Normal file
29
node_modules/inherits/package.json
generated
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
{
|
||||
"name": "inherits",
|
||||
"description": "Browser-friendly inheritance fully compatible with standard node.js inherits()",
|
||||
"version": "2.0.4",
|
||||
"keywords": [
|
||||
"inheritance",
|
||||
"class",
|
||||
"klass",
|
||||
"oop",
|
||||
"object-oriented",
|
||||
"inherits",
|
||||
"browser",
|
||||
"browserify"
|
||||
],
|
||||
"main": "./inherits.js",
|
||||
"browser": "./inherits_browser.js",
|
||||
"repository": "git://github.com/isaacs/inherits",
|
||||
"license": "ISC",
|
||||
"scripts": {
|
||||
"test": "tap"
|
||||
},
|
||||
"devDependencies": {
|
||||
"tap": "^14.2.4"
|
||||
},
|
||||
"files": [
|
||||
"inherits.js",
|
||||
"inherits_browser.js"
|
||||
]
|
||||
}
|
62
node_modules/lie/README.md
generated
vendored
Normal file
62
node_modules/lie/README.md
generated
vendored
Normal file
@ -0,0 +1,62 @@
|
||||
# lie
|
||||
<a href="http://promises-aplus.github.com/promises-spec">
|
||||
<img src="http://promises-aplus.github.com/promises-spec/assets/logo-small.png"
|
||||
alt="Promises/A+ logo" title="Promises/A+ 1.1 compliant" align="right" />
|
||||
</a> [](https://travis-ci.org/calvinmetcalf/lie)
|
||||
|
||||
lie is a small, performant promise library implementing the [Promises/A+ spec](http://promises-aplus.github.com/promises-spec/) (Version 1.1).
|
||||
|
||||
Originally a fork of [Ruben Verborgh](https://github.com/RubenVerborgh)'s [promiscuous](https://github.com/RubenVerborgh/promiscuous), with version 2.6 it became a fork of [ayepromise](https://github.com/cburgmer/ayepromise) by [Chris Burgmer](https://github.com/cburgmer).
|
||||
|
||||
```bash
|
||||
npm install lie
|
||||
|
||||
```
|
||||
|
||||
```javascript
|
||||
var Promise = require('lie');
|
||||
// or use the pollyfill
|
||||
require('lie/polyfill');
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
Either use it with [browserify](http://browserify.org/) (recommended) or grab one of the files from the dist folder:
|
||||
|
||||
- lie.js/lie.min.js exposes 'Promise' either as a UMD module or from the global scope, depending on if a CJS or AMD loader is available.
|
||||
- lie.polyfill.js/lie.polyfill.min.js adds 'Promise' to the global scope only if it's not already defined (not a UMD).
|
||||
|
||||
## API
|
||||
|
||||
Implements the standard ES6 api:
|
||||
|
||||
```js
|
||||
new Promise(function(resolve, reject){
|
||||
doSomething(function(err, result) {
|
||||
if (err) {
|
||||
reject(err);
|
||||
} else {
|
||||
resolve(result);
|
||||
}
|
||||
});
|
||||
}).then(function (value) {
|
||||
//on success
|
||||
}, function (reason) {
|
||||
//on error
|
||||
}).catch(function (reason) {
|
||||
//shortcut for error handling
|
||||
});
|
||||
|
||||
Promise.all([
|
||||
//array of promises or values
|
||||
]).then(function ([/* array of results */]));
|
||||
|
||||
Promise.race([
|
||||
//array of promises or values
|
||||
]);
|
||||
// either resolves or rejects depending on the first value to do so
|
||||
```
|
||||
|
||||
## Unhandled Rejections
|
||||
|
||||
In Node.js, lie emits an `unhandledRejection` event when a rejected promise isn't caught, in line with [how io.js does it](https://iojs.org/api/process.html#process_event_unhandledrejection). This allows it to act as a promise shim in both Node.js and the browser.
|
350
node_modules/lie/dist/lie.js
generated
vendored
Normal file
350
node_modules/lie/dist/lie.js
generated
vendored
Normal file
@ -0,0 +1,350 @@
|
||||
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.Promise = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){
|
||||
(function (global){
|
||||
'use strict';
|
||||
var Mutation = global.MutationObserver || global.WebKitMutationObserver;
|
||||
|
||||
var scheduleDrain;
|
||||
|
||||
{
|
||||
if (Mutation) {
|
||||
var called = 0;
|
||||
var observer = new Mutation(nextTick);
|
||||
var element = global.document.createTextNode('');
|
||||
observer.observe(element, {
|
||||
characterData: true
|
||||
});
|
||||
scheduleDrain = function () {
|
||||
element.data = (called = ++called % 2);
|
||||
};
|
||||
} else if (!global.setImmediate && typeof global.MessageChannel !== 'undefined') {
|
||||
var channel = new global.MessageChannel();
|
||||
channel.port1.onmessage = nextTick;
|
||||
scheduleDrain = function () {
|
||||
channel.port2.postMessage(0);
|
||||
};
|
||||
} else if ('document' in global && 'onreadystatechange' in global.document.createElement('script')) {
|
||||
scheduleDrain = function () {
|
||||
|
||||
// Create a <script> element; its readystatechange event will be fired asynchronously once it is inserted
|
||||
// into the document. Do so, thus queuing up the task. Remember to clean up once it's been called.
|
||||
var scriptEl = global.document.createElement('script');
|
||||
scriptEl.onreadystatechange = function () {
|
||||
nextTick();
|
||||
|
||||
scriptEl.onreadystatechange = null;
|
||||
scriptEl.parentNode.removeChild(scriptEl);
|
||||
scriptEl = null;
|
||||
};
|
||||
global.document.documentElement.appendChild(scriptEl);
|
||||
};
|
||||
} else {
|
||||
scheduleDrain = function () {
|
||||
setTimeout(nextTick, 0);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
var draining;
|
||||
var queue = [];
|
||||
//named nextTick for less confusing stack traces
|
||||
function nextTick() {
|
||||
draining = true;
|
||||
var i, oldQueue;
|
||||
var len = queue.length;
|
||||
while (len) {
|
||||
oldQueue = queue;
|
||||
queue = [];
|
||||
i = -1;
|
||||
while (++i < len) {
|
||||
oldQueue[i]();
|
||||
}
|
||||
len = queue.length;
|
||||
}
|
||||
draining = false;
|
||||
}
|
||||
|
||||
module.exports = immediate;
|
||||
function immediate(task) {
|
||||
if (queue.push(task) === 1 && !draining) {
|
||||
scheduleDrain();
|
||||
}
|
||||
}
|
||||
|
||||
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
||||
},{}],2:[function(_dereq_,module,exports){
|
||||
'use strict';
|
||||
var immediate = _dereq_(1);
|
||||
|
||||
/* istanbul ignore next */
|
||||
function INTERNAL() {}
|
||||
|
||||
var handlers = {};
|
||||
|
||||
var REJECTED = ['REJECTED'];
|
||||
var FULFILLED = ['FULFILLED'];
|
||||
var PENDING = ['PENDING'];
|
||||
|
||||
module.exports = Promise;
|
||||
|
||||
function Promise(resolver) {
|
||||
if (typeof resolver !== 'function') {
|
||||
throw new TypeError('resolver must be a function');
|
||||
}
|
||||
this.state = PENDING;
|
||||
this.queue = [];
|
||||
this.outcome = void 0;
|
||||
if (resolver !== INTERNAL) {
|
||||
safelyResolveThenable(this, resolver);
|
||||
}
|
||||
}
|
||||
|
||||
Promise.prototype["finally"] = function (callback) {
|
||||
if (typeof callback !== 'function') {
|
||||
return this;
|
||||
}
|
||||
var p = this.constructor;
|
||||
return this.then(resolve, reject);
|
||||
|
||||
function resolve(value) {
|
||||
function yes () {
|
||||
return value;
|
||||
}
|
||||
return p.resolve(callback()).then(yes);
|
||||
}
|
||||
function reject(reason) {
|
||||
function no () {
|
||||
throw reason;
|
||||
}
|
||||
return p.resolve(callback()).then(no);
|
||||
}
|
||||
};
|
||||
Promise.prototype["catch"] = function (onRejected) {
|
||||
return this.then(null, onRejected);
|
||||
};
|
||||
Promise.prototype.then = function (onFulfilled, onRejected) {
|
||||
if (typeof onFulfilled !== 'function' && this.state === FULFILLED ||
|
||||
typeof onRejected !== 'function' && this.state === REJECTED) {
|
||||
return this;
|
||||
}
|
||||
var promise = new this.constructor(INTERNAL);
|
||||
if (this.state !== PENDING) {
|
||||
var resolver = this.state === FULFILLED ? onFulfilled : onRejected;
|
||||
unwrap(promise, resolver, this.outcome);
|
||||
} else {
|
||||
this.queue.push(new QueueItem(promise, onFulfilled, onRejected));
|
||||
}
|
||||
|
||||
return promise;
|
||||
};
|
||||
function QueueItem(promise, onFulfilled, onRejected) {
|
||||
this.promise = promise;
|
||||
if (typeof onFulfilled === 'function') {
|
||||
this.onFulfilled = onFulfilled;
|
||||
this.callFulfilled = this.otherCallFulfilled;
|
||||
}
|
||||
if (typeof onRejected === 'function') {
|
||||
this.onRejected = onRejected;
|
||||
this.callRejected = this.otherCallRejected;
|
||||
}
|
||||
}
|
||||
QueueItem.prototype.callFulfilled = function (value) {
|
||||
handlers.resolve(this.promise, value);
|
||||
};
|
||||
QueueItem.prototype.otherCallFulfilled = function (value) {
|
||||
unwrap(this.promise, this.onFulfilled, value);
|
||||
};
|
||||
QueueItem.prototype.callRejected = function (value) {
|
||||
handlers.reject(this.promise, value);
|
||||
};
|
||||
QueueItem.prototype.otherCallRejected = function (value) {
|
||||
unwrap(this.promise, this.onRejected, value);
|
||||
};
|
||||
|
||||
function unwrap(promise, func, value) {
|
||||
immediate(function () {
|
||||
var returnValue;
|
||||
try {
|
||||
returnValue = func(value);
|
||||
} catch (e) {
|
||||
return handlers.reject(promise, e);
|
||||
}
|
||||
if (returnValue === promise) {
|
||||
handlers.reject(promise, new TypeError('Cannot resolve promise with itself'));
|
||||
} else {
|
||||
handlers.resolve(promise, returnValue);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
handlers.resolve = function (self, value) {
|
||||
var result = tryCatch(getThen, value);
|
||||
if (result.status === 'error') {
|
||||
return handlers.reject(self, result.value);
|
||||
}
|
||||
var thenable = result.value;
|
||||
|
||||
if (thenable) {
|
||||
safelyResolveThenable(self, thenable);
|
||||
} else {
|
||||
self.state = FULFILLED;
|
||||
self.outcome = value;
|
||||
var i = -1;
|
||||
var len = self.queue.length;
|
||||
while (++i < len) {
|
||||
self.queue[i].callFulfilled(value);
|
||||
}
|
||||
}
|
||||
return self;
|
||||
};
|
||||
handlers.reject = function (self, error) {
|
||||
self.state = REJECTED;
|
||||
self.outcome = error;
|
||||
var i = -1;
|
||||
var len = self.queue.length;
|
||||
while (++i < len) {
|
||||
self.queue[i].callRejected(error);
|
||||
}
|
||||
return self;
|
||||
};
|
||||
|
||||
function getThen(obj) {
|
||||
// Make sure we only access the accessor once as required by the spec
|
||||
var then = obj && obj.then;
|
||||
if (obj && (typeof obj === 'object' || typeof obj === 'function') && typeof then === 'function') {
|
||||
return function appyThen() {
|
||||
then.apply(obj, arguments);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
function safelyResolveThenable(self, thenable) {
|
||||
// Either fulfill, reject or reject with error
|
||||
var called = false;
|
||||
function onError(value) {
|
||||
if (called) {
|
||||
return;
|
||||
}
|
||||
called = true;
|
||||
handlers.reject(self, value);
|
||||
}
|
||||
|
||||
function onSuccess(value) {
|
||||
if (called) {
|
||||
return;
|
||||
}
|
||||
called = true;
|
||||
handlers.resolve(self, value);
|
||||
}
|
||||
|
||||
function tryToUnwrap() {
|
||||
thenable(onSuccess, onError);
|
||||
}
|
||||
|
||||
var result = tryCatch(tryToUnwrap);
|
||||
if (result.status === 'error') {
|
||||
onError(result.value);
|
||||
}
|
||||
}
|
||||
|
||||
function tryCatch(func, value) {
|
||||
var out = {};
|
||||
try {
|
||||
out.value = func(value);
|
||||
out.status = 'success';
|
||||
} catch (e) {
|
||||
out.status = 'error';
|
||||
out.value = e;
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
Promise.resolve = resolve;
|
||||
function resolve(value) {
|
||||
if (value instanceof this) {
|
||||
return value;
|
||||
}
|
||||
return handlers.resolve(new this(INTERNAL), value);
|
||||
}
|
||||
|
||||
Promise.reject = reject;
|
||||
function reject(reason) {
|
||||
var promise = new this(INTERNAL);
|
||||
return handlers.reject(promise, reason);
|
||||
}
|
||||
|
||||
Promise.all = all;
|
||||
function all(iterable) {
|
||||
var self = this;
|
||||
if (Object.prototype.toString.call(iterable) !== '[object Array]') {
|
||||
return this.reject(new TypeError('must be an array'));
|
||||
}
|
||||
|
||||
var len = iterable.length;
|
||||
var called = false;
|
||||
if (!len) {
|
||||
return this.resolve([]);
|
||||
}
|
||||
|
||||
var values = new Array(len);
|
||||
var resolved = 0;
|
||||
var i = -1;
|
||||
var promise = new this(INTERNAL);
|
||||
|
||||
while (++i < len) {
|
||||
allResolver(iterable[i], i);
|
||||
}
|
||||
return promise;
|
||||
function allResolver(value, i) {
|
||||
self.resolve(value).then(resolveFromAll, function (error) {
|
||||
if (!called) {
|
||||
called = true;
|
||||
handlers.reject(promise, error);
|
||||
}
|
||||
});
|
||||
function resolveFromAll(outValue) {
|
||||
values[i] = outValue;
|
||||
if (++resolved === len && !called) {
|
||||
called = true;
|
||||
handlers.resolve(promise, values);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Promise.race = race;
|
||||
function race(iterable) {
|
||||
var self = this;
|
||||
if (Object.prototype.toString.call(iterable) !== '[object Array]') {
|
||||
return this.reject(new TypeError('must be an array'));
|
||||
}
|
||||
|
||||
var len = iterable.length;
|
||||
var called = false;
|
||||
if (!len) {
|
||||
return this.resolve([]);
|
||||
}
|
||||
|
||||
var i = -1;
|
||||
var promise = new this(INTERNAL);
|
||||
|
||||
while (++i < len) {
|
||||
resolver(iterable[i]);
|
||||
}
|
||||
return promise;
|
||||
function resolver(value) {
|
||||
self.resolve(value).then(function (response) {
|
||||
if (!called) {
|
||||
called = true;
|
||||
handlers.resolve(promise, response);
|
||||
}
|
||||
}, function (error) {
|
||||
if (!called) {
|
||||
called = true;
|
||||
handlers.reject(promise, error);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
},{"1":1}]},{},[2])(2)
|
||||
});
|
1
node_modules/lie/dist/lie.min.js
generated
vendored
Normal file
1
node_modules/lie/dist/lie.min.js
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.Promise=e()}}(function(){return function e(t,n,r){function o(u,f){if(!n[u]){if(!t[u]){var c="function"==typeof require&&require;if(!f&&c)return c(u,!0);if(i)return i(u,!0);var s=new Error("Cannot find module '"+u+"'");throw s.code="MODULE_NOT_FOUND",s}var l=n[u]={exports:{}};t[u][0].call(l.exports,function(e){var n=t[u][1][e];return o(n?n:e)},l,l.exports,e,t,n,r)}return n[u].exports}for(var i="function"==typeof require&&require,u=0;u<r.length;u++)o(r[u]);return o}({1:[function(e,t,n){(function(e){"use strict";function n(){l=!0;for(var e,t,n=a.length;n;){for(t=a,a=[],e=-1;++e<n;)t[e]();n=a.length}l=!1}function r(e){1!==a.push(e)||l||o()}var o,i=e.MutationObserver||e.WebKitMutationObserver;if(i){var u=0,f=new i(n),c=e.document.createTextNode("");f.observe(c,{characterData:!0}),o=function(){c.data=u=++u%2}}else if(e.setImmediate||"undefined"==typeof e.MessageChannel)o="document"in e&&"onreadystatechange"in e.document.createElement("script")?function(){var t=e.document.createElement("script");t.onreadystatechange=function(){n(),t.onreadystatechange=null,t.parentNode.removeChild(t),t=null},e.document.documentElement.appendChild(t)}:function(){setTimeout(n,0)};else{var s=new e.MessageChannel;s.port1.onmessage=n,o=function(){s.port2.postMessage(0)}}var l,a=[];t.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],2:[function(e,t,n){"use strict";function r(){}function o(e){if("function"!=typeof e)throw new TypeError("resolver must be a function");this.state=w,this.queue=[],this.outcome=void 0,e!==r&&c(this,e)}function i(e,t,n){this.promise=e,"function"==typeof t&&(this.onFulfilled=t,this.callFulfilled=this.otherCallFulfilled),"function"==typeof n&&(this.onRejected=n,this.callRejected=this.otherCallRejected)}function u(e,t,n){d(function(){var r;try{r=t(n)}catch(t){return v.reject(e,t)}r===e?v.reject(e,new TypeError("Cannot resolve promise with itself")):v.resolve(e,r)})}function f(e){var t=e&&e.then;if(e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof t)return function(){t.apply(e,arguments)}}function c(e,t){function n(t){i||(i=!0,v.reject(e,t))}function r(t){i||(i=!0,v.resolve(e,t))}function o(){t(r,n)}var i=!1,u=s(o);"error"===u.status&&n(u.value)}function s(e,t){var n={};try{n.value=e(t),n.status="success"}catch(e){n.status="error",n.value=e}return n}function l(e){return e instanceof this?e:v.resolve(new this(r),e)}function a(e){var t=new this(r);return v.reject(t,e)}function h(e){function t(e,t){function r(e){u[t]=e,++f!==o||i||(i=!0,v.resolve(s,u))}n.resolve(e).then(r,function(e){i||(i=!0,v.reject(s,e))})}var n=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var o=e.length,i=!1;if(!o)return this.resolve([]);for(var u=new Array(o),f=0,c=-1,s=new this(r);++c<o;)t(e[c],c);return s}function p(e){function t(e){n.resolve(e).then(function(e){i||(i=!0,v.resolve(f,e))},function(e){i||(i=!0,v.reject(f,e))})}var n=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var o=e.length,i=!1;if(!o)return this.resolve([]);for(var u=-1,f=new this(r);++u<o;)t(e[u]);return f}var d=e(1),v={},y=["REJECTED"],m=["FULFILLED"],w=["PENDING"];t.exports=o,o.prototype.finally=function(e){function t(t){function n(){return t}return r.resolve(e()).then(n)}function n(t){function n(){throw t}return r.resolve(e()).then(n)}if("function"!=typeof e)return this;var r=this.constructor;return this.then(t,n)},o.prototype.catch=function(e){return this.then(null,e)},o.prototype.then=function(e,t){if("function"!=typeof e&&this.state===m||"function"!=typeof t&&this.state===y)return this;var n=new this.constructor(r);if(this.state!==w){var o=this.state===m?e:t;u(n,o,this.outcome)}else this.queue.push(new i(n,e,t));return n},i.prototype.callFulfilled=function(e){v.resolve(this.promise,e)},i.prototype.otherCallFulfilled=function(e){u(this.promise,this.onFulfilled,e)},i.prototype.callRejected=function(e){v.reject(this.promise,e)},i.prototype.otherCallRejected=function(e){u(this.promise,this.onRejected,e)},v.resolve=function(e,t){var n=s(f,t);if("error"===n.status)return v.reject(e,n.value);var r=n.value;if(r)c(e,r);else{e.state=m,e.outcome=t;for(var o=-1,i=e.queue.length;++o<i;)e.queue[o].callFulfilled(t)}return e},v.reject=function(e,t){e.state=y,e.outcome=t;for(var n=-1,r=e.queue.length;++n<r;)e.queue[n].callRejected(t);return e},o.resolve=l,o.reject=a,o.all=h,o.race=p},{1:1}]},{},[2])(2)});
|
358
node_modules/lie/dist/lie.polyfill.js
generated
vendored
Normal file
358
node_modules/lie/dist/lie.polyfill.js
generated
vendored
Normal file
@ -0,0 +1,358 @@
|
||||
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){
|
||||
'use strict';
|
||||
var immediate = _dereq_(2);
|
||||
|
||||
/* istanbul ignore next */
|
||||
function INTERNAL() {}
|
||||
|
||||
var handlers = {};
|
||||
|
||||
var REJECTED = ['REJECTED'];
|
||||
var FULFILLED = ['FULFILLED'];
|
||||
var PENDING = ['PENDING'];
|
||||
|
||||
module.exports = Promise;
|
||||
|
||||
function Promise(resolver) {
|
||||
if (typeof resolver !== 'function') {
|
||||
throw new TypeError('resolver must be a function');
|
||||
}
|
||||
this.state = PENDING;
|
||||
this.queue = [];
|
||||
this.outcome = void 0;
|
||||
if (resolver !== INTERNAL) {
|
||||
safelyResolveThenable(this, resolver);
|
||||
}
|
||||
}
|
||||
|
||||
Promise.prototype["finally"] = function (callback) {
|
||||
if (typeof callback !== 'function') {
|
||||
return this;
|
||||
}
|
||||
var p = this.constructor;
|
||||
return this.then(resolve, reject);
|
||||
|
||||
function resolve(value) {
|
||||
function yes () {
|
||||
return value;
|
||||
}
|
||||
return p.resolve(callback()).then(yes);
|
||||
}
|
||||
function reject(reason) {
|
||||
function no () {
|
||||
throw reason;
|
||||
}
|
||||
return p.resolve(callback()).then(no);
|
||||
}
|
||||
};
|
||||
Promise.prototype["catch"] = function (onRejected) {
|
||||
return this.then(null, onRejected);
|
||||
};
|
||||
Promise.prototype.then = function (onFulfilled, onRejected) {
|
||||
if (typeof onFulfilled !== 'function' && this.state === FULFILLED ||
|
||||
typeof onRejected !== 'function' && this.state === REJECTED) {
|
||||
return this;
|
||||
}
|
||||
var promise = new this.constructor(INTERNAL);
|
||||
if (this.state !== PENDING) {
|
||||
var resolver = this.state === FULFILLED ? onFulfilled : onRejected;
|
||||
unwrap(promise, resolver, this.outcome);
|
||||
} else {
|
||||
this.queue.push(new QueueItem(promise, onFulfilled, onRejected));
|
||||
}
|
||||
|
||||
return promise;
|
||||
};
|
||||
function QueueItem(promise, onFulfilled, onRejected) {
|
||||
this.promise = promise;
|
||||
if (typeof onFulfilled === 'function') {
|
||||
this.onFulfilled = onFulfilled;
|
||||
this.callFulfilled = this.otherCallFulfilled;
|
||||
}
|
||||
if (typeof onRejected === 'function') {
|
||||
this.onRejected = onRejected;
|
||||
this.callRejected = this.otherCallRejected;
|
||||
}
|
||||
}
|
||||
QueueItem.prototype.callFulfilled = function (value) {
|
||||
handlers.resolve(this.promise, value);
|
||||
};
|
||||
QueueItem.prototype.otherCallFulfilled = function (value) {
|
||||
unwrap(this.promise, this.onFulfilled, value);
|
||||
};
|
||||
QueueItem.prototype.callRejected = function (value) {
|
||||
handlers.reject(this.promise, value);
|
||||
};
|
||||
QueueItem.prototype.otherCallRejected = function (value) {
|
||||
unwrap(this.promise, this.onRejected, value);
|
||||
};
|
||||
|
||||
function unwrap(promise, func, value) {
|
||||
immediate(function () {
|
||||
var returnValue;
|
||||
try {
|
||||
returnValue = func(value);
|
||||
} catch (e) {
|
||||
return handlers.reject(promise, e);
|
||||
}
|
||||
if (returnValue === promise) {
|
||||
handlers.reject(promise, new TypeError('Cannot resolve promise with itself'));
|
||||
} else {
|
||||
handlers.resolve(promise, returnValue);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
handlers.resolve = function (self, value) {
|
||||
var result = tryCatch(getThen, value);
|
||||
if (result.status === 'error') {
|
||||
return handlers.reject(self, result.value);
|
||||
}
|
||||
var thenable = result.value;
|
||||
|
||||
if (thenable) {
|
||||
safelyResolveThenable(self, thenable);
|
||||
} else {
|
||||
self.state = FULFILLED;
|
||||
self.outcome = value;
|
||||
var i = -1;
|
||||
var len = self.queue.length;
|
||||
while (++i < len) {
|
||||
self.queue[i].callFulfilled(value);
|
||||
}
|
||||
}
|
||||
return self;
|
||||
};
|
||||
handlers.reject = function (self, error) {
|
||||
self.state = REJECTED;
|
||||
self.outcome = error;
|
||||
var i = -1;
|
||||
var len = self.queue.length;
|
||||
while (++i < len) {
|
||||
self.queue[i].callRejected(error);
|
||||
}
|
||||
return self;
|
||||
};
|
||||
|
||||
function getThen(obj) {
|
||||
// Make sure we only access the accessor once as required by the spec
|
||||
var then = obj && obj.then;
|
||||
if (obj && (typeof obj === 'object' || typeof obj === 'function') && typeof then === 'function') {
|
||||
return function appyThen() {
|
||||
then.apply(obj, arguments);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
function safelyResolveThenable(self, thenable) {
|
||||
// Either fulfill, reject or reject with error
|
||||
var called = false;
|
||||
function onError(value) {
|
||||
if (called) {
|
||||
return;
|
||||
}
|
||||
called = true;
|
||||
handlers.reject(self, value);
|
||||
}
|
||||
|
||||
function onSuccess(value) {
|
||||
if (called) {
|
||||
return;
|
||||
}
|
||||
called = true;
|
||||
handlers.resolve(self, value);
|
||||
}
|
||||
|
||||
function tryToUnwrap() {
|
||||
thenable(onSuccess, onError);
|
||||
}
|
||||
|
||||
var result = tryCatch(tryToUnwrap);
|
||||
if (result.status === 'error') {
|
||||
onError(result.value);
|
||||
}
|
||||
}
|
||||
|
||||
function tryCatch(func, value) {
|
||||
var out = {};
|
||||
try {
|
||||
out.value = func(value);
|
||||
out.status = 'success';
|
||||
} catch (e) {
|
||||
out.status = 'error';
|
||||
out.value = e;
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
Promise.resolve = resolve;
|
||||
function resolve(value) {
|
||||
if (value instanceof this) {
|
||||
return value;
|
||||
}
|
||||
return handlers.resolve(new this(INTERNAL), value);
|
||||
}
|
||||
|
||||
Promise.reject = reject;
|
||||
function reject(reason) {
|
||||
var promise = new this(INTERNAL);
|
||||
return handlers.reject(promise, reason);
|
||||
}
|
||||
|
||||
Promise.all = all;
|
||||
function all(iterable) {
|
||||
var self = this;
|
||||
if (Object.prototype.toString.call(iterable) !== '[object Array]') {
|
||||
return this.reject(new TypeError('must be an array'));
|
||||
}
|
||||
|
||||
var len = iterable.length;
|
||||
var called = false;
|
||||
if (!len) {
|
||||
return this.resolve([]);
|
||||
}
|
||||
|
||||
var values = new Array(len);
|
||||
var resolved = 0;
|
||||
var i = -1;
|
||||
var promise = new this(INTERNAL);
|
||||
|
||||
while (++i < len) {
|
||||
allResolver(iterable[i], i);
|
||||
}
|
||||
return promise;
|
||||
function allResolver(value, i) {
|
||||
self.resolve(value).then(resolveFromAll, function (error) {
|
||||
if (!called) {
|
||||
called = true;
|
||||
handlers.reject(promise, error);
|
||||
}
|
||||
});
|
||||
function resolveFromAll(outValue) {
|
||||
values[i] = outValue;
|
||||
if (++resolved === len && !called) {
|
||||
called = true;
|
||||
handlers.resolve(promise, values);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Promise.race = race;
|
||||
function race(iterable) {
|
||||
var self = this;
|
||||
if (Object.prototype.toString.call(iterable) !== '[object Array]') {
|
||||
return this.reject(new TypeError('must be an array'));
|
||||
}
|
||||
|
||||
var len = iterable.length;
|
||||
var called = false;
|
||||
if (!len) {
|
||||
return this.resolve([]);
|
||||
}
|
||||
|
||||
var i = -1;
|
||||
var promise = new this(INTERNAL);
|
||||
|
||||
while (++i < len) {
|
||||
resolver(iterable[i]);
|
||||
}
|
||||
return promise;
|
||||
function resolver(value) {
|
||||
self.resolve(value).then(function (response) {
|
||||
if (!called) {
|
||||
called = true;
|
||||
handlers.resolve(promise, response);
|
||||
}
|
||||
}, function (error) {
|
||||
if (!called) {
|
||||
called = true;
|
||||
handlers.reject(promise, error);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
},{"2":2}],2:[function(_dereq_,module,exports){
|
||||
(function (global){
|
||||
'use strict';
|
||||
var Mutation = global.MutationObserver || global.WebKitMutationObserver;
|
||||
|
||||
var scheduleDrain;
|
||||
|
||||
{
|
||||
if (Mutation) {
|
||||
var called = 0;
|
||||
var observer = new Mutation(nextTick);
|
||||
var element = global.document.createTextNode('');
|
||||
observer.observe(element, {
|
||||
characterData: true
|
||||
});
|
||||
scheduleDrain = function () {
|
||||
element.data = (called = ++called % 2);
|
||||
};
|
||||
} else if (!global.setImmediate && typeof global.MessageChannel !== 'undefined') {
|
||||
var channel = new global.MessageChannel();
|
||||
channel.port1.onmessage = nextTick;
|
||||
scheduleDrain = function () {
|
||||
channel.port2.postMessage(0);
|
||||
};
|
||||
} else if ('document' in global && 'onreadystatechange' in global.document.createElement('script')) {
|
||||
scheduleDrain = function () {
|
||||
|
||||
// Create a <script> element; its readystatechange event will be fired asynchronously once it is inserted
|
||||
// into the document. Do so, thus queuing up the task. Remember to clean up once it's been called.
|
||||
var scriptEl = global.document.createElement('script');
|
||||
scriptEl.onreadystatechange = function () {
|
||||
nextTick();
|
||||
|
||||
scriptEl.onreadystatechange = null;
|
||||
scriptEl.parentNode.removeChild(scriptEl);
|
||||
scriptEl = null;
|
||||
};
|
||||
global.document.documentElement.appendChild(scriptEl);
|
||||
};
|
||||
} else {
|
||||
scheduleDrain = function () {
|
||||
setTimeout(nextTick, 0);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
var draining;
|
||||
var queue = [];
|
||||
//named nextTick for less confusing stack traces
|
||||
function nextTick() {
|
||||
draining = true;
|
||||
var i, oldQueue;
|
||||
var len = queue.length;
|
||||
while (len) {
|
||||
oldQueue = queue;
|
||||
queue = [];
|
||||
i = -1;
|
||||
while (++i < len) {
|
||||
oldQueue[i]();
|
||||
}
|
||||
len = queue.length;
|
||||
}
|
||||
draining = false;
|
||||
}
|
||||
|
||||
module.exports = immediate;
|
||||
function immediate(task) {
|
||||
if (queue.push(task) === 1 && !draining) {
|
||||
scheduleDrain();
|
||||
}
|
||||
}
|
||||
|
||||
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
||||
},{}],3:[function(_dereq_,module,exports){
|
||||
(function (global){
|
||||
'use strict';
|
||||
if (typeof global.Promise !== 'function') {
|
||||
global.Promise = _dereq_(1);
|
||||
}
|
||||
|
||||
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
||||
},{"1":1}]},{},[3]);
|
||||
|
1
node_modules/lie/dist/lie.polyfill.min.js
generated
vendored
Normal file
1
node_modules/lie/dist/lie.polyfill.min.js
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
!function e(t,n,r){function o(u,c){if(!n[u]){if(!t[u]){var s="function"==typeof require&&require;if(!c&&s)return s(u,!0);if(i)return i(u,!0);var f=new Error("Cannot find module '"+u+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[u]={exports:{}};t[u][0].call(l.exports,function(e){var n=t[u][1][e];return o(n?n:e)},l,l.exports,e,t,n,r)}return n[u].exports}for(var i="function"==typeof require&&require,u=0;u<r.length;u++)o(r[u]);return o}({1:[function(e,t,n){"use strict";function r(){}function o(e){if("function"!=typeof e)throw new TypeError("resolver must be a function");this.state=w,this.queue=[],this.outcome=void 0,e!==r&&s(this,e)}function i(e,t,n){this.promise=e,"function"==typeof t&&(this.onFulfilled=t,this.callFulfilled=this.otherCallFulfilled),"function"==typeof n&&(this.onRejected=n,this.callRejected=this.otherCallRejected)}function u(e,t,n){v(function(){var r;try{r=t(n)}catch(t){return d.reject(e,t)}r===e?d.reject(e,new TypeError("Cannot resolve promise with itself")):d.resolve(e,r)})}function c(e){var t=e&&e.then;if(e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof t)return function(){t.apply(e,arguments)}}function s(e,t){function n(t){i||(i=!0,d.reject(e,t))}function r(t){i||(i=!0,d.resolve(e,t))}function o(){t(r,n)}var i=!1,u=f(o);"error"===u.status&&n(u.value)}function f(e,t){var n={};try{n.value=e(t),n.status="success"}catch(e){n.status="error",n.value=e}return n}function l(e){return e instanceof this?e:d.resolve(new this(r),e)}function a(e){var t=new this(r);return d.reject(t,e)}function h(e){function t(e,t){function r(e){u[t]=e,++c!==o||i||(i=!0,d.resolve(f,u))}n.resolve(e).then(r,function(e){i||(i=!0,d.reject(f,e))})}var n=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var o=e.length,i=!1;if(!o)return this.resolve([]);for(var u=new Array(o),c=0,s=-1,f=new this(r);++s<o;)t(e[s],s);return f}function p(e){function t(e){n.resolve(e).then(function(e){i||(i=!0,d.resolve(c,e))},function(e){i||(i=!0,d.reject(c,e))})}var n=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var o=e.length,i=!1;if(!o)return this.resolve([]);for(var u=-1,c=new this(r);++u<o;)t(e[u]);return c}var v=e(2),d={},y=["REJECTED"],m=["FULFILLED"],w=["PENDING"];t.exports=o,o.prototype.finally=function(e){function t(t){function n(){return t}return r.resolve(e()).then(n)}function n(t){function n(){throw t}return r.resolve(e()).then(n)}if("function"!=typeof e)return this;var r=this.constructor;return this.then(t,n)},o.prototype.catch=function(e){return this.then(null,e)},o.prototype.then=function(e,t){if("function"!=typeof e&&this.state===m||"function"!=typeof t&&this.state===y)return this;var n=new this.constructor(r);if(this.state!==w){var o=this.state===m?e:t;u(n,o,this.outcome)}else this.queue.push(new i(n,e,t));return n},i.prototype.callFulfilled=function(e){d.resolve(this.promise,e)},i.prototype.otherCallFulfilled=function(e){u(this.promise,this.onFulfilled,e)},i.prototype.callRejected=function(e){d.reject(this.promise,e)},i.prototype.otherCallRejected=function(e){u(this.promise,this.onRejected,e)},d.resolve=function(e,t){var n=f(c,t);if("error"===n.status)return d.reject(e,n.value);var r=n.value;if(r)s(e,r);else{e.state=m,e.outcome=t;for(var o=-1,i=e.queue.length;++o<i;)e.queue[o].callFulfilled(t)}return e},d.reject=function(e,t){e.state=y,e.outcome=t;for(var n=-1,r=e.queue.length;++n<r;)e.queue[n].callRejected(t);return e},o.resolve=l,o.reject=a,o.all=h,o.race=p},{2:2}],2:[function(e,t,n){(function(e){"use strict";function n(){l=!0;for(var e,t,n=a.length;n;){for(t=a,a=[],e=-1;++e<n;)t[e]();n=a.length}l=!1}function r(e){1!==a.push(e)||l||o()}var o,i=e.MutationObserver||e.WebKitMutationObserver;if(i){var u=0,c=new i(n),s=e.document.createTextNode("");c.observe(s,{characterData:!0}),o=function(){s.data=u=++u%2}}else if(e.setImmediate||"undefined"==typeof e.MessageChannel)o="document"in e&&"onreadystatechange"in e.document.createElement("script")?function(){var t=e.document.createElement("script");t.onreadystatechange=function(){n(),t.onreadystatechange=null,t.parentNode.removeChild(t),t=null},e.document.documentElement.appendChild(t)}:function(){setTimeout(n,0)};else{var f=new e.MessageChannel;f.port1.onmessage=n,o=function(){f.port2.postMessage(0)}}var l,a=[];t.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],3:[function(e,t,n){(function(t){"use strict";"function"!=typeof t.Promise&&(t.Promise=e(1))}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{1:1}]},{},[3]);
|
273
node_modules/lie/lib/browser.js
generated
vendored
Normal file
273
node_modules/lie/lib/browser.js
generated
vendored
Normal file
@ -0,0 +1,273 @@
|
||||
'use strict';
|
||||
var immediate = require('immediate');
|
||||
|
||||
/* istanbul ignore next */
|
||||
function INTERNAL() {}
|
||||
|
||||
var handlers = {};
|
||||
|
||||
var REJECTED = ['REJECTED'];
|
||||
var FULFILLED = ['FULFILLED'];
|
||||
var PENDING = ['PENDING'];
|
||||
|
||||
module.exports = Promise;
|
||||
|
||||
function Promise(resolver) {
|
||||
if (typeof resolver !== 'function') {
|
||||
throw new TypeError('resolver must be a function');
|
||||
}
|
||||
this.state = PENDING;
|
||||
this.queue = [];
|
||||
this.outcome = void 0;
|
||||
if (resolver !== INTERNAL) {
|
||||
safelyResolveThenable(this, resolver);
|
||||
}
|
||||
}
|
||||
|
||||
Promise.prototype["finally"] = function (callback) {
|
||||
if (typeof callback !== 'function') {
|
||||
return this;
|
||||
}
|
||||
var p = this.constructor;
|
||||
return this.then(resolve, reject);
|
||||
|
||||
function resolve(value) {
|
||||
function yes () {
|
||||
return value;
|
||||
}
|
||||
return p.resolve(callback()).then(yes);
|
||||
}
|
||||
function reject(reason) {
|
||||
function no () {
|
||||
throw reason;
|
||||
}
|
||||
return p.resolve(callback()).then(no);
|
||||
}
|
||||
};
|
||||
Promise.prototype["catch"] = function (onRejected) {
|
||||
return this.then(null, onRejected);
|
||||
};
|
||||
Promise.prototype.then = function (onFulfilled, onRejected) {
|
||||
if (typeof onFulfilled !== 'function' && this.state === FULFILLED ||
|
||||
typeof onRejected !== 'function' && this.state === REJECTED) {
|
||||
return this;
|
||||
}
|
||||
var promise = new this.constructor(INTERNAL);
|
||||
if (this.state !== PENDING) {
|
||||
var resolver = this.state === FULFILLED ? onFulfilled : onRejected;
|
||||
unwrap(promise, resolver, this.outcome);
|
||||
} else {
|
||||
this.queue.push(new QueueItem(promise, onFulfilled, onRejected));
|
||||
}
|
||||
|
||||
return promise;
|
||||
};
|
||||
function QueueItem(promise, onFulfilled, onRejected) {
|
||||
this.promise = promise;
|
||||
if (typeof onFulfilled === 'function') {
|
||||
this.onFulfilled = onFulfilled;
|
||||
this.callFulfilled = this.otherCallFulfilled;
|
||||
}
|
||||
if (typeof onRejected === 'function') {
|
||||
this.onRejected = onRejected;
|
||||
this.callRejected = this.otherCallRejected;
|
||||
}
|
||||
}
|
||||
QueueItem.prototype.callFulfilled = function (value) {
|
||||
handlers.resolve(this.promise, value);
|
||||
};
|
||||
QueueItem.prototype.otherCallFulfilled = function (value) {
|
||||
unwrap(this.promise, this.onFulfilled, value);
|
||||
};
|
||||
QueueItem.prototype.callRejected = function (value) {
|
||||
handlers.reject(this.promise, value);
|
||||
};
|
||||
QueueItem.prototype.otherCallRejected = function (value) {
|
||||
unwrap(this.promise, this.onRejected, value);
|
||||
};
|
||||
|
||||
function unwrap(promise, func, value) {
|
||||
immediate(function () {
|
||||
var returnValue;
|
||||
try {
|
||||
returnValue = func(value);
|
||||
} catch (e) {
|
||||
return handlers.reject(promise, e);
|
||||
}
|
||||
if (returnValue === promise) {
|
||||
handlers.reject(promise, new TypeError('Cannot resolve promise with itself'));
|
||||
} else {
|
||||
handlers.resolve(promise, returnValue);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
handlers.resolve = function (self, value) {
|
||||
var result = tryCatch(getThen, value);
|
||||
if (result.status === 'error') {
|
||||
return handlers.reject(self, result.value);
|
||||
}
|
||||
var thenable = result.value;
|
||||
|
||||
if (thenable) {
|
||||
safelyResolveThenable(self, thenable);
|
||||
} else {
|
||||
self.state = FULFILLED;
|
||||
self.outcome = value;
|
||||
var i = -1;
|
||||
var len = self.queue.length;
|
||||
while (++i < len) {
|
||||
self.queue[i].callFulfilled(value);
|
||||
}
|
||||
}
|
||||
return self;
|
||||
};
|
||||
handlers.reject = function (self, error) {
|
||||
self.state = REJECTED;
|
||||
self.outcome = error;
|
||||
var i = -1;
|
||||
var len = self.queue.length;
|
||||
while (++i < len) {
|
||||
self.queue[i].callRejected(error);
|
||||
}
|
||||
return self;
|
||||
};
|
||||
|
||||
function getThen(obj) {
|
||||
// Make sure we only access the accessor once as required by the spec
|
||||
var then = obj && obj.then;
|
||||
if (obj && (typeof obj === 'object' || typeof obj === 'function') && typeof then === 'function') {
|
||||
return function appyThen() {
|
||||
then.apply(obj, arguments);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
function safelyResolveThenable(self, thenable) {
|
||||
// Either fulfill, reject or reject with error
|
||||
var called = false;
|
||||
function onError(value) {
|
||||
if (called) {
|
||||
return;
|
||||
}
|
||||
called = true;
|
||||
handlers.reject(self, value);
|
||||
}
|
||||
|
||||
function onSuccess(value) {
|
||||
if (called) {
|
||||
return;
|
||||
}
|
||||
called = true;
|
||||
handlers.resolve(self, value);
|
||||
}
|
||||
|
||||
function tryToUnwrap() {
|
||||
thenable(onSuccess, onError);
|
||||
}
|
||||
|
||||
var result = tryCatch(tryToUnwrap);
|
||||
if (result.status === 'error') {
|
||||
onError(result.value);
|
||||
}
|
||||
}
|
||||
|
||||
function tryCatch(func, value) {
|
||||
var out = {};
|
||||
try {
|
||||
out.value = func(value);
|
||||
out.status = 'success';
|
||||
} catch (e) {
|
||||
out.status = 'error';
|
||||
out.value = e;
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
Promise.resolve = resolve;
|
||||
function resolve(value) {
|
||||
if (value instanceof this) {
|
||||
return value;
|
||||
}
|
||||
return handlers.resolve(new this(INTERNAL), value);
|
||||
}
|
||||
|
||||
Promise.reject = reject;
|
||||
function reject(reason) {
|
||||
var promise = new this(INTERNAL);
|
||||
return handlers.reject(promise, reason);
|
||||
}
|
||||
|
||||
Promise.all = all;
|
||||
function all(iterable) {
|
||||
var self = this;
|
||||
if (Object.prototype.toString.call(iterable) !== '[object Array]') {
|
||||
return this.reject(new TypeError('must be an array'));
|
||||
}
|
||||
|
||||
var len = iterable.length;
|
||||
var called = false;
|
||||
if (!len) {
|
||||
return this.resolve([]);
|
||||
}
|
||||
|
||||
var values = new Array(len);
|
||||
var resolved = 0;
|
||||
var i = -1;
|
||||
var promise = new this(INTERNAL);
|
||||
|
||||
while (++i < len) {
|
||||
allResolver(iterable[i], i);
|
||||
}
|
||||
return promise;
|
||||
function allResolver(value, i) {
|
||||
self.resolve(value).then(resolveFromAll, function (error) {
|
||||
if (!called) {
|
||||
called = true;
|
||||
handlers.reject(promise, error);
|
||||
}
|
||||
});
|
||||
function resolveFromAll(outValue) {
|
||||
values[i] = outValue;
|
||||
if (++resolved === len && !called) {
|
||||
called = true;
|
||||
handlers.resolve(promise, values);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Promise.race = race;
|
||||
function race(iterable) {
|
||||
var self = this;
|
||||
if (Object.prototype.toString.call(iterable) !== '[object Array]') {
|
||||
return this.reject(new TypeError('must be an array'));
|
||||
}
|
||||
|
||||
var len = iterable.length;
|
||||
var called = false;
|
||||
if (!len) {
|
||||
return this.resolve([]);
|
||||
}
|
||||
|
||||
var i = -1;
|
||||
var promise = new this(INTERNAL);
|
||||
|
||||
while (++i < len) {
|
||||
resolver(iterable[i]);
|
||||
}
|
||||
return promise;
|
||||
function resolver(value) {
|
||||
self.resolve(value).then(function (response) {
|
||||
if (!called) {
|
||||
called = true;
|
||||
handlers.resolve(promise, response);
|
||||
}
|
||||
}, function (error) {
|
||||
if (!called) {
|
||||
called = true;
|
||||
handlers.reject(promise, error);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
298
node_modules/lie/lib/index.js
generated
vendored
Normal file
298
node_modules/lie/lib/index.js
generated
vendored
Normal file
@ -0,0 +1,298 @@
|
||||
'use strict';
|
||||
var immediate = require('immediate');
|
||||
|
||||
/* istanbul ignore next */
|
||||
function INTERNAL() {}
|
||||
|
||||
var handlers = {};
|
||||
|
||||
var REJECTED = ['REJECTED'];
|
||||
var FULFILLED = ['FULFILLED'];
|
||||
var PENDING = ['PENDING'];
|
||||
/* istanbul ignore else */
|
||||
if (!process.browser) {
|
||||
// in which we actually take advantage of JS scoping
|
||||
var UNHANDLED = ['UNHANDLED'];
|
||||
}
|
||||
|
||||
module.exports = Promise;
|
||||
|
||||
function Promise(resolver) {
|
||||
if (typeof resolver !== 'function') {
|
||||
throw new TypeError('resolver must be a function');
|
||||
}
|
||||
this.state = PENDING;
|
||||
this.queue = [];
|
||||
this.outcome = void 0;
|
||||
/* istanbul ignore else */
|
||||
if (!process.browser) {
|
||||
this.handled = UNHANDLED;
|
||||
}
|
||||
if (resolver !== INTERNAL) {
|
||||
safelyResolveThenable(this, resolver);
|
||||
}
|
||||
}
|
||||
|
||||
Promise.prototype.finally = function (callback) {
|
||||
if (typeof callback !== 'function') {
|
||||
return this;
|
||||
}
|
||||
var p = this.constructor;
|
||||
return this.then(resolve, reject);
|
||||
|
||||
function resolve(value) {
|
||||
function yes () {
|
||||
return value;
|
||||
}
|
||||
return p.resolve(callback()).then(yes);
|
||||
}
|
||||
function reject(reason) {
|
||||
function no () {
|
||||
throw reason;
|
||||
}
|
||||
return p.resolve(callback()).then(no);
|
||||
}
|
||||
};
|
||||
Promise.prototype.catch = function (onRejected) {
|
||||
return this.then(null, onRejected);
|
||||
};
|
||||
Promise.prototype.then = function (onFulfilled, onRejected) {
|
||||
if (typeof onFulfilled !== 'function' && this.state === FULFILLED ||
|
||||
typeof onRejected !== 'function' && this.state === REJECTED) {
|
||||
return this;
|
||||
}
|
||||
var promise = new this.constructor(INTERNAL);
|
||||
/* istanbul ignore else */
|
||||
if (!process.browser) {
|
||||
if (this.handled === UNHANDLED) {
|
||||
this.handled = null;
|
||||
}
|
||||
}
|
||||
if (this.state !== PENDING) {
|
||||
var resolver = this.state === FULFILLED ? onFulfilled : onRejected;
|
||||
unwrap(promise, resolver, this.outcome);
|
||||
} else {
|
||||
this.queue.push(new QueueItem(promise, onFulfilled, onRejected));
|
||||
}
|
||||
|
||||
return promise;
|
||||
};
|
||||
function QueueItem(promise, onFulfilled, onRejected) {
|
||||
this.promise = promise;
|
||||
if (typeof onFulfilled === 'function') {
|
||||
this.onFulfilled = onFulfilled;
|
||||
this.callFulfilled = this.otherCallFulfilled;
|
||||
}
|
||||
if (typeof onRejected === 'function') {
|
||||
this.onRejected = onRejected;
|
||||
this.callRejected = this.otherCallRejected;
|
||||
}
|
||||
}
|
||||
QueueItem.prototype.callFulfilled = function (value) {
|
||||
handlers.resolve(this.promise, value);
|
||||
};
|
||||
QueueItem.prototype.otherCallFulfilled = function (value) {
|
||||
unwrap(this.promise, this.onFulfilled, value);
|
||||
};
|
||||
QueueItem.prototype.callRejected = function (value) {
|
||||
handlers.reject(this.promise, value);
|
||||
};
|
||||
QueueItem.prototype.otherCallRejected = function (value) {
|
||||
unwrap(this.promise, this.onRejected, value);
|
||||
};
|
||||
|
||||
function unwrap(promise, func, value) {
|
||||
immediate(function () {
|
||||
var returnValue;
|
||||
try {
|
||||
returnValue = func(value);
|
||||
} catch (e) {
|
||||
return handlers.reject(promise, e);
|
||||
}
|
||||
if (returnValue === promise) {
|
||||
handlers.reject(promise, new TypeError('Cannot resolve promise with itself'));
|
||||
} else {
|
||||
handlers.resolve(promise, returnValue);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
handlers.resolve = function (self, value) {
|
||||
var result = tryCatch(getThen, value);
|
||||
if (result.status === 'error') {
|
||||
return handlers.reject(self, result.value);
|
||||
}
|
||||
var thenable = result.value;
|
||||
|
||||
if (thenable) {
|
||||
safelyResolveThenable(self, thenable);
|
||||
} else {
|
||||
self.state = FULFILLED;
|
||||
self.outcome = value;
|
||||
var i = -1;
|
||||
var len = self.queue.length;
|
||||
while (++i < len) {
|
||||
self.queue[i].callFulfilled(value);
|
||||
}
|
||||
}
|
||||
return self;
|
||||
};
|
||||
handlers.reject = function (self, error) {
|
||||
self.state = REJECTED;
|
||||
self.outcome = error;
|
||||
/* istanbul ignore else */
|
||||
if (!process.browser) {
|
||||
if (self.handled === UNHANDLED) {
|
||||
immediate(function () {
|
||||
if (self.handled === UNHANDLED) {
|
||||
process.emit('unhandledRejection', error, self);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
var i = -1;
|
||||
var len = self.queue.length;
|
||||
while (++i < len) {
|
||||
self.queue[i].callRejected(error);
|
||||
}
|
||||
return self;
|
||||
};
|
||||
|
||||
function getThen(obj) {
|
||||
// Make sure we only access the accessor once as required by the spec
|
||||
var then = obj && obj.then;
|
||||
if (obj && (typeof obj === 'object' || typeof obj === 'function') && typeof then === 'function') {
|
||||
return function appyThen() {
|
||||
then.apply(obj, arguments);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
function safelyResolveThenable(self, thenable) {
|
||||
// Either fulfill, reject or reject with error
|
||||
var called = false;
|
||||
function onError(value) {
|
||||
if (called) {
|
||||
return;
|
||||
}
|
||||
called = true;
|
||||
handlers.reject(self, value);
|
||||
}
|
||||
|
||||
function onSuccess(value) {
|
||||
if (called) {
|
||||
return;
|
||||
}
|
||||
called = true;
|
||||
handlers.resolve(self, value);
|
||||
}
|
||||
|
||||
function tryToUnwrap() {
|
||||
thenable(onSuccess, onError);
|
||||
}
|
||||
|
||||
var result = tryCatch(tryToUnwrap);
|
||||
if (result.status === 'error') {
|
||||
onError(result.value);
|
||||
}
|
||||
}
|
||||
|
||||
function tryCatch(func, value) {
|
||||
var out = {};
|
||||
try {
|
||||
out.value = func(value);
|
||||
out.status = 'success';
|
||||
} catch (e) {
|
||||
out.status = 'error';
|
||||
out.value = e;
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
Promise.resolve = resolve;
|
||||
function resolve(value) {
|
||||
if (value instanceof this) {
|
||||
return value;
|
||||
}
|
||||
return handlers.resolve(new this(INTERNAL), value);
|
||||
}
|
||||
|
||||
Promise.reject = reject;
|
||||
function reject(reason) {
|
||||
var promise = new this(INTERNAL);
|
||||
return handlers.reject(promise, reason);
|
||||
}
|
||||
|
||||
Promise.all = all;
|
||||
function all(iterable) {
|
||||
var self = this;
|
||||
if (Object.prototype.toString.call(iterable) !== '[object Array]') {
|
||||
return this.reject(new TypeError('must be an array'));
|
||||
}
|
||||
|
||||
var len = iterable.length;
|
||||
var called = false;
|
||||
if (!len) {
|
||||
return this.resolve([]);
|
||||
}
|
||||
|
||||
var values = new Array(len);
|
||||
var resolved = 0;
|
||||
var i = -1;
|
||||
var promise = new this(INTERNAL);
|
||||
|
||||
while (++i < len) {
|
||||
allResolver(iterable[i], i);
|
||||
}
|
||||
return promise;
|
||||
function allResolver(value, i) {
|
||||
self.resolve(value).then(resolveFromAll, function (error) {
|
||||
if (!called) {
|
||||
called = true;
|
||||
handlers.reject(promise, error);
|
||||
}
|
||||
});
|
||||
function resolveFromAll(outValue) {
|
||||
values[i] = outValue;
|
||||
if (++resolved === len && !called) {
|
||||
called = true;
|
||||
handlers.resolve(promise, values);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Promise.race = race;
|
||||
function race(iterable) {
|
||||
var self = this;
|
||||
if (Object.prototype.toString.call(iterable) !== '[object Array]') {
|
||||
return this.reject(new TypeError('must be an array'));
|
||||
}
|
||||
|
||||
var len = iterable.length;
|
||||
var called = false;
|
||||
if (!len) {
|
||||
return this.resolve([]);
|
||||
}
|
||||
|
||||
var i = -1;
|
||||
var promise = new this(INTERNAL);
|
||||
|
||||
while (++i < len) {
|
||||
resolver(iterable[i]);
|
||||
}
|
||||
return promise;
|
||||
function resolver(value) {
|
||||
self.resolve(value).then(function (response) {
|
||||
if (!called) {
|
||||
called = true;
|
||||
handlers.resolve(promise, response);
|
||||
}
|
||||
}, function (error) {
|
||||
if (!called) {
|
||||
called = true;
|
||||
handlers.reject(promise, error);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
7
node_modules/lie/license.md
generated
vendored
Normal file
7
node_modules/lie/license.md
generated
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
#Copyright (c) 2014-2018 Calvin Metcalf, Jordan Harband
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
**THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.**
|
244
node_modules/lie/lie.d.ts
generated
vendored
Normal file
244
node_modules/lie/lie.d.ts
generated
vendored
Normal file
@ -0,0 +1,244 @@
|
||||
// Type definitions for lie 3.2
|
||||
// Project: https://github.com/calvinmetcalf/lie#readme
|
||||
// Definitions by: Andre Wiggins <https://github.com/andrewiggins>
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
// These types are copied from TypeScript's built-in Promise types
|
||||
// and extended with extra Lie utilities namely, finally.
|
||||
|
||||
export as namespace Promise;
|
||||
|
||||
/**
|
||||
* Represents the completion of an asynchronous operation
|
||||
*/
|
||||
interface Promise<T> {
|
||||
/**
|
||||
* Attaches callbacks for the resolution and/or rejection of the Promise.
|
||||
* @param onfulfilled The callback to execute when the Promise is resolved.
|
||||
* @param onrejected The callback to execute when the Promise is rejected.
|
||||
* @returns A Promise for the completion of which ever callback is executed.
|
||||
*/
|
||||
then<TResult1 = T, TResult2 = never>(onfulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | undefined | null): Promise<TResult1 | TResult2>;
|
||||
|
||||
/**
|
||||
* Attaches a callback for only the rejection of the Promise.
|
||||
* @param onrejected The callback to execute when the Promise is rejected.
|
||||
* @returns A Promise for the completion of the callback.
|
||||
*/
|
||||
catch<TResult = never>(onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | undefined | null): Promise<T | TResult>;
|
||||
|
||||
/**
|
||||
* When the promise is settled, whether fulfilled or rejected, execute the
|
||||
* specified callback function. This provides a way for code that must be
|
||||
* executed once the Promise has been dealt with to be run whether the promise
|
||||
* was fulfilled successfully or rejected.
|
||||
* @param onfinally Function called when the Promise is settled
|
||||
* @returns A Promise whose finally handler is set to the specified function, onfinally.
|
||||
*/
|
||||
finally<TResult = never>(onfinally?: (() => TResult | PromiseLike<TResult>) | undefined | null): Promise<T | TResult>;
|
||||
}
|
||||
|
||||
interface PromiseConstructor {
|
||||
/**
|
||||
* A reference to the prototype.
|
||||
*/
|
||||
readonly prototype: Promise<any>;
|
||||
|
||||
/**
|
||||
* Creates a new Promise.
|
||||
* @param executor A callback used to initialize the promise. This callback is passed two arguments:
|
||||
* a resolve callback used resolve the promise with a value or the result of another promise,
|
||||
* and a reject callback used to reject the promise with a provided reason or error.
|
||||
*/
|
||||
new <T>(executor: (resolve: (value?: T | PromiseLike<T>) => void, reject: (reason?: any) => void) => void): Promise<T>;
|
||||
|
||||
/**
|
||||
* Creates a Promise that is resolved with an array of results when all of the provided Promises
|
||||
* resolve, or rejected when any Promise is rejected.
|
||||
* @param values An array of Promises.
|
||||
* @returns A new Promise.
|
||||
*/
|
||||
all<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike<T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>, T8 | PromiseLike<T8>, T9 | PromiseLike<T9>, T10 | PromiseLike<T10>]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]>;
|
||||
|
||||
/**
|
||||
* Creates a Promise that is resolved with an array of results when all of the provided Promises
|
||||
* resolve, or rejected when any Promise is rejected.
|
||||
* @param values An array of Promises.
|
||||
* @returns A new Promise.
|
||||
*/
|
||||
all<T1, T2, T3, T4, T5, T6, T7, T8, T9>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike<T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>, T8 | PromiseLike<T8>, T9 | PromiseLike<T9>]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9]>;
|
||||
|
||||
/**
|
||||
* Creates a Promise that is resolved with an array of results when all of the provided Promises
|
||||
* resolve, or rejected when any Promise is rejected.
|
||||
* @param values An array of Promises.
|
||||
* @returns A new Promise.
|
||||
*/
|
||||
all<T1, T2, T3, T4, T5, T6, T7, T8>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike<T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>, T8 | PromiseLike<T8>]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8]>;
|
||||
|
||||
/**
|
||||
* Creates a Promise that is resolved with an array of results when all of the provided Promises
|
||||
* resolve, or rejected when any Promise is rejected.
|
||||
* @param values An array of Promises.
|
||||
* @returns A new Promise.
|
||||
*/
|
||||
all<T1, T2, T3, T4, T5, T6, T7>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike<T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>]): Promise<[T1, T2, T3, T4, T5, T6, T7]>;
|
||||
|
||||
/**
|
||||
* Creates a Promise that is resolved with an array of results when all of the provided Promises
|
||||
* resolve, or rejected when any Promise is rejected.
|
||||
* @param values An array of Promises.
|
||||
* @returns A new Promise.
|
||||
*/
|
||||
all<T1, T2, T3, T4, T5, T6>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike<T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>]): Promise<[T1, T2, T3, T4, T5, T6]>;
|
||||
|
||||
/**
|
||||
* Creates a Promise that is resolved with an array of results when all of the provided Promises
|
||||
* resolve, or rejected when any Promise is rejected.
|
||||
* @param values An array of Promises.
|
||||
* @returns A new Promise.
|
||||
*/
|
||||
all<T1, T2, T3, T4, T5>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike<T4>, T5 | PromiseLike<T5>]): Promise<[T1, T2, T3, T4, T5]>;
|
||||
|
||||
/**
|
||||
* Creates a Promise that is resolved with an array of results when all of the provided Promises
|
||||
* resolve, or rejected when any Promise is rejected.
|
||||
* @param values An array of Promises.
|
||||
* @returns A new Promise.
|
||||
*/
|
||||
all<T1, T2, T3, T4>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike<T4>]): Promise<[T1, T2, T3, T4]>;
|
||||
|
||||
/**
|
||||
* Creates a Promise that is resolved with an array of results when all of the provided Promises
|
||||
* resolve, or rejected when any Promise is rejected.
|
||||
* @param values An array of Promises.
|
||||
* @returns A new Promise.
|
||||
*/
|
||||
all<T1, T2, T3>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>]): Promise<[T1, T2, T3]>;
|
||||
|
||||
/**
|
||||
* Creates a Promise that is resolved with an array of results when all of the provided Promises
|
||||
* resolve, or rejected when any Promise is rejected.
|
||||
* @param values An array of Promises.
|
||||
* @returns A new Promise.
|
||||
*/
|
||||
all<T1, T2>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>]): Promise<[T1, T2]>;
|
||||
|
||||
/**
|
||||
* Creates a Promise that is resolved with an array of results when all of the provided Promises
|
||||
* resolve, or rejected when any Promise is rejected.
|
||||
* @param values An array of Promises.
|
||||
* @returns A new Promise.
|
||||
*/
|
||||
all<T>(values: (T | PromiseLike<T>)[]): Promise<T[]>;
|
||||
|
||||
/**
|
||||
* Creates a Promise that is resolved or rejected when any of the provided Promises are resolved
|
||||
* or rejected.
|
||||
* @param values An array of Promises.
|
||||
* @returns A new Promise.
|
||||
*/
|
||||
race<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike<T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>, T8 | PromiseLike<T8>, T9 | PromiseLike<T9>, T10 | PromiseLike<T10>]): Promise<T1 | T2 | T3 | T4 | T5 | T6 | T7 | T8 | T9 | T10>;
|
||||
|
||||
/**
|
||||
* Creates a Promise that is resolved or rejected when any of the provided Promises are resolved
|
||||
* or rejected.
|
||||
* @param values An array of Promises.
|
||||
* @returns A new Promise.
|
||||
*/
|
||||
race<T1, T2, T3, T4, T5, T6, T7, T8, T9>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike<T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>, T8 | PromiseLike<T8>, T9 | PromiseLike<T9>]): Promise<T1 | T2 | T3 | T4 | T5 | T6 | T7 | T8 | T9>;
|
||||
|
||||
/**
|
||||
* Creates a Promise that is resolved or rejected when any of the provided Promises are resolved
|
||||
* or rejected.
|
||||
* @param values An array of Promises.
|
||||
* @returns A new Promise.
|
||||
*/
|
||||
race<T1, T2, T3, T4, T5, T6, T7, T8>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike<T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>, T8 | PromiseLike<T8>]): Promise<T1 | T2 | T3 | T4 | T5 | T6 | T7 | T8>;
|
||||
|
||||
/**
|
||||
* Creates a Promise that is resolved or rejected when any of the provided Promises are resolved
|
||||
* or rejected.
|
||||
* @param values An array of Promises.
|
||||
* @returns A new Promise.
|
||||
*/
|
||||
race<T1, T2, T3, T4, T5, T6, T7>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike<T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>]): Promise<T1 | T2 | T3 | T4 | T5 | T6 | T7>;
|
||||
|
||||
/**
|
||||
* Creates a Promise that is resolved or rejected when any of the provided Promises are resolved
|
||||
* or rejected.
|
||||
* @param values An array of Promises.
|
||||
* @returns A new Promise.
|
||||
*/
|
||||
race<T1, T2, T3, T4, T5, T6>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike<T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>]): Promise<T1 | T2 | T3 | T4 | T5 | T6>;
|
||||
|
||||
/**
|
||||
* Creates a Promise that is resolved or rejected when any of the provided Promises are resolved
|
||||
* or rejected.
|
||||
* @param values An array of Promises.
|
||||
* @returns A new Promise.
|
||||
*/
|
||||
race<T1, T2, T3, T4, T5>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike<T4>, T5 | PromiseLike<T5>]): Promise<T1 | T2 | T3 | T4 | T5>;
|
||||
|
||||
/**
|
||||
* Creates a Promise that is resolved or rejected when any of the provided Promises are resolved
|
||||
* or rejected.
|
||||
* @param values An array of Promises.
|
||||
* @returns A new Promise.
|
||||
*/
|
||||
race<T1, T2, T3, T4>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike<T4>]): Promise<T1 | T2 | T3 | T4>;
|
||||
|
||||
/**
|
||||
* Creates a Promise that is resolved or rejected when any of the provided Promises are resolved
|
||||
* or rejected.
|
||||
* @param values An array of Promises.
|
||||
* @returns A new Promise.
|
||||
*/
|
||||
race<T1, T2, T3>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>]): Promise<T1 | T2 | T3>;
|
||||
|
||||
/**
|
||||
* Creates a Promise that is resolved or rejected when any of the provided Promises are resolved
|
||||
* or rejected.
|
||||
* @param values An array of Promises.
|
||||
* @returns A new Promise.
|
||||
*/
|
||||
race<T1, T2>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>]): Promise<T1 | T2>;
|
||||
|
||||
/**
|
||||
* Creates a Promise that is resolved or rejected when any of the provided Promises are resolved
|
||||
* or rejected.
|
||||
* @param values An array of Promises.
|
||||
* @returns A new Promise.
|
||||
*/
|
||||
race<T>(values: (T | PromiseLike<T>)[]): Promise<T>;
|
||||
|
||||
/**
|
||||
* Creates a new rejected promise for the provided reason.
|
||||
* @param reason The reason the promise was rejected.
|
||||
* @returns A new rejected Promise.
|
||||
*/
|
||||
reject(reason: any): Promise<never>;
|
||||
|
||||
/**
|
||||
* Creates a new rejected promise for the provided reason.
|
||||
* @param reason The reason the promise was rejected.
|
||||
* @returns A new rejected Promise.
|
||||
*/
|
||||
reject<T>(reason: any): Promise<T>;
|
||||
|
||||
/**
|
||||
* Creates a new resolved promise for the provided value.
|
||||
* @param value A promise.
|
||||
* @returns A promise whose internal state matches the provided promise.
|
||||
*/
|
||||
resolve<T>(value: T | PromiseLike<T>): Promise<T>;
|
||||
|
||||
/**
|
||||
* Creates a new resolved promise .
|
||||
* @returns A resolved promise.
|
||||
*/
|
||||
resolve(): Promise<void>;
|
||||
}
|
||||
|
||||
declare const Promise: PromiseConstructor;
|
||||
export default Promise;
|
69
node_modules/lie/package.json
generated
vendored
Normal file
69
node_modules/lie/package.json
generated
vendored
Normal file
@ -0,0 +1,69 @@
|
||||
{
|
||||
"name": "lie",
|
||||
"version": "3.3.0",
|
||||
"description": "A basic but performant promise implementation",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/calvinmetcalf/lie.git"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/calvinmetcalf/lie/issues"
|
||||
},
|
||||
"keywords": [
|
||||
"lie",
|
||||
"promise",
|
||||
"async",
|
||||
"aplus"
|
||||
],
|
||||
"main": "lib/index.js",
|
||||
"scripts": {
|
||||
"pretest": "npm run build",
|
||||
"test": "npm run jshint && mocha -R nyan ./test/cover.js && tsc --noEmit ./test/types.ts",
|
||||
"build-node": "copyfiles -f src/index.js lib && browserify-transform-cli inline-process-browser unreachable-branch-transform es3ify < src/index.js > lib/browser.js",
|
||||
"build-js": "browserify -s Promise -p bundle-collapser/plugin . | derequire > ./dist/lie.js",
|
||||
"build-min": "uglifyjs ./dist/lie.js -mc > ./dist/lie.min.js",
|
||||
"build-poly-js": "browserify -p bundle-collapser/plugin ./polyfill.js | derequire > ./dist/lie.polyfill.js",
|
||||
"build-poly-min": "uglifyjs ./dist/lie.polyfill.js -mc > ./dist/lie.polyfill.min.js",
|
||||
"build-poly": "npm run build-poly-js && npm run build-poly-min",
|
||||
"build": "npm run build-node && npm run build-js && npm run build-min && npm run build-poly",
|
||||
"prebuild": "rimraf lib dist && mkdirp lib dist",
|
||||
"cover": "istanbul cover _mocha ./test/cover.js -- -R spec && istanbul check-coverage --lines 100 --function 100 --statements 100 --branches 100",
|
||||
"jshint": "jshint src",
|
||||
"node": "mocha -R spec ./test/cover.js",
|
||||
"browser": "browserify test/cover.js > test/browser.js && mocha-phantomjs test/test.html"
|
||||
},
|
||||
"devDependencies": {
|
||||
"browserify": "^13.0.0",
|
||||
"browserify-transform-cli": "^1.1.1",
|
||||
"bundle-collapser": "^1.2.1",
|
||||
"copyfiles": "^1.0.0",
|
||||
"derequire": "^1.2.0",
|
||||
"es3ify": "^0.2.2",
|
||||
"inline-process-browser": "^1.0.0",
|
||||
"istanbul": "^0.2.6",
|
||||
"jshint": "^2.4.4",
|
||||
"mkdirp": "^0.5.1",
|
||||
"mocha": "^1.18.0",
|
||||
"mocha-phantomjs": "~3.5.0",
|
||||
"phantomjs": "^1.9.9",
|
||||
"promises-aplus-tests": "calvinmetcalf/promises-tests#phantom",
|
||||
"rimraf": "^2.5.4",
|
||||
"typescript": "^2.7.1",
|
||||
"uglify-js": "^2.4.13",
|
||||
"unreachable-branch-transform": "^0.3.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"immediate": "~3.0.5"
|
||||
},
|
||||
"browser": {
|
||||
"./lib/index.js": "./lib/browser.js"
|
||||
},
|
||||
"files": [
|
||||
"lib",
|
||||
"dist",
|
||||
"polyfill.js",
|
||||
"lie.d.ts"
|
||||
],
|
||||
"types": "lie.d.ts"
|
||||
}
|
4
node_modules/lie/polyfill.js
generated
vendored
Normal file
4
node_modules/lie/polyfill.js
generated
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
'use strict';
|
||||
if (typeof global.Promise !== 'function') {
|
||||
global.Promise = require('./lib');
|
||||
}
|
38
node_modules/readable-stream/CONTRIBUTING.md
generated
vendored
Normal file
38
node_modules/readable-stream/CONTRIBUTING.md
generated
vendored
Normal file
@ -0,0 +1,38 @@
|
||||
# Developer's Certificate of Origin 1.1
|
||||
|
||||
By making a contribution to this project, I certify that:
|
||||
|
||||
* (a) The contribution was created in whole or in part by me and I
|
||||
have the right to submit it under the open source license
|
||||
indicated in the file; or
|
||||
|
||||
* (b) The contribution is based upon previous work that, to the best
|
||||
of my knowledge, is covered under an appropriate open source
|
||||
license and I have the right under that license to submit that
|
||||
work with modifications, whether created in whole or in part
|
||||
by me, under the same open source license (unless I am
|
||||
permitted to submit under a different license), as indicated
|
||||
in the file; or
|
||||
|
||||
* (c) The contribution was provided directly to me by some other
|
||||
person who certified (a), (b) or (c) and I have not modified
|
||||
it.
|
||||
|
||||
* (d) I understand and agree that this project and the contribution
|
||||
are public and that a record of the contribution (including all
|
||||
personal information I submit with it, including my sign-off) is
|
||||
maintained indefinitely and may be redistributed consistent with
|
||||
this project or the open source license(s) involved.
|
||||
|
||||
## Moderation Policy
|
||||
|
||||
The [Node.js Moderation Policy] applies to this WG.
|
||||
|
||||
## Code of Conduct
|
||||
|
||||
The [Node.js Code of Conduct][] applies to this WG.
|
||||
|
||||
[Node.js Code of Conduct]:
|
||||
https://github.com/nodejs/node/blob/master/CODE_OF_CONDUCT.md
|
||||
[Node.js Moderation Policy]:
|
||||
https://github.com/nodejs/TSC/blob/master/Moderation-Policy.md
|
136
node_modules/readable-stream/GOVERNANCE.md
generated
vendored
Normal file
136
node_modules/readable-stream/GOVERNANCE.md
generated
vendored
Normal file
@ -0,0 +1,136 @@
|
||||
### Streams Working Group
|
||||
|
||||
The Node.js Streams is jointly governed by a Working Group
|
||||
(WG)
|
||||
that is responsible for high-level guidance of the project.
|
||||
|
||||
The WG has final authority over this project including:
|
||||
|
||||
* Technical direction
|
||||
* Project governance and process (including this policy)
|
||||
* Contribution policy
|
||||
* GitHub repository hosting
|
||||
* Conduct guidelines
|
||||
* Maintaining the list of additional Collaborators
|
||||
|
||||
For the current list of WG members, see the project
|
||||
[README.md](./README.md#current-project-team-members).
|
||||
|
||||
### Collaborators
|
||||
|
||||
The readable-stream GitHub repository is
|
||||
maintained by the WG and additional Collaborators who are added by the
|
||||
WG on an ongoing basis.
|
||||
|
||||
Individuals making significant and valuable contributions are made
|
||||
Collaborators and given commit-access to the project. These
|
||||
individuals are identified by the WG and their addition as
|
||||
Collaborators is discussed during the WG meeting.
|
||||
|
||||
_Note:_ If you make a significant contribution and are not considered
|
||||
for commit-access log an issue or contact a WG member directly and it
|
||||
will be brought up in the next WG meeting.
|
||||
|
||||
Modifications of the contents of the readable-stream repository are
|
||||
made on
|
||||
a collaborative basis. Anybody with a GitHub account may propose a
|
||||
modification via pull request and it will be considered by the project
|
||||
Collaborators. All pull requests must be reviewed and accepted by a
|
||||
Collaborator with sufficient expertise who is able to take full
|
||||
responsibility for the change. In the case of pull requests proposed
|
||||
by an existing Collaborator, an additional Collaborator is required
|
||||
for sign-off. Consensus should be sought if additional Collaborators
|
||||
participate and there is disagreement around a particular
|
||||
modification. See _Consensus Seeking Process_ below for further detail
|
||||
on the consensus model used for governance.
|
||||
|
||||
Collaborators may opt to elevate significant or controversial
|
||||
modifications, or modifications that have not found consensus to the
|
||||
WG for discussion by assigning the ***WG-agenda*** tag to a pull
|
||||
request or issue. The WG should serve as the final arbiter where
|
||||
required.
|
||||
|
||||
For the current list of Collaborators, see the project
|
||||
[README.md](./README.md#members).
|
||||
|
||||
### WG Membership
|
||||
|
||||
WG seats are not time-limited. There is no fixed size of the WG.
|
||||
However, the expected target is between 6 and 12, to ensure adequate
|
||||
coverage of important areas of expertise, balanced with the ability to
|
||||
make decisions efficiently.
|
||||
|
||||
There is no specific set of requirements or qualifications for WG
|
||||
membership beyond these rules.
|
||||
|
||||
The WG may add additional members to the WG by unanimous consensus.
|
||||
|
||||
A WG member may be removed from the WG by voluntary resignation, or by
|
||||
unanimous consensus of all other WG members.
|
||||
|
||||
Changes to WG membership should be posted in the agenda, and may be
|
||||
suggested as any other agenda item (see "WG Meetings" below).
|
||||
|
||||
If an addition or removal is proposed during a meeting, and the full
|
||||
WG is not in attendance to participate, then the addition or removal
|
||||
is added to the agenda for the subsequent meeting. This is to ensure
|
||||
that all members are given the opportunity to participate in all
|
||||
membership decisions. If a WG member is unable to attend a meeting
|
||||
where a planned membership decision is being made, then their consent
|
||||
is assumed.
|
||||
|
||||
No more than 1/3 of the WG members may be affiliated with the same
|
||||
employer. If removal or resignation of a WG member, or a change of
|
||||
employment by a WG member, creates a situation where more than 1/3 of
|
||||
the WG membership shares an employer, then the situation must be
|
||||
immediately remedied by the resignation or removal of one or more WG
|
||||
members affiliated with the over-represented employer(s).
|
||||
|
||||
### WG Meetings
|
||||
|
||||
The WG meets occasionally on a Google Hangout On Air. A designated moderator
|
||||
approved by the WG runs the meeting. Each meeting should be
|
||||
published to YouTube.
|
||||
|
||||
Items are added to the WG agenda that are considered contentious or
|
||||
are modifications of governance, contribution policy, WG membership,
|
||||
or release process.
|
||||
|
||||
The intention of the agenda is not to approve or review all patches;
|
||||
that should happen continuously on GitHub and be handled by the larger
|
||||
group of Collaborators.
|
||||
|
||||
Any community member or contributor can ask that something be added to
|
||||
the next meeting's agenda by logging a GitHub Issue. Any Collaborator,
|
||||
WG member or the moderator can add the item to the agenda by adding
|
||||
the ***WG-agenda*** tag to the issue.
|
||||
|
||||
Prior to each WG meeting the moderator will share the Agenda with
|
||||
members of the WG. WG members can add any items they like to the
|
||||
agenda at the beginning of each meeting. The moderator and the WG
|
||||
cannot veto or remove items.
|
||||
|
||||
The WG may invite persons or representatives from certain projects to
|
||||
participate in a non-voting capacity.
|
||||
|
||||
The moderator is responsible for summarizing the discussion of each
|
||||
agenda item and sends it as a pull request after the meeting.
|
||||
|
||||
### Consensus Seeking Process
|
||||
|
||||
The WG follows a
|
||||
[Consensus
|
||||
Seeking](http://en.wikipedia.org/wiki/Consensus-seeking_decision-making)
|
||||
decision-making model.
|
||||
|
||||
When an agenda item has appeared to reach a consensus the moderator
|
||||
will ask "Does anyone object?" as a final call for dissent from the
|
||||
consensus.
|
||||
|
||||
If an agenda item cannot reach a consensus a WG member can call for
|
||||
either a closing vote or a vote to table the issue to the next
|
||||
meeting. The call for a vote must be seconded by a majority of the WG
|
||||
or else the discussion will continue. Simple majority wins.
|
||||
|
||||
Note that changes to WG membership require a majority consensus. See
|
||||
"WG Membership" above.
|
47
node_modules/readable-stream/LICENSE
generated
vendored
Normal file
47
node_modules/readable-stream/LICENSE
generated
vendored
Normal file
@ -0,0 +1,47 @@
|
||||
Node.js is licensed for use as follows:
|
||||
|
||||
"""
|
||||
Copyright Node.js contributors. All rights reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to
|
||||
deal in the Software without restriction, including without limitation the
|
||||
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
sell copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
IN THE SOFTWARE.
|
||||
"""
|
||||
|
||||
This license applies to parts of Node.js originating from the
|
||||
https://github.com/joyent/node repository:
|
||||
|
||||
"""
|
||||
Copyright Joyent, Inc. and other Node contributors. All rights reserved.
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to
|
||||
deal in the Software without restriction, including without limitation the
|
||||
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
sell copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
IN THE SOFTWARE.
|
||||
"""
|
106
node_modules/readable-stream/README.md
generated
vendored
Normal file
106
node_modules/readable-stream/README.md
generated
vendored
Normal file
@ -0,0 +1,106 @@
|
||||
# readable-stream
|
||||
|
||||
***Node.js core streams for userland*** [](https://travis-ci.com/nodejs/readable-stream)
|
||||
|
||||
|
||||
[](https://nodei.co/npm/readable-stream/)
|
||||
[](https://nodei.co/npm/readable-stream/)
|
||||
|
||||
|
||||
[](https://saucelabs.com/u/readabe-stream)
|
||||
|
||||
```bash
|
||||
npm install --save readable-stream
|
||||
```
|
||||
|
||||
This package is a mirror of the streams implementations in Node.js.
|
||||
|
||||
Full documentation may be found on the [Node.js website](https://nodejs.org/dist/v10.19.0/docs/api/stream.html).
|
||||
|
||||
If you want to guarantee a stable streams base, regardless of what version of
|
||||
Node you, or the users of your libraries are using, use **readable-stream** *only* and avoid the *"stream"* module in Node-core, for background see [this blogpost](http://r.va.gg/2014/06/why-i-dont-use-nodes-core-stream-module.html).
|
||||
|
||||
As of version 2.0.0 **readable-stream** uses semantic versioning.
|
||||
|
||||
## Version 3.x.x
|
||||
|
||||
v3.x.x of `readable-stream` is a cut from Node 10. This version supports Node 6, 8, and 10, as well as evergreen browsers, IE 11 and latest Safari. The breaking changes introduced by v3 are composed by the combined breaking changes in [Node v9](https://nodejs.org/en/blog/release/v9.0.0/) and [Node v10](https://nodejs.org/en/blog/release/v10.0.0/), as follows:
|
||||
|
||||
1. Error codes: https://github.com/nodejs/node/pull/13310,
|
||||
https://github.com/nodejs/node/pull/13291,
|
||||
https://github.com/nodejs/node/pull/16589,
|
||||
https://github.com/nodejs/node/pull/15042,
|
||||
https://github.com/nodejs/node/pull/15665,
|
||||
https://github.com/nodejs/readable-stream/pull/344
|
||||
2. 'readable' have precedence over flowing
|
||||
https://github.com/nodejs/node/pull/18994
|
||||
3. make virtual methods errors consistent
|
||||
https://github.com/nodejs/node/pull/18813
|
||||
4. updated streams error handling
|
||||
https://github.com/nodejs/node/pull/18438
|
||||
5. writable.end should return this.
|
||||
https://github.com/nodejs/node/pull/18780
|
||||
6. readable continues to read when push('')
|
||||
https://github.com/nodejs/node/pull/18211
|
||||
7. add custom inspect to BufferList
|
||||
https://github.com/nodejs/node/pull/17907
|
||||
8. always defer 'readable' with nextTick
|
||||
https://github.com/nodejs/node/pull/17979
|
||||
|
||||
## Version 2.x.x
|
||||
v2.x.x of `readable-stream` is a cut of the stream module from Node 8 (there have been no semver-major changes from Node 4 to 8). This version supports all Node.js versions from 0.8, as well as evergreen browsers and IE 10 & 11.
|
||||
|
||||
### Big Thanks
|
||||
|
||||
Cross-browser Testing Platform and Open Source <3 Provided by [Sauce Labs][sauce]
|
||||
|
||||
# Usage
|
||||
|
||||
You can swap your `require('stream')` with `require('readable-stream')`
|
||||
without any changes, if you are just using one of the main classes and
|
||||
functions.
|
||||
|
||||
```js
|
||||
const {
|
||||
Readable,
|
||||
Writable,
|
||||
Transform,
|
||||
Duplex,
|
||||
pipeline,
|
||||
finished
|
||||
} = require('readable-stream')
|
||||
````
|
||||
|
||||
Note that `require('stream')` will return `Stream`, while
|
||||
`require('readable-stream')` will return `Readable`. We discourage using
|
||||
whatever is exported directly, but rather use one of the properties as
|
||||
shown in the example above.
|
||||
|
||||
# Streams Working Group
|
||||
|
||||
`readable-stream` is maintained by the Streams Working Group, which
|
||||
oversees the development and maintenance of the Streams API within
|
||||
Node.js. The responsibilities of the Streams Working Group include:
|
||||
|
||||
* Addressing stream issues on the Node.js issue tracker.
|
||||
* Authoring and editing stream documentation within the Node.js project.
|
||||
* Reviewing changes to stream subclasses within the Node.js project.
|
||||
* Redirecting changes to streams from the Node.js project to this
|
||||
project.
|
||||
* Assisting in the implementation of stream providers within Node.js.
|
||||
* Recommending versions of `readable-stream` to be included in Node.js.
|
||||
* Messaging about the future of streams to give the community advance
|
||||
notice of changes.
|
||||
|
||||
<a name="members"></a>
|
||||
## Team Members
|
||||
|
||||
* **Calvin Metcalf** ([@calvinmetcalf](https://github.com/calvinmetcalf)) <calvin.metcalf@gmail.com>
|
||||
- Release GPG key: F3EF5F62A87FC27A22E643F714CE4FF5015AA242
|
||||
* **Mathias Buus** ([@mafintosh](https://github.com/mafintosh)) <mathiasbuus@gmail.com>
|
||||
* **Matteo Collina** ([@mcollina](https://github.com/mcollina)) <matteo.collina@gmail.com>
|
||||
- Release GPG key: 3ABC01543F22DD2239285CDD818674489FBC127E
|
||||
* **Irina Shestak** ([@lrlna](https://github.com/lrlna)) <shestak.irina@gmail.com>
|
||||
* **Yoshua Wyuts** ([@yoshuawuyts](https://github.com/yoshuawuyts)) <yoshuawuyts@gmail.com>
|
||||
|
||||
[sauce]: https://saucelabs.com
|
127
node_modules/readable-stream/errors-browser.js
generated
vendored
Normal file
127
node_modules/readable-stream/errors-browser.js
generated
vendored
Normal file
@ -0,0 +1,127 @@
|
||||
'use strict';
|
||||
|
||||
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
|
||||
|
||||
var codes = {};
|
||||
|
||||
function createErrorType(code, message, Base) {
|
||||
if (!Base) {
|
||||
Base = Error;
|
||||
}
|
||||
|
||||
function getMessage(arg1, arg2, arg3) {
|
||||
if (typeof message === 'string') {
|
||||
return message;
|
||||
} else {
|
||||
return message(arg1, arg2, arg3);
|
||||
}
|
||||
}
|
||||
|
||||
var NodeError =
|
||||
/*#__PURE__*/
|
||||
function (_Base) {
|
||||
_inheritsLoose(NodeError, _Base);
|
||||
|
||||
function NodeError(arg1, arg2, arg3) {
|
||||
return _Base.call(this, getMessage(arg1, arg2, arg3)) || this;
|
||||
}
|
||||
|
||||
return NodeError;
|
||||
}(Base);
|
||||
|
||||
NodeError.prototype.name = Base.name;
|
||||
NodeError.prototype.code = code;
|
||||
codes[code] = NodeError;
|
||||
} // https://github.com/nodejs/node/blob/v10.8.0/lib/internal/errors.js
|
||||
|
||||
|
||||
function oneOf(expected, thing) {
|
||||
if (Array.isArray(expected)) {
|
||||
var len = expected.length;
|
||||
expected = expected.map(function (i) {
|
||||
return String(i);
|
||||
});
|
||||
|
||||
if (len > 2) {
|
||||
return "one of ".concat(thing, " ").concat(expected.slice(0, len - 1).join(', '), ", or ") + expected[len - 1];
|
||||
} else if (len === 2) {
|
||||
return "one of ".concat(thing, " ").concat(expected[0], " or ").concat(expected[1]);
|
||||
} else {
|
||||
return "of ".concat(thing, " ").concat(expected[0]);
|
||||
}
|
||||
} else {
|
||||
return "of ".concat(thing, " ").concat(String(expected));
|
||||
}
|
||||
} // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/startsWith
|
||||
|
||||
|
||||
function startsWith(str, search, pos) {
|
||||
return str.substr(!pos || pos < 0 ? 0 : +pos, search.length) === search;
|
||||
} // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/endsWith
|
||||
|
||||
|
||||
function endsWith(str, search, this_len) {
|
||||
if (this_len === undefined || this_len > str.length) {
|
||||
this_len = str.length;
|
||||
}
|
||||
|
||||
return str.substring(this_len - search.length, this_len) === search;
|
||||
} // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/includes
|
||||
|
||||
|
||||
function includes(str, search, start) {
|
||||
if (typeof start !== 'number') {
|
||||
start = 0;
|
||||
}
|
||||
|
||||
if (start + search.length > str.length) {
|
||||
return false;
|
||||
} else {
|
||||
return str.indexOf(search, start) !== -1;
|
||||
}
|
||||
}
|
||||
|
||||
createErrorType('ERR_INVALID_OPT_VALUE', function (name, value) {
|
||||
return 'The value "' + value + '" is invalid for option "' + name + '"';
|
||||
}, TypeError);
|
||||
createErrorType('ERR_INVALID_ARG_TYPE', function (name, expected, actual) {
|
||||
// determiner: 'must be' or 'must not be'
|
||||
var determiner;
|
||||
|
||||
if (typeof expected === 'string' && startsWith(expected, 'not ')) {
|
||||
determiner = 'must not be';
|
||||
expected = expected.replace(/^not /, '');
|
||||
} else {
|
||||
determiner = 'must be';
|
||||
}
|
||||
|
||||
var msg;
|
||||
|
||||
if (endsWith(name, ' argument')) {
|
||||
// For cases like 'first argument'
|
||||
msg = "The ".concat(name, " ").concat(determiner, " ").concat(oneOf(expected, 'type'));
|
||||
} else {
|
||||
var type = includes(name, '.') ? 'property' : 'argument';
|
||||
msg = "The \"".concat(name, "\" ").concat(type, " ").concat(determiner, " ").concat(oneOf(expected, 'type'));
|
||||
}
|
||||
|
||||
msg += ". Received type ".concat(typeof actual);
|
||||
return msg;
|
||||
}, TypeError);
|
||||
createErrorType('ERR_STREAM_PUSH_AFTER_EOF', 'stream.push() after EOF');
|
||||
createErrorType('ERR_METHOD_NOT_IMPLEMENTED', function (name) {
|
||||
return 'The ' + name + ' method is not implemented';
|
||||
});
|
||||
createErrorType('ERR_STREAM_PREMATURE_CLOSE', 'Premature close');
|
||||
createErrorType('ERR_STREAM_DESTROYED', function (name) {
|
||||
return 'Cannot call ' + name + ' after a stream was destroyed';
|
||||
});
|
||||
createErrorType('ERR_MULTIPLE_CALLBACK', 'Callback called multiple times');
|
||||
createErrorType('ERR_STREAM_CANNOT_PIPE', 'Cannot pipe, not readable');
|
||||
createErrorType('ERR_STREAM_WRITE_AFTER_END', 'write after end');
|
||||
createErrorType('ERR_STREAM_NULL_VALUES', 'May not write null values to stream', TypeError);
|
||||
createErrorType('ERR_UNKNOWN_ENCODING', function (arg) {
|
||||
return 'Unknown encoding: ' + arg;
|
||||
}, TypeError);
|
||||
createErrorType('ERR_STREAM_UNSHIFT_AFTER_END_EVENT', 'stream.unshift() after end event');
|
||||
module.exports.codes = codes;
|
116
node_modules/readable-stream/errors.js
generated
vendored
Normal file
116
node_modules/readable-stream/errors.js
generated
vendored
Normal file
@ -0,0 +1,116 @@
|
||||
'use strict';
|
||||
|
||||
const codes = {};
|
||||
|
||||
function createErrorType(code, message, Base) {
|
||||
if (!Base) {
|
||||
Base = Error
|
||||
}
|
||||
|
||||
function getMessage (arg1, arg2, arg3) {
|
||||
if (typeof message === 'string') {
|
||||
return message
|
||||
} else {
|
||||
return message(arg1, arg2, arg3)
|
||||
}
|
||||
}
|
||||
|
||||
class NodeError extends Base {
|
||||
constructor (arg1, arg2, arg3) {
|
||||
super(getMessage(arg1, arg2, arg3));
|
||||
}
|
||||
}
|
||||
|
||||
NodeError.prototype.name = Base.name;
|
||||
NodeError.prototype.code = code;
|
||||
|
||||
codes[code] = NodeError;
|
||||
}
|
||||
|
||||
// https://github.com/nodejs/node/blob/v10.8.0/lib/internal/errors.js
|
||||
function oneOf(expected, thing) {
|
||||
if (Array.isArray(expected)) {
|
||||
const len = expected.length;
|
||||
expected = expected.map((i) => String(i));
|
||||
if (len > 2) {
|
||||
return `one of ${thing} ${expected.slice(0, len - 1).join(', ')}, or ` +
|
||||
expected[len - 1];
|
||||
} else if (len === 2) {
|
||||
return `one of ${thing} ${expected[0]} or ${expected[1]}`;
|
||||
} else {
|
||||
return `of ${thing} ${expected[0]}`;
|
||||
}
|
||||
} else {
|
||||
return `of ${thing} ${String(expected)}`;
|
||||
}
|
||||
}
|
||||
|
||||
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/startsWith
|
||||
function startsWith(str, search, pos) {
|
||||
return str.substr(!pos || pos < 0 ? 0 : +pos, search.length) === search;
|
||||
}
|
||||
|
||||
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/endsWith
|
||||
function endsWith(str, search, this_len) {
|
||||
if (this_len === undefined || this_len > str.length) {
|
||||
this_len = str.length;
|
||||
}
|
||||
return str.substring(this_len - search.length, this_len) === search;
|
||||
}
|
||||
|
||||
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/includes
|
||||
function includes(str, search, start) {
|
||||
if (typeof start !== 'number') {
|
||||
start = 0;
|
||||
}
|
||||
|
||||
if (start + search.length > str.length) {
|
||||
return false;
|
||||
} else {
|
||||
return str.indexOf(search, start) !== -1;
|
||||
}
|
||||
}
|
||||
|
||||
createErrorType('ERR_INVALID_OPT_VALUE', function (name, value) {
|
||||
return 'The value "' + value + '" is invalid for option "' + name + '"'
|
||||
}, TypeError);
|
||||
createErrorType('ERR_INVALID_ARG_TYPE', function (name, expected, actual) {
|
||||
// determiner: 'must be' or 'must not be'
|
||||
let determiner;
|
||||
if (typeof expected === 'string' && startsWith(expected, 'not ')) {
|
||||
determiner = 'must not be';
|
||||
expected = expected.replace(/^not /, '');
|
||||
} else {
|
||||
determiner = 'must be';
|
||||
}
|
||||
|
||||
let msg;
|
||||
if (endsWith(name, ' argument')) {
|
||||
// For cases like 'first argument'
|
||||
msg = `The ${name} ${determiner} ${oneOf(expected, 'type')}`;
|
||||
} else {
|
||||
const type = includes(name, '.') ? 'property' : 'argument';
|
||||
msg = `The "${name}" ${type} ${determiner} ${oneOf(expected, 'type')}`;
|
||||
}
|
||||
|
||||
msg += `. Received type ${typeof actual}`;
|
||||
return msg;
|
||||
}, TypeError);
|
||||
createErrorType('ERR_STREAM_PUSH_AFTER_EOF', 'stream.push() after EOF');
|
||||
createErrorType('ERR_METHOD_NOT_IMPLEMENTED', function (name) {
|
||||
return 'The ' + name + ' method is not implemented'
|
||||
});
|
||||
createErrorType('ERR_STREAM_PREMATURE_CLOSE', 'Premature close');
|
||||
createErrorType('ERR_STREAM_DESTROYED', function (name) {
|
||||
return 'Cannot call ' + name + ' after a stream was destroyed';
|
||||
});
|
||||
createErrorType('ERR_MULTIPLE_CALLBACK', 'Callback called multiple times');
|
||||
createErrorType('ERR_STREAM_CANNOT_PIPE', 'Cannot pipe, not readable');
|
||||
createErrorType('ERR_STREAM_WRITE_AFTER_END', 'write after end');
|
||||
createErrorType('ERR_STREAM_NULL_VALUES', 'May not write null values to stream', TypeError);
|
||||
createErrorType('ERR_UNKNOWN_ENCODING', function (arg) {
|
||||
return 'Unknown encoding: ' + arg
|
||||
}, TypeError);
|
||||
createErrorType('ERR_STREAM_UNSHIFT_AFTER_END_EVENT', 'stream.unshift() after end event');
|
||||
|
||||
module.exports.codes = codes;
|
17
node_modules/readable-stream/experimentalWarning.js
generated
vendored
Normal file
17
node_modules/readable-stream/experimentalWarning.js
generated
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
'use strict'
|
||||
|
||||
var experimentalWarnings = new Set();
|
||||
|
||||
function emitExperimentalWarning(feature) {
|
||||
if (experimentalWarnings.has(feature)) return;
|
||||
var msg = feature + ' is an experimental feature. This feature could ' +
|
||||
'change at any time';
|
||||
experimentalWarnings.add(feature);
|
||||
process.emitWarning(msg, 'ExperimentalWarning');
|
||||
}
|
||||
|
||||
function noop() {}
|
||||
|
||||
module.exports.emitExperimentalWarning = process.emitWarning
|
||||
? emitExperimentalWarning
|
||||
: noop;
|
139
node_modules/readable-stream/lib/_stream_duplex.js
generated
vendored
Normal file
139
node_modules/readable-stream/lib/_stream_duplex.js
generated
vendored
Normal file
@ -0,0 +1,139 @@
|
||||
// Copyright Joyent, Inc. and other Node contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to permit
|
||||
// persons to whom the Software is furnished to do so, subject to the
|
||||
// following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
||||
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
||||
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
// a duplex stream is just a stream that is both readable and writable.
|
||||
// Since JS doesn't have multiple prototypal inheritance, this class
|
||||
// prototypally inherits from Readable, and then parasitically from
|
||||
// Writable.
|
||||
'use strict';
|
||||
/*<replacement>*/
|
||||
|
||||
var objectKeys = Object.keys || function (obj) {
|
||||
var keys = [];
|
||||
|
||||
for (var key in obj) {
|
||||
keys.push(key);
|
||||
}
|
||||
|
||||
return keys;
|
||||
};
|
||||
/*</replacement>*/
|
||||
|
||||
|
||||
module.exports = Duplex;
|
||||
|
||||
var Readable = require('./_stream_readable');
|
||||
|
||||
var Writable = require('./_stream_writable');
|
||||
|
||||
require('inherits')(Duplex, Readable);
|
||||
|
||||
{
|
||||
// Allow the keys array to be GC'ed.
|
||||
var keys = objectKeys(Writable.prototype);
|
||||
|
||||
for (var v = 0; v < keys.length; v++) {
|
||||
var method = keys[v];
|
||||
if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method];
|
||||
}
|
||||
}
|
||||
|
||||
function Duplex(options) {
|
||||
if (!(this instanceof Duplex)) return new Duplex(options);
|
||||
Readable.call(this, options);
|
||||
Writable.call(this, options);
|
||||
this.allowHalfOpen = true;
|
||||
|
||||
if (options) {
|
||||
if (options.readable === false) this.readable = false;
|
||||
if (options.writable === false) this.writable = false;
|
||||
|
||||
if (options.allowHalfOpen === false) {
|
||||
this.allowHalfOpen = false;
|
||||
this.once('end', onend);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Object.defineProperty(Duplex.prototype, 'writableHighWaterMark', {
|
||||
// making it explicit this property is not enumerable
|
||||
// because otherwise some prototype manipulation in
|
||||
// userland will fail
|
||||
enumerable: false,
|
||||
get: function get() {
|
||||
return this._writableState.highWaterMark;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(Duplex.prototype, 'writableBuffer', {
|
||||
// making it explicit this property is not enumerable
|
||||
// because otherwise some prototype manipulation in
|
||||
// userland will fail
|
||||
enumerable: false,
|
||||
get: function get() {
|
||||
return this._writableState && this._writableState.getBuffer();
|
||||
}
|
||||
});
|
||||
Object.defineProperty(Duplex.prototype, 'writableLength', {
|
||||
// making it explicit this property is not enumerable
|
||||
// because otherwise some prototype manipulation in
|
||||
// userland will fail
|
||||
enumerable: false,
|
||||
get: function get() {
|
||||
return this._writableState.length;
|
||||
}
|
||||
}); // the no-half-open enforcer
|
||||
|
||||
function onend() {
|
||||
// If the writable side ended, then we're ok.
|
||||
if (this._writableState.ended) return; // no more data can be written.
|
||||
// But allow more writes to happen in this tick.
|
||||
|
||||
process.nextTick(onEndNT, this);
|
||||
}
|
||||
|
||||
function onEndNT(self) {
|
||||
self.end();
|
||||
}
|
||||
|
||||
Object.defineProperty(Duplex.prototype, 'destroyed', {
|
||||
// making it explicit this property is not enumerable
|
||||
// because otherwise some prototype manipulation in
|
||||
// userland will fail
|
||||
enumerable: false,
|
||||
get: function get() {
|
||||
if (this._readableState === undefined || this._writableState === undefined) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return this._readableState.destroyed && this._writableState.destroyed;
|
||||
},
|
||||
set: function set(value) {
|
||||
// we ignore the value if the stream
|
||||
// has not been initialized yet
|
||||
if (this._readableState === undefined || this._writableState === undefined) {
|
||||
return;
|
||||
} // backward compatibility, the user is explicitly
|
||||
// managing destroyed
|
||||
|
||||
|
||||
this._readableState.destroyed = value;
|
||||
this._writableState.destroyed = value;
|
||||
}
|
||||
});
|
39
node_modules/readable-stream/lib/_stream_passthrough.js
generated
vendored
Normal file
39
node_modules/readable-stream/lib/_stream_passthrough.js
generated
vendored
Normal file
@ -0,0 +1,39 @@
|
||||
// Copyright Joyent, Inc. and other Node contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to permit
|
||||
// persons to whom the Software is furnished to do so, subject to the
|
||||
// following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
||||
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
||||
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
// a passthrough stream.
|
||||
// basically just the most minimal sort of Transform stream.
|
||||
// Every written chunk gets output as-is.
|
||||
'use strict';
|
||||
|
||||
module.exports = PassThrough;
|
||||
|
||||
var Transform = require('./_stream_transform');
|
||||
|
||||
require('inherits')(PassThrough, Transform);
|
||||
|
||||
function PassThrough(options) {
|
||||
if (!(this instanceof PassThrough)) return new PassThrough(options);
|
||||
Transform.call(this, options);
|
||||
}
|
||||
|
||||
PassThrough.prototype._transform = function (chunk, encoding, cb) {
|
||||
cb(null, chunk);
|
||||
};
|
1124
node_modules/readable-stream/lib/_stream_readable.js
generated
vendored
Normal file
1124
node_modules/readable-stream/lib/_stream_readable.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
201
node_modules/readable-stream/lib/_stream_transform.js
generated
vendored
Normal file
201
node_modules/readable-stream/lib/_stream_transform.js
generated
vendored
Normal file
@ -0,0 +1,201 @@
|
||||
// Copyright Joyent, Inc. and other Node contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to permit
|
||||
// persons to whom the Software is furnished to do so, subject to the
|
||||
// following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
||||
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
||||
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
// a transform stream is a readable/writable stream where you do
|
||||
// something with the data. Sometimes it's called a "filter",
|
||||
// but that's not a great name for it, since that implies a thing where
|
||||
// some bits pass through, and others are simply ignored. (That would
|
||||
// be a valid example of a transform, of course.)
|
||||
//
|
||||
// While the output is causally related to the input, it's not a
|
||||
// necessarily symmetric or synchronous transformation. For example,
|
||||
// a zlib stream might take multiple plain-text writes(), and then
|
||||
// emit a single compressed chunk some time in the future.
|
||||
//
|
||||
// Here's how this works:
|
||||
//
|
||||
// The Transform stream has all the aspects of the readable and writable
|
||||
// stream classes. When you write(chunk), that calls _write(chunk,cb)
|
||||
// internally, and returns false if there's a lot of pending writes
|
||||
// buffered up. When you call read(), that calls _read(n) until
|
||||
// there's enough pending readable data buffered up.
|
||||
//
|
||||
// In a transform stream, the written data is placed in a buffer. When
|
||||
// _read(n) is called, it transforms the queued up data, calling the
|
||||
// buffered _write cb's as it consumes chunks. If consuming a single
|
||||
// written chunk would result in multiple output chunks, then the first
|
||||
// outputted bit calls the readcb, and subsequent chunks just go into
|
||||
// the read buffer, and will cause it to emit 'readable' if necessary.
|
||||
//
|
||||
// This way, back-pressure is actually determined by the reading side,
|
||||
// since _read has to be called to start processing a new chunk. However,
|
||||
// a pathological inflate type of transform can cause excessive buffering
|
||||
// here. For example, imagine a stream where every byte of input is
|
||||
// interpreted as an integer from 0-255, and then results in that many
|
||||
// bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in
|
||||
// 1kb of data being output. In this case, you could write a very small
|
||||
// amount of input, and end up with a very large amount of output. In
|
||||
// such a pathological inflating mechanism, there'd be no way to tell
|
||||
// the system to stop doing the transform. A single 4MB write could
|
||||
// cause the system to run out of memory.
|
||||
//
|
||||
// However, even in such a pathological case, only a single written chunk
|
||||
// would be consumed, and then the rest would wait (un-transformed) until
|
||||
// the results of the previous transformed chunk were consumed.
|
||||
'use strict';
|
||||
|
||||
module.exports = Transform;
|
||||
|
||||
var _require$codes = require('../errors').codes,
|
||||
ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED,
|
||||
ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK,
|
||||
ERR_TRANSFORM_ALREADY_TRANSFORMING = _require$codes.ERR_TRANSFORM_ALREADY_TRANSFORMING,
|
||||
ERR_TRANSFORM_WITH_LENGTH_0 = _require$codes.ERR_TRANSFORM_WITH_LENGTH_0;
|
||||
|
||||
var Duplex = require('./_stream_duplex');
|
||||
|
||||
require('inherits')(Transform, Duplex);
|
||||
|
||||
function afterTransform(er, data) {
|
||||
var ts = this._transformState;
|
||||
ts.transforming = false;
|
||||
var cb = ts.writecb;
|
||||
|
||||
if (cb === null) {
|
||||
return this.emit('error', new ERR_MULTIPLE_CALLBACK());
|
||||
}
|
||||
|
||||
ts.writechunk = null;
|
||||
ts.writecb = null;
|
||||
if (data != null) // single equals check for both `null` and `undefined`
|
||||
this.push(data);
|
||||
cb(er);
|
||||
var rs = this._readableState;
|
||||
rs.reading = false;
|
||||
|
||||
if (rs.needReadable || rs.length < rs.highWaterMark) {
|
||||
this._read(rs.highWaterMark);
|
||||
}
|
||||
}
|
||||
|
||||
function Transform(options) {
|
||||
if (!(this instanceof Transform)) return new Transform(options);
|
||||
Duplex.call(this, options);
|
||||
this._transformState = {
|
||||
afterTransform: afterTransform.bind(this),
|
||||
needTransform: false,
|
||||
transforming: false,
|
||||
writecb: null,
|
||||
writechunk: null,
|
||||
writeencoding: null
|
||||
}; // start out asking for a readable event once data is transformed.
|
||||
|
||||
this._readableState.needReadable = true; // we have implemented the _read method, and done the other things
|
||||
// that Readable wants before the first _read call, so unset the
|
||||
// sync guard flag.
|
||||
|
||||
this._readableState.sync = false;
|
||||
|
||||
if (options) {
|
||||
if (typeof options.transform === 'function') this._transform = options.transform;
|
||||
if (typeof options.flush === 'function') this._flush = options.flush;
|
||||
} // When the writable side finishes, then flush out anything remaining.
|
||||
|
||||
|
||||
this.on('prefinish', prefinish);
|
||||
}
|
||||
|
||||
function prefinish() {
|
||||
var _this = this;
|
||||
|
||||
if (typeof this._flush === 'function' && !this._readableState.destroyed) {
|
||||
this._flush(function (er, data) {
|
||||
done(_this, er, data);
|
||||
});
|
||||
} else {
|
||||
done(this, null, null);
|
||||
}
|
||||
}
|
||||
|
||||
Transform.prototype.push = function (chunk, encoding) {
|
||||
this._transformState.needTransform = false;
|
||||
return Duplex.prototype.push.call(this, chunk, encoding);
|
||||
}; // This is the part where you do stuff!
|
||||
// override this function in implementation classes.
|
||||
// 'chunk' is an input chunk.
|
||||
//
|
||||
// Call `push(newChunk)` to pass along transformed output
|
||||
// to the readable side. You may call 'push' zero or more times.
|
||||
//
|
||||
// Call `cb(err)` when you are done with this chunk. If you pass
|
||||
// an error, then that'll put the hurt on the whole operation. If you
|
||||
// never call cb(), then you'll never get another chunk.
|
||||
|
||||
|
||||
Transform.prototype._transform = function (chunk, encoding, cb) {
|
||||
cb(new ERR_METHOD_NOT_IMPLEMENTED('_transform()'));
|
||||
};
|
||||
|
||||
Transform.prototype._write = function (chunk, encoding, cb) {
|
||||
var ts = this._transformState;
|
||||
ts.writecb = cb;
|
||||
ts.writechunk = chunk;
|
||||
ts.writeencoding = encoding;
|
||||
|
||||
if (!ts.transforming) {
|
||||
var rs = this._readableState;
|
||||
if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark);
|
||||
}
|
||||
}; // Doesn't matter what the args are here.
|
||||
// _transform does all the work.
|
||||
// That we got here means that the readable side wants more data.
|
||||
|
||||
|
||||
Transform.prototype._read = function (n) {
|
||||
var ts = this._transformState;
|
||||
|
||||
if (ts.writechunk !== null && !ts.transforming) {
|
||||
ts.transforming = true;
|
||||
|
||||
this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform);
|
||||
} else {
|
||||
// mark that we need a transform, so that any data that comes in
|
||||
// will get processed, now that we've asked for it.
|
||||
ts.needTransform = true;
|
||||
}
|
||||
};
|
||||
|
||||
Transform.prototype._destroy = function (err, cb) {
|
||||
Duplex.prototype._destroy.call(this, err, function (err2) {
|
||||
cb(err2);
|
||||
});
|
||||
};
|
||||
|
||||
function done(stream, er, data) {
|
||||
if (er) return stream.emit('error', er);
|
||||
if (data != null) // single equals check for both `null` and `undefined`
|
||||
stream.push(data); // TODO(BridgeAR): Write a test for these two error cases
|
||||
// if there's nothing in the write buffer, then that means
|
||||
// that nothing more will ever be provided
|
||||
|
||||
if (stream._writableState.length) throw new ERR_TRANSFORM_WITH_LENGTH_0();
|
||||
if (stream._transformState.transforming) throw new ERR_TRANSFORM_ALREADY_TRANSFORMING();
|
||||
return stream.push(null);
|
||||
}
|
697
node_modules/readable-stream/lib/_stream_writable.js
generated
vendored
Normal file
697
node_modules/readable-stream/lib/_stream_writable.js
generated
vendored
Normal file
@ -0,0 +1,697 @@
|
||||
// Copyright Joyent, Inc. and other Node contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to permit
|
||||
// persons to whom the Software is furnished to do so, subject to the
|
||||
// following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
||||
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
||||
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
// A bit simpler than readable streams.
|
||||
// Implement an async ._write(chunk, encoding, cb), and it'll handle all
|
||||
// the drain event emission and buffering.
|
||||
'use strict';
|
||||
|
||||
module.exports = Writable;
|
||||
/* <replacement> */
|
||||
|
||||
function WriteReq(chunk, encoding, cb) {
|
||||
this.chunk = chunk;
|
||||
this.encoding = encoding;
|
||||
this.callback = cb;
|
||||
this.next = null;
|
||||
} // It seems a linked list but it is not
|
||||
// there will be only 2 of these for each stream
|
||||
|
||||
|
||||
function CorkedRequest(state) {
|
||||
var _this = this;
|
||||
|
||||
this.next = null;
|
||||
this.entry = null;
|
||||
|
||||
this.finish = function () {
|
||||
onCorkedFinish(_this, state);
|
||||
};
|
||||
}
|
||||
/* </replacement> */
|
||||
|
||||
/*<replacement>*/
|
||||
|
||||
|
||||
var Duplex;
|
||||
/*</replacement>*/
|
||||
|
||||
Writable.WritableState = WritableState;
|
||||
/*<replacement>*/
|
||||
|
||||
var internalUtil = {
|
||||
deprecate: require('util-deprecate')
|
||||
};
|
||||
/*</replacement>*/
|
||||
|
||||
/*<replacement>*/
|
||||
|
||||
var Stream = require('./internal/streams/stream');
|
||||
/*</replacement>*/
|
||||
|
||||
|
||||
var Buffer = require('buffer').Buffer;
|
||||
|
||||
var OurUint8Array = global.Uint8Array || function () {};
|
||||
|
||||
function _uint8ArrayToBuffer(chunk) {
|
||||
return Buffer.from(chunk);
|
||||
}
|
||||
|
||||
function _isUint8Array(obj) {
|
||||
return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;
|
||||
}
|
||||
|
||||
var destroyImpl = require('./internal/streams/destroy');
|
||||
|
||||
var _require = require('./internal/streams/state'),
|
||||
getHighWaterMark = _require.getHighWaterMark;
|
||||
|
||||
var _require$codes = require('../errors').codes,
|
||||
ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE,
|
||||
ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED,
|
||||
ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK,
|
||||
ERR_STREAM_CANNOT_PIPE = _require$codes.ERR_STREAM_CANNOT_PIPE,
|
||||
ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED,
|
||||
ERR_STREAM_NULL_VALUES = _require$codes.ERR_STREAM_NULL_VALUES,
|
||||
ERR_STREAM_WRITE_AFTER_END = _require$codes.ERR_STREAM_WRITE_AFTER_END,
|
||||
ERR_UNKNOWN_ENCODING = _require$codes.ERR_UNKNOWN_ENCODING;
|
||||
|
||||
var errorOrDestroy = destroyImpl.errorOrDestroy;
|
||||
|
||||
require('inherits')(Writable, Stream);
|
||||
|
||||
function nop() {}
|
||||
|
||||
function WritableState(options, stream, isDuplex) {
|
||||
Duplex = Duplex || require('./_stream_duplex');
|
||||
options = options || {}; // Duplex streams are both readable and writable, but share
|
||||
// the same options object.
|
||||
// However, some cases require setting options to different
|
||||
// values for the readable and the writable sides of the duplex stream,
|
||||
// e.g. options.readableObjectMode vs. options.writableObjectMode, etc.
|
||||
|
||||
if (typeof isDuplex !== 'boolean') isDuplex = stream instanceof Duplex; // object stream flag to indicate whether or not this stream
|
||||
// contains buffers or objects.
|
||||
|
||||
this.objectMode = !!options.objectMode;
|
||||
if (isDuplex) this.objectMode = this.objectMode || !!options.writableObjectMode; // the point at which write() starts returning false
|
||||
// Note: 0 is a valid value, means that we always return false if
|
||||
// the entire buffer is not flushed immediately on write()
|
||||
|
||||
this.highWaterMark = getHighWaterMark(this, options, 'writableHighWaterMark', isDuplex); // if _final has been called
|
||||
|
||||
this.finalCalled = false; // drain event flag.
|
||||
|
||||
this.needDrain = false; // at the start of calling end()
|
||||
|
||||
this.ending = false; // when end() has been called, and returned
|
||||
|
||||
this.ended = false; // when 'finish' is emitted
|
||||
|
||||
this.finished = false; // has it been destroyed
|
||||
|
||||
this.destroyed = false; // should we decode strings into buffers before passing to _write?
|
||||
// this is here so that some node-core streams can optimize string
|
||||
// handling at a lower level.
|
||||
|
||||
var noDecode = options.decodeStrings === false;
|
||||
this.decodeStrings = !noDecode; // Crypto is kind of old and crusty. Historically, its default string
|
||||
// encoding is 'binary' so we have to make this configurable.
|
||||
// Everything else in the universe uses 'utf8', though.
|
||||
|
||||
this.defaultEncoding = options.defaultEncoding || 'utf8'; // not an actual buffer we keep track of, but a measurement
|
||||
// of how much we're waiting to get pushed to some underlying
|
||||
// socket or file.
|
||||
|
||||
this.length = 0; // a flag to see when we're in the middle of a write.
|
||||
|
||||
this.writing = false; // when true all writes will be buffered until .uncork() call
|
||||
|
||||
this.corked = 0; // a flag to be able to tell if the onwrite cb is called immediately,
|
||||
// or on a later tick. We set this to true at first, because any
|
||||
// actions that shouldn't happen until "later" should generally also
|
||||
// not happen before the first write call.
|
||||
|
||||
this.sync = true; // a flag to know if we're processing previously buffered items, which
|
||||
// may call the _write() callback in the same tick, so that we don't
|
||||
// end up in an overlapped onwrite situation.
|
||||
|
||||
this.bufferProcessing = false; // the callback that's passed to _write(chunk,cb)
|
||||
|
||||
this.onwrite = function (er) {
|
||||
onwrite(stream, er);
|
||||
}; // the callback that the user supplies to write(chunk,encoding,cb)
|
||||
|
||||
|
||||
this.writecb = null; // the amount that is being written when _write is called.
|
||||
|
||||
this.writelen = 0;
|
||||
this.bufferedRequest = null;
|
||||
this.lastBufferedRequest = null; // number of pending user-supplied write callbacks
|
||||
// this must be 0 before 'finish' can be emitted
|
||||
|
||||
this.pendingcb = 0; // emit prefinish if the only thing we're waiting for is _write cbs
|
||||
// This is relevant for synchronous Transform streams
|
||||
|
||||
this.prefinished = false; // True if the error was already emitted and should not be thrown again
|
||||
|
||||
this.errorEmitted = false; // Should close be emitted on destroy. Defaults to true.
|
||||
|
||||
this.emitClose = options.emitClose !== false; // Should .destroy() be called after 'finish' (and potentially 'end')
|
||||
|
||||
this.autoDestroy = !!options.autoDestroy; // count buffered requests
|
||||
|
||||
this.bufferedRequestCount = 0; // allocate the first CorkedRequest, there is always
|
||||
// one allocated and free to use, and we maintain at most two
|
||||
|
||||
this.corkedRequestsFree = new CorkedRequest(this);
|
||||
}
|
||||
|
||||
WritableState.prototype.getBuffer = function getBuffer() {
|
||||
var current = this.bufferedRequest;
|
||||
var out = [];
|
||||
|
||||
while (current) {
|
||||
out.push(current);
|
||||
current = current.next;
|
||||
}
|
||||
|
||||
return out;
|
||||
};
|
||||
|
||||
(function () {
|
||||
try {
|
||||
Object.defineProperty(WritableState.prototype, 'buffer', {
|
||||
get: internalUtil.deprecate(function writableStateBufferGetter() {
|
||||
return this.getBuffer();
|
||||
}, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' + 'instead.', 'DEP0003')
|
||||
});
|
||||
} catch (_) {}
|
||||
})(); // Test _writableState for inheritance to account for Duplex streams,
|
||||
// whose prototype chain only points to Readable.
|
||||
|
||||
|
||||
var realHasInstance;
|
||||
|
||||
if (typeof Symbol === 'function' && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === 'function') {
|
||||
realHasInstance = Function.prototype[Symbol.hasInstance];
|
||||
Object.defineProperty(Writable, Symbol.hasInstance, {
|
||||
value: function value(object) {
|
||||
if (realHasInstance.call(this, object)) return true;
|
||||
if (this !== Writable) return false;
|
||||
return object && object._writableState instanceof WritableState;
|
||||
}
|
||||
});
|
||||
} else {
|
||||
realHasInstance = function realHasInstance(object) {
|
||||
return object instanceof this;
|
||||
};
|
||||
}
|
||||
|
||||
function Writable(options) {
|
||||
Duplex = Duplex || require('./_stream_duplex'); // Writable ctor is applied to Duplexes, too.
|
||||
// `realHasInstance` is necessary because using plain `instanceof`
|
||||
// would return false, as no `_writableState` property is attached.
|
||||
// Trying to use the custom `instanceof` for Writable here will also break the
|
||||
// Node.js LazyTransform implementation, which has a non-trivial getter for
|
||||
// `_writableState` that would lead to infinite recursion.
|
||||
// Checking for a Stream.Duplex instance is faster here instead of inside
|
||||
// the WritableState constructor, at least with V8 6.5
|
||||
|
||||
var isDuplex = this instanceof Duplex;
|
||||
if (!isDuplex && !realHasInstance.call(Writable, this)) return new Writable(options);
|
||||
this._writableState = new WritableState(options, this, isDuplex); // legacy.
|
||||
|
||||
this.writable = true;
|
||||
|
||||
if (options) {
|
||||
if (typeof options.write === 'function') this._write = options.write;
|
||||
if (typeof options.writev === 'function') this._writev = options.writev;
|
||||
if (typeof options.destroy === 'function') this._destroy = options.destroy;
|
||||
if (typeof options.final === 'function') this._final = options.final;
|
||||
}
|
||||
|
||||
Stream.call(this);
|
||||
} // Otherwise people can pipe Writable streams, which is just wrong.
|
||||
|
||||
|
||||
Writable.prototype.pipe = function () {
|
||||
errorOrDestroy(this, new ERR_STREAM_CANNOT_PIPE());
|
||||
};
|
||||
|
||||
function writeAfterEnd(stream, cb) {
|
||||
var er = new ERR_STREAM_WRITE_AFTER_END(); // TODO: defer error events consistently everywhere, not just the cb
|
||||
|
||||
errorOrDestroy(stream, er);
|
||||
process.nextTick(cb, er);
|
||||
} // Checks that a user-supplied chunk is valid, especially for the particular
|
||||
// mode the stream is in. Currently this means that `null` is never accepted
|
||||
// and undefined/non-string values are only allowed in object mode.
|
||||
|
||||
|
||||
function validChunk(stream, state, chunk, cb) {
|
||||
var er;
|
||||
|
||||
if (chunk === null) {
|
||||
er = new ERR_STREAM_NULL_VALUES();
|
||||
} else if (typeof chunk !== 'string' && !state.objectMode) {
|
||||
er = new ERR_INVALID_ARG_TYPE('chunk', ['string', 'Buffer'], chunk);
|
||||
}
|
||||
|
||||
if (er) {
|
||||
errorOrDestroy(stream, er);
|
||||
process.nextTick(cb, er);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Writable.prototype.write = function (chunk, encoding, cb) {
|
||||
var state = this._writableState;
|
||||
var ret = false;
|
||||
|
||||
var isBuf = !state.objectMode && _isUint8Array(chunk);
|
||||
|
||||
if (isBuf && !Buffer.isBuffer(chunk)) {
|
||||
chunk = _uint8ArrayToBuffer(chunk);
|
||||
}
|
||||
|
||||
if (typeof encoding === 'function') {
|
||||
cb = encoding;
|
||||
encoding = null;
|
||||
}
|
||||
|
||||
if (isBuf) encoding = 'buffer';else if (!encoding) encoding = state.defaultEncoding;
|
||||
if (typeof cb !== 'function') cb = nop;
|
||||
if (state.ending) writeAfterEnd(this, cb);else if (isBuf || validChunk(this, state, chunk, cb)) {
|
||||
state.pendingcb++;
|
||||
ret = writeOrBuffer(this, state, isBuf, chunk, encoding, cb);
|
||||
}
|
||||
return ret;
|
||||
};
|
||||
|
||||
Writable.prototype.cork = function () {
|
||||
this._writableState.corked++;
|
||||
};
|
||||
|
||||
Writable.prototype.uncork = function () {
|
||||
var state = this._writableState;
|
||||
|
||||
if (state.corked) {
|
||||
state.corked--;
|
||||
if (!state.writing && !state.corked && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state);
|
||||
}
|
||||
};
|
||||
|
||||
Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) {
|
||||
// node::ParseEncoding() requires lower case.
|
||||
if (typeof encoding === 'string') encoding = encoding.toLowerCase();
|
||||
if (!(['hex', 'utf8', 'utf-8', 'ascii', 'binary', 'base64', 'ucs2', 'ucs-2', 'utf16le', 'utf-16le', 'raw'].indexOf((encoding + '').toLowerCase()) > -1)) throw new ERR_UNKNOWN_ENCODING(encoding);
|
||||
this._writableState.defaultEncoding = encoding;
|
||||
return this;
|
||||
};
|
||||
|
||||
Object.defineProperty(Writable.prototype, 'writableBuffer', {
|
||||
// making it explicit this property is not enumerable
|
||||
// because otherwise some prototype manipulation in
|
||||
// userland will fail
|
||||
enumerable: false,
|
||||
get: function get() {
|
||||
return this._writableState && this._writableState.getBuffer();
|
||||
}
|
||||
});
|
||||
|
||||
function decodeChunk(state, chunk, encoding) {
|
||||
if (!state.objectMode && state.decodeStrings !== false && typeof chunk === 'string') {
|
||||
chunk = Buffer.from(chunk, encoding);
|
||||
}
|
||||
|
||||
return chunk;
|
||||
}
|
||||
|
||||
Object.defineProperty(Writable.prototype, 'writableHighWaterMark', {
|
||||
// making it explicit this property is not enumerable
|
||||
// because otherwise some prototype manipulation in
|
||||
// userland will fail
|
||||
enumerable: false,
|
||||
get: function get() {
|
||||
return this._writableState.highWaterMark;
|
||||
}
|
||||
}); // if we're already writing something, then just put this
|
||||
// in the queue, and wait our turn. Otherwise, call _write
|
||||
// If we return false, then we need a drain event, so set that flag.
|
||||
|
||||
function writeOrBuffer(stream, state, isBuf, chunk, encoding, cb) {
|
||||
if (!isBuf) {
|
||||
var newChunk = decodeChunk(state, chunk, encoding);
|
||||
|
||||
if (chunk !== newChunk) {
|
||||
isBuf = true;
|
||||
encoding = 'buffer';
|
||||
chunk = newChunk;
|
||||
}
|
||||
}
|
||||
|
||||
var len = state.objectMode ? 1 : chunk.length;
|
||||
state.length += len;
|
||||
var ret = state.length < state.highWaterMark; // we must ensure that previous needDrain will not be reset to false.
|
||||
|
||||
if (!ret) state.needDrain = true;
|
||||
|
||||
if (state.writing || state.corked) {
|
||||
var last = state.lastBufferedRequest;
|
||||
state.lastBufferedRequest = {
|
||||
chunk: chunk,
|
||||
encoding: encoding,
|
||||
isBuf: isBuf,
|
||||
callback: cb,
|
||||
next: null
|
||||
};
|
||||
|
||||
if (last) {
|
||||
last.next = state.lastBufferedRequest;
|
||||
} else {
|
||||
state.bufferedRequest = state.lastBufferedRequest;
|
||||
}
|
||||
|
||||
state.bufferedRequestCount += 1;
|
||||
} else {
|
||||
doWrite(stream, state, false, len, chunk, encoding, cb);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
function doWrite(stream, state, writev, len, chunk, encoding, cb) {
|
||||
state.writelen = len;
|
||||
state.writecb = cb;
|
||||
state.writing = true;
|
||||
state.sync = true;
|
||||
if (state.destroyed) state.onwrite(new ERR_STREAM_DESTROYED('write'));else if (writev) stream._writev(chunk, state.onwrite);else stream._write(chunk, encoding, state.onwrite);
|
||||
state.sync = false;
|
||||
}
|
||||
|
||||
function onwriteError(stream, state, sync, er, cb) {
|
||||
--state.pendingcb;
|
||||
|
||||
if (sync) {
|
||||
// defer the callback if we are being called synchronously
|
||||
// to avoid piling up things on the stack
|
||||
process.nextTick(cb, er); // this can emit finish, and it will always happen
|
||||
// after error
|
||||
|
||||
process.nextTick(finishMaybe, stream, state);
|
||||
stream._writableState.errorEmitted = true;
|
||||
errorOrDestroy(stream, er);
|
||||
} else {
|
||||
// the caller expect this to happen before if
|
||||
// it is async
|
||||
cb(er);
|
||||
stream._writableState.errorEmitted = true;
|
||||
errorOrDestroy(stream, er); // this can emit finish, but finish must
|
||||
// always follow error
|
||||
|
||||
finishMaybe(stream, state);
|
||||
}
|
||||
}
|
||||
|
||||
function onwriteStateUpdate(state) {
|
||||
state.writing = false;
|
||||
state.writecb = null;
|
||||
state.length -= state.writelen;
|
||||
state.writelen = 0;
|
||||
}
|
||||
|
||||
function onwrite(stream, er) {
|
||||
var state = stream._writableState;
|
||||
var sync = state.sync;
|
||||
var cb = state.writecb;
|
||||
if (typeof cb !== 'function') throw new ERR_MULTIPLE_CALLBACK();
|
||||
onwriteStateUpdate(state);
|
||||
if (er) onwriteError(stream, state, sync, er, cb);else {
|
||||
// Check if we're actually ready to finish, but don't emit yet
|
||||
var finished = needFinish(state) || stream.destroyed;
|
||||
|
||||
if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) {
|
||||
clearBuffer(stream, state);
|
||||
}
|
||||
|
||||
if (sync) {
|
||||
process.nextTick(afterWrite, stream, state, finished, cb);
|
||||
} else {
|
||||
afterWrite(stream, state, finished, cb);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function afterWrite(stream, state, finished, cb) {
|
||||
if (!finished) onwriteDrain(stream, state);
|
||||
state.pendingcb--;
|
||||
cb();
|
||||
finishMaybe(stream, state);
|
||||
} // Must force callback to be called on nextTick, so that we don't
|
||||
// emit 'drain' before the write() consumer gets the 'false' return
|
||||
// value, and has a chance to attach a 'drain' listener.
|
||||
|
||||
|
||||
function onwriteDrain(stream, state) {
|
||||
if (state.length === 0 && state.needDrain) {
|
||||
state.needDrain = false;
|
||||
stream.emit('drain');
|
||||
}
|
||||
} // if there's something in the buffer waiting, then process it
|
||||
|
||||
|
||||
function clearBuffer(stream, state) {
|
||||
state.bufferProcessing = true;
|
||||
var entry = state.bufferedRequest;
|
||||
|
||||
if (stream._writev && entry && entry.next) {
|
||||
// Fast case, write everything using _writev()
|
||||
var l = state.bufferedRequestCount;
|
||||
var buffer = new Array(l);
|
||||
var holder = state.corkedRequestsFree;
|
||||
holder.entry = entry;
|
||||
var count = 0;
|
||||
var allBuffers = true;
|
||||
|
||||
while (entry) {
|
||||
buffer[count] = entry;
|
||||
if (!entry.isBuf) allBuffers = false;
|
||||
entry = entry.next;
|
||||
count += 1;
|
||||
}
|
||||
|
||||
buffer.allBuffers = allBuffers;
|
||||
doWrite(stream, state, true, state.length, buffer, '', holder.finish); // doWrite is almost always async, defer these to save a bit of time
|
||||
// as the hot path ends with doWrite
|
||||
|
||||
state.pendingcb++;
|
||||
state.lastBufferedRequest = null;
|
||||
|
||||
if (holder.next) {
|
||||
state.corkedRequestsFree = holder.next;
|
||||
holder.next = null;
|
||||
} else {
|
||||
state.corkedRequestsFree = new CorkedRequest(state);
|
||||
}
|
||||
|
||||
state.bufferedRequestCount = 0;
|
||||
} else {
|
||||
// Slow case, write chunks one-by-one
|
||||
while (entry) {
|
||||
var chunk = entry.chunk;
|
||||
var encoding = entry.encoding;
|
||||
var cb = entry.callback;
|
||||
var len = state.objectMode ? 1 : chunk.length;
|
||||
doWrite(stream, state, false, len, chunk, encoding, cb);
|
||||
entry = entry.next;
|
||||
state.bufferedRequestCount--; // if we didn't call the onwrite immediately, then
|
||||
// it means that we need to wait until it does.
|
||||
// also, that means that the chunk and cb are currently
|
||||
// being processed, so move the buffer counter past them.
|
||||
|
||||
if (state.writing) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (entry === null) state.lastBufferedRequest = null;
|
||||
}
|
||||
|
||||
state.bufferedRequest = entry;
|
||||
state.bufferProcessing = false;
|
||||
}
|
||||
|
||||
Writable.prototype._write = function (chunk, encoding, cb) {
|
||||
cb(new ERR_METHOD_NOT_IMPLEMENTED('_write()'));
|
||||
};
|
||||
|
||||
Writable.prototype._writev = null;
|
||||
|
||||
Writable.prototype.end = function (chunk, encoding, cb) {
|
||||
var state = this._writableState;
|
||||
|
||||
if (typeof chunk === 'function') {
|
||||
cb = chunk;
|
||||
chunk = null;
|
||||
encoding = null;
|
||||
} else if (typeof encoding === 'function') {
|
||||
cb = encoding;
|
||||
encoding = null;
|
||||
}
|
||||
|
||||
if (chunk !== null && chunk !== undefined) this.write(chunk, encoding); // .end() fully uncorks
|
||||
|
||||
if (state.corked) {
|
||||
state.corked = 1;
|
||||
this.uncork();
|
||||
} // ignore unnecessary end() calls.
|
||||
|
||||
|
||||
if (!state.ending) endWritable(this, state, cb);
|
||||
return this;
|
||||
};
|
||||
|
||||
Object.defineProperty(Writable.prototype, 'writableLength', {
|
||||
// making it explicit this property is not enumerable
|
||||
// because otherwise some prototype manipulation in
|
||||
// userland will fail
|
||||
enumerable: false,
|
||||
get: function get() {
|
||||
return this._writableState.length;
|
||||
}
|
||||
});
|
||||
|
||||
function needFinish(state) {
|
||||
return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing;
|
||||
}
|
||||
|
||||
function callFinal(stream, state) {
|
||||
stream._final(function (err) {
|
||||
state.pendingcb--;
|
||||
|
||||
if (err) {
|
||||
errorOrDestroy(stream, err);
|
||||
}
|
||||
|
||||
state.prefinished = true;
|
||||
stream.emit('prefinish');
|
||||
finishMaybe(stream, state);
|
||||
});
|
||||
}
|
||||
|
||||
function prefinish(stream, state) {
|
||||
if (!state.prefinished && !state.finalCalled) {
|
||||
if (typeof stream._final === 'function' && !state.destroyed) {
|
||||
state.pendingcb++;
|
||||
state.finalCalled = true;
|
||||
process.nextTick(callFinal, stream, state);
|
||||
} else {
|
||||
state.prefinished = true;
|
||||
stream.emit('prefinish');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function finishMaybe(stream, state) {
|
||||
var need = needFinish(state);
|
||||
|
||||
if (need) {
|
||||
prefinish(stream, state);
|
||||
|
||||
if (state.pendingcb === 0) {
|
||||
state.finished = true;
|
||||
stream.emit('finish');
|
||||
|
||||
if (state.autoDestroy) {
|
||||
// In case of duplex streams we need a way to detect
|
||||
// if the readable side is ready for autoDestroy as well
|
||||
var rState = stream._readableState;
|
||||
|
||||
if (!rState || rState.autoDestroy && rState.endEmitted) {
|
||||
stream.destroy();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return need;
|
||||
}
|
||||
|
||||
function endWritable(stream, state, cb) {
|
||||
state.ending = true;
|
||||
finishMaybe(stream, state);
|
||||
|
||||
if (cb) {
|
||||
if (state.finished) process.nextTick(cb);else stream.once('finish', cb);
|
||||
}
|
||||
|
||||
state.ended = true;
|
||||
stream.writable = false;
|
||||
}
|
||||
|
||||
function onCorkedFinish(corkReq, state, err) {
|
||||
var entry = corkReq.entry;
|
||||
corkReq.entry = null;
|
||||
|
||||
while (entry) {
|
||||
var cb = entry.callback;
|
||||
state.pendingcb--;
|
||||
cb(err);
|
||||
entry = entry.next;
|
||||
} // reuse the free corkReq.
|
||||
|
||||
|
||||
state.corkedRequestsFree.next = corkReq;
|
||||
}
|
||||
|
||||
Object.defineProperty(Writable.prototype, 'destroyed', {
|
||||
// making it explicit this property is not enumerable
|
||||
// because otherwise some prototype manipulation in
|
||||
// userland will fail
|
||||
enumerable: false,
|
||||
get: function get() {
|
||||
if (this._writableState === undefined) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return this._writableState.destroyed;
|
||||
},
|
||||
set: function set(value) {
|
||||
// we ignore the value if the stream
|
||||
// has not been initialized yet
|
||||
if (!this._writableState) {
|
||||
return;
|
||||
} // backward compatibility, the user is explicitly
|
||||
// managing destroyed
|
||||
|
||||
|
||||
this._writableState.destroyed = value;
|
||||
}
|
||||
});
|
||||
Writable.prototype.destroy = destroyImpl.destroy;
|
||||
Writable.prototype._undestroy = destroyImpl.undestroy;
|
||||
|
||||
Writable.prototype._destroy = function (err, cb) {
|
||||
cb(err);
|
||||
};
|
207
node_modules/readable-stream/lib/internal/streams/async_iterator.js
generated
vendored
Normal file
207
node_modules/readable-stream/lib/internal/streams/async_iterator.js
generated
vendored
Normal file
@ -0,0 +1,207 @@
|
||||
'use strict';
|
||||
|
||||
var _Object$setPrototypeO;
|
||||
|
||||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
||||
|
||||
var finished = require('./end-of-stream');
|
||||
|
||||
var kLastResolve = Symbol('lastResolve');
|
||||
var kLastReject = Symbol('lastReject');
|
||||
var kError = Symbol('error');
|
||||
var kEnded = Symbol('ended');
|
||||
var kLastPromise = Symbol('lastPromise');
|
||||
var kHandlePromise = Symbol('handlePromise');
|
||||
var kStream = Symbol('stream');
|
||||
|
||||
function createIterResult(value, done) {
|
||||
return {
|
||||
value: value,
|
||||
done: done
|
||||
};
|
||||
}
|
||||
|
||||
function readAndResolve(iter) {
|
||||
var resolve = iter[kLastResolve];
|
||||
|
||||
if (resolve !== null) {
|
||||
var data = iter[kStream].read(); // we defer if data is null
|
||||
// we can be expecting either 'end' or
|
||||
// 'error'
|
||||
|
||||
if (data !== null) {
|
||||
iter[kLastPromise] = null;
|
||||
iter[kLastResolve] = null;
|
||||
iter[kLastReject] = null;
|
||||
resolve(createIterResult(data, false));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function onReadable(iter) {
|
||||
// we wait for the next tick, because it might
|
||||
// emit an error with process.nextTick
|
||||
process.nextTick(readAndResolve, iter);
|
||||
}
|
||||
|
||||
function wrapForNext(lastPromise, iter) {
|
||||
return function (resolve, reject) {
|
||||
lastPromise.then(function () {
|
||||
if (iter[kEnded]) {
|
||||
resolve(createIterResult(undefined, true));
|
||||
return;
|
||||
}
|
||||
|
||||
iter[kHandlePromise](resolve, reject);
|
||||
}, reject);
|
||||
};
|
||||
}
|
||||
|
||||
var AsyncIteratorPrototype = Object.getPrototypeOf(function () {});
|
||||
var ReadableStreamAsyncIteratorPrototype = Object.setPrototypeOf((_Object$setPrototypeO = {
|
||||
get stream() {
|
||||
return this[kStream];
|
||||
},
|
||||
|
||||
next: function next() {
|
||||
var _this = this;
|
||||
|
||||
// if we have detected an error in the meanwhile
|
||||
// reject straight away
|
||||
var error = this[kError];
|
||||
|
||||
if (error !== null) {
|
||||
return Promise.reject(error);
|
||||
}
|
||||
|
||||
if (this[kEnded]) {
|
||||
return Promise.resolve(createIterResult(undefined, true));
|
||||
}
|
||||
|
||||
if (this[kStream].destroyed) {
|
||||
// We need to defer via nextTick because if .destroy(err) is
|
||||
// called, the error will be emitted via nextTick, and
|
||||
// we cannot guarantee that there is no error lingering around
|
||||
// waiting to be emitted.
|
||||
return new Promise(function (resolve, reject) {
|
||||
process.nextTick(function () {
|
||||
if (_this[kError]) {
|
||||
reject(_this[kError]);
|
||||
} else {
|
||||
resolve(createIterResult(undefined, true));
|
||||
}
|
||||
});
|
||||
});
|
||||
} // if we have multiple next() calls
|
||||
// we will wait for the previous Promise to finish
|
||||
// this logic is optimized to support for await loops,
|
||||
// where next() is only called once at a time
|
||||
|
||||
|
||||
var lastPromise = this[kLastPromise];
|
||||
var promise;
|
||||
|
||||
if (lastPromise) {
|
||||
promise = new Promise(wrapForNext(lastPromise, this));
|
||||
} else {
|
||||
// fast path needed to support multiple this.push()
|
||||
// without triggering the next() queue
|
||||
var data = this[kStream].read();
|
||||
|
||||
if (data !== null) {
|
||||
return Promise.resolve(createIterResult(data, false));
|
||||
}
|
||||
|
||||
promise = new Promise(this[kHandlePromise]);
|
||||
}
|
||||
|
||||
this[kLastPromise] = promise;
|
||||
return promise;
|
||||
}
|
||||
}, _defineProperty(_Object$setPrototypeO, Symbol.asyncIterator, function () {
|
||||
return this;
|
||||
}), _defineProperty(_Object$setPrototypeO, "return", function _return() {
|
||||
var _this2 = this;
|
||||
|
||||
// destroy(err, cb) is a private API
|
||||
// we can guarantee we have that here, because we control the
|
||||
// Readable class this is attached to
|
||||
return new Promise(function (resolve, reject) {
|
||||
_this2[kStream].destroy(null, function (err) {
|
||||
if (err) {
|
||||
reject(err);
|
||||
return;
|
||||
}
|
||||
|
||||
resolve(createIterResult(undefined, true));
|
||||
});
|
||||
});
|
||||
}), _Object$setPrototypeO), AsyncIteratorPrototype);
|
||||
|
||||
var createReadableStreamAsyncIterator = function createReadableStreamAsyncIterator(stream) {
|
||||
var _Object$create;
|
||||
|
||||
var iterator = Object.create(ReadableStreamAsyncIteratorPrototype, (_Object$create = {}, _defineProperty(_Object$create, kStream, {
|
||||
value: stream,
|
||||
writable: true
|
||||
}), _defineProperty(_Object$create, kLastResolve, {
|
||||
value: null,
|
||||
writable: true
|
||||
}), _defineProperty(_Object$create, kLastReject, {
|
||||
value: null,
|
||||
writable: true
|
||||
}), _defineProperty(_Object$create, kError, {
|
||||
value: null,
|
||||
writable: true
|
||||
}), _defineProperty(_Object$create, kEnded, {
|
||||
value: stream._readableState.endEmitted,
|
||||
writable: true
|
||||
}), _defineProperty(_Object$create, kHandlePromise, {
|
||||
value: function value(resolve, reject) {
|
||||
var data = iterator[kStream].read();
|
||||
|
||||
if (data) {
|
||||
iterator[kLastPromise] = null;
|
||||
iterator[kLastResolve] = null;
|
||||
iterator[kLastReject] = null;
|
||||
resolve(createIterResult(data, false));
|
||||
} else {
|
||||
iterator[kLastResolve] = resolve;
|
||||
iterator[kLastReject] = reject;
|
||||
}
|
||||
},
|
||||
writable: true
|
||||
}), _Object$create));
|
||||
iterator[kLastPromise] = null;
|
||||
finished(stream, function (err) {
|
||||
if (err && err.code !== 'ERR_STREAM_PREMATURE_CLOSE') {
|
||||
var reject = iterator[kLastReject]; // reject if we are waiting for data in the Promise
|
||||
// returned by next() and store the error
|
||||
|
||||
if (reject !== null) {
|
||||
iterator[kLastPromise] = null;
|
||||
iterator[kLastResolve] = null;
|
||||
iterator[kLastReject] = null;
|
||||
reject(err);
|
||||
}
|
||||
|
||||
iterator[kError] = err;
|
||||
return;
|
||||
}
|
||||
|
||||
var resolve = iterator[kLastResolve];
|
||||
|
||||
if (resolve !== null) {
|
||||
iterator[kLastPromise] = null;
|
||||
iterator[kLastResolve] = null;
|
||||
iterator[kLastReject] = null;
|
||||
resolve(createIterResult(undefined, true));
|
||||
}
|
||||
|
||||
iterator[kEnded] = true;
|
||||
});
|
||||
stream.on('readable', onReadable.bind(null, iterator));
|
||||
return iterator;
|
||||
};
|
||||
|
||||
module.exports = createReadableStreamAsyncIterator;
|
210
node_modules/readable-stream/lib/internal/streams/buffer_list.js
generated
vendored
Normal file
210
node_modules/readable-stream/lib/internal/streams/buffer_list.js
generated
vendored
Normal file
@ -0,0 +1,210 @@
|
||||
'use strict';
|
||||
|
||||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
||||
|
||||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
||||
|
||||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
||||
|
||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
||||
|
||||
var _require = require('buffer'),
|
||||
Buffer = _require.Buffer;
|
||||
|
||||
var _require2 = require('util'),
|
||||
inspect = _require2.inspect;
|
||||
|
||||
var custom = inspect && inspect.custom || 'inspect';
|
||||
|
||||
function copyBuffer(src, target, offset) {
|
||||
Buffer.prototype.copy.call(src, target, offset);
|
||||
}
|
||||
|
||||
module.exports =
|
||||
/*#__PURE__*/
|
||||
function () {
|
||||
function BufferList() {
|
||||
_classCallCheck(this, BufferList);
|
||||
|
||||
this.head = null;
|
||||
this.tail = null;
|
||||
this.length = 0;
|
||||
}
|
||||
|
||||
_createClass(BufferList, [{
|
||||
key: "push",
|
||||
value: function push(v) {
|
||||
var entry = {
|
||||
data: v,
|
||||
next: null
|
||||
};
|
||||
if (this.length > 0) this.tail.next = entry;else this.head = entry;
|
||||
this.tail = entry;
|
||||
++this.length;
|
||||
}
|
||||
}, {
|
||||
key: "unshift",
|
||||
value: function unshift(v) {
|
||||
var entry = {
|
||||
data: v,
|
||||
next: this.head
|
||||
};
|
||||
if (this.length === 0) this.tail = entry;
|
||||
this.head = entry;
|
||||
++this.length;
|
||||
}
|
||||
}, {
|
||||
key: "shift",
|
||||
value: function shift() {
|
||||
if (this.length === 0) return;
|
||||
var ret = this.head.data;
|
||||
if (this.length === 1) this.head = this.tail = null;else this.head = this.head.next;
|
||||
--this.length;
|
||||
return ret;
|
||||
}
|
||||
}, {
|
||||
key: "clear",
|
||||
value: function clear() {
|
||||
this.head = this.tail = null;
|
||||
this.length = 0;
|
||||
}
|
||||
}, {
|
||||
key: "join",
|
||||
value: function join(s) {
|
||||
if (this.length === 0) return '';
|
||||
var p = this.head;
|
||||
var ret = '' + p.data;
|
||||
|
||||
while (p = p.next) {
|
||||
ret += s + p.data;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
}, {
|
||||
key: "concat",
|
||||
value: function concat(n) {
|
||||
if (this.length === 0) return Buffer.alloc(0);
|
||||
var ret = Buffer.allocUnsafe(n >>> 0);
|
||||
var p = this.head;
|
||||
var i = 0;
|
||||
|
||||
while (p) {
|
||||
copyBuffer(p.data, ret, i);
|
||||
i += p.data.length;
|
||||
p = p.next;
|
||||
}
|
||||
|
||||
return ret;
|
||||
} // Consumes a specified amount of bytes or characters from the buffered data.
|
||||
|
||||
}, {
|
||||
key: "consume",
|
||||
value: function consume(n, hasStrings) {
|
||||
var ret;
|
||||
|
||||
if (n < this.head.data.length) {
|
||||
// `slice` is the same for buffers and strings.
|
||||
ret = this.head.data.slice(0, n);
|
||||
this.head.data = this.head.data.slice(n);
|
||||
} else if (n === this.head.data.length) {
|
||||
// First chunk is a perfect match.
|
||||
ret = this.shift();
|
||||
} else {
|
||||
// Result spans more than one buffer.
|
||||
ret = hasStrings ? this._getString(n) : this._getBuffer(n);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
}, {
|
||||
key: "first",
|
||||
value: function first() {
|
||||
return this.head.data;
|
||||
} // Consumes a specified amount of characters from the buffered data.
|
||||
|
||||
}, {
|
||||
key: "_getString",
|
||||
value: function _getString(n) {
|
||||
var p = this.head;
|
||||
var c = 1;
|
||||
var ret = p.data;
|
||||
n -= ret.length;
|
||||
|
||||
while (p = p.next) {
|
||||
var str = p.data;
|
||||
var nb = n > str.length ? str.length : n;
|
||||
if (nb === str.length) ret += str;else ret += str.slice(0, n);
|
||||
n -= nb;
|
||||
|
||||
if (n === 0) {
|
||||
if (nb === str.length) {
|
||||
++c;
|
||||
if (p.next) this.head = p.next;else this.head = this.tail = null;
|
||||
} else {
|
||||
this.head = p;
|
||||
p.data = str.slice(nb);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
++c;
|
||||
}
|
||||
|
||||
this.length -= c;
|
||||
return ret;
|
||||
} // Consumes a specified amount of bytes from the buffered data.
|
||||
|
||||
}, {
|
||||
key: "_getBuffer",
|
||||
value: function _getBuffer(n) {
|
||||
var ret = Buffer.allocUnsafe(n);
|
||||
var p = this.head;
|
||||
var c = 1;
|
||||
p.data.copy(ret);
|
||||
n -= p.data.length;
|
||||
|
||||
while (p = p.next) {
|
||||
var buf = p.data;
|
||||
var nb = n > buf.length ? buf.length : n;
|
||||
buf.copy(ret, ret.length - n, 0, nb);
|
||||
n -= nb;
|
||||
|
||||
if (n === 0) {
|
||||
if (nb === buf.length) {
|
||||
++c;
|
||||
if (p.next) this.head = p.next;else this.head = this.tail = null;
|
||||
} else {
|
||||
this.head = p;
|
||||
p.data = buf.slice(nb);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
++c;
|
||||
}
|
||||
|
||||
this.length -= c;
|
||||
return ret;
|
||||
} // Make sure the linked list only shows the minimal necessary information.
|
||||
|
||||
}, {
|
||||
key: custom,
|
||||
value: function value(_, options) {
|
||||
return inspect(this, _objectSpread({}, options, {
|
||||
// Only inspect one level.
|
||||
depth: 0,
|
||||
// It should not recurse.
|
||||
customInspect: false
|
||||
}));
|
||||
}
|
||||
}]);
|
||||
|
||||
return BufferList;
|
||||
}();
|
105
node_modules/readable-stream/lib/internal/streams/destroy.js
generated
vendored
Normal file
105
node_modules/readable-stream/lib/internal/streams/destroy.js
generated
vendored
Normal file
@ -0,0 +1,105 @@
|
||||
'use strict'; // undocumented cb() API, needed for core, not for public API
|
||||
|
||||
function destroy(err, cb) {
|
||||
var _this = this;
|
||||
|
||||
var readableDestroyed = this._readableState && this._readableState.destroyed;
|
||||
var writableDestroyed = this._writableState && this._writableState.destroyed;
|
||||
|
||||
if (readableDestroyed || writableDestroyed) {
|
||||
if (cb) {
|
||||
cb(err);
|
||||
} else if (err) {
|
||||
if (!this._writableState) {
|
||||
process.nextTick(emitErrorNT, this, err);
|
||||
} else if (!this._writableState.errorEmitted) {
|
||||
this._writableState.errorEmitted = true;
|
||||
process.nextTick(emitErrorNT, this, err);
|
||||
}
|
||||
}
|
||||
|
||||
return this;
|
||||
} // we set destroyed to true before firing error callbacks in order
|
||||
// to make it re-entrance safe in case destroy() is called within callbacks
|
||||
|
||||
|
||||
if (this._readableState) {
|
||||
this._readableState.destroyed = true;
|
||||
} // if this is a duplex stream mark the writable part as destroyed as well
|
||||
|
||||
|
||||
if (this._writableState) {
|
||||
this._writableState.destroyed = true;
|
||||
}
|
||||
|
||||
this._destroy(err || null, function (err) {
|
||||
if (!cb && err) {
|
||||
if (!_this._writableState) {
|
||||
process.nextTick(emitErrorAndCloseNT, _this, err);
|
||||
} else if (!_this._writableState.errorEmitted) {
|
||||
_this._writableState.errorEmitted = true;
|
||||
process.nextTick(emitErrorAndCloseNT, _this, err);
|
||||
} else {
|
||||
process.nextTick(emitCloseNT, _this);
|
||||
}
|
||||
} else if (cb) {
|
||||
process.nextTick(emitCloseNT, _this);
|
||||
cb(err);
|
||||
} else {
|
||||
process.nextTick(emitCloseNT, _this);
|
||||
}
|
||||
});
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
function emitErrorAndCloseNT(self, err) {
|
||||
emitErrorNT(self, err);
|
||||
emitCloseNT(self);
|
||||
}
|
||||
|
||||
function emitCloseNT(self) {
|
||||
if (self._writableState && !self._writableState.emitClose) return;
|
||||
if (self._readableState && !self._readableState.emitClose) return;
|
||||
self.emit('close');
|
||||
}
|
||||
|
||||
function undestroy() {
|
||||
if (this._readableState) {
|
||||
this._readableState.destroyed = false;
|
||||
this._readableState.reading = false;
|
||||
this._readableState.ended = false;
|
||||
this._readableState.endEmitted = false;
|
||||
}
|
||||
|
||||
if (this._writableState) {
|
||||
this._writableState.destroyed = false;
|
||||
this._writableState.ended = false;
|
||||
this._writableState.ending = false;
|
||||
this._writableState.finalCalled = false;
|
||||
this._writableState.prefinished = false;
|
||||
this._writableState.finished = false;
|
||||
this._writableState.errorEmitted = false;
|
||||
}
|
||||
}
|
||||
|
||||
function emitErrorNT(self, err) {
|
||||
self.emit('error', err);
|
||||
}
|
||||
|
||||
function errorOrDestroy(stream, err) {
|
||||
// We have tests that rely on errors being emitted
|
||||
// in the same tick, so changing this is semver major.
|
||||
// For now when you opt-in to autoDestroy we allow
|
||||
// the error to be emitted nextTick. In a future
|
||||
// semver major update we should change the default to this.
|
||||
var rState = stream._readableState;
|
||||
var wState = stream._writableState;
|
||||
if (rState && rState.autoDestroy || wState && wState.autoDestroy) stream.destroy(err);else stream.emit('error', err);
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
destroy: destroy,
|
||||
undestroy: undestroy,
|
||||
errorOrDestroy: errorOrDestroy
|
||||
};
|
104
node_modules/readable-stream/lib/internal/streams/end-of-stream.js
generated
vendored
Normal file
104
node_modules/readable-stream/lib/internal/streams/end-of-stream.js
generated
vendored
Normal file
@ -0,0 +1,104 @@
|
||||
// Ported from https://github.com/mafintosh/end-of-stream with
|
||||
// permission from the author, Mathias Buus (@mafintosh).
|
||||
'use strict';
|
||||
|
||||
var ERR_STREAM_PREMATURE_CLOSE = require('../../../errors').codes.ERR_STREAM_PREMATURE_CLOSE;
|
||||
|
||||
function once(callback) {
|
||||
var called = false;
|
||||
return function () {
|
||||
if (called) return;
|
||||
called = true;
|
||||
|
||||
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
||||
args[_key] = arguments[_key];
|
||||
}
|
||||
|
||||
callback.apply(this, args);
|
||||
};
|
||||
}
|
||||
|
||||
function noop() {}
|
||||
|
||||
function isRequest(stream) {
|
||||
return stream.setHeader && typeof stream.abort === 'function';
|
||||
}
|
||||
|
||||
function eos(stream, opts, callback) {
|
||||
if (typeof opts === 'function') return eos(stream, null, opts);
|
||||
if (!opts) opts = {};
|
||||
callback = once(callback || noop);
|
||||
var readable = opts.readable || opts.readable !== false && stream.readable;
|
||||
var writable = opts.writable || opts.writable !== false && stream.writable;
|
||||
|
||||
var onlegacyfinish = function onlegacyfinish() {
|
||||
if (!stream.writable) onfinish();
|
||||
};
|
||||
|
||||
var writableEnded = stream._writableState && stream._writableState.finished;
|
||||
|
||||
var onfinish = function onfinish() {
|
||||
writable = false;
|
||||
writableEnded = true;
|
||||
if (!readable) callback.call(stream);
|
||||
};
|
||||
|
||||
var readableEnded = stream._readableState && stream._readableState.endEmitted;
|
||||
|
||||
var onend = function onend() {
|
||||
readable = false;
|
||||
readableEnded = true;
|
||||
if (!writable) callback.call(stream);
|
||||
};
|
||||
|
||||
var onerror = function onerror(err) {
|
||||
callback.call(stream, err);
|
||||
};
|
||||
|
||||
var onclose = function onclose() {
|
||||
var err;
|
||||
|
||||
if (readable && !readableEnded) {
|
||||
if (!stream._readableState || !stream._readableState.ended) err = new ERR_STREAM_PREMATURE_CLOSE();
|
||||
return callback.call(stream, err);
|
||||
}
|
||||
|
||||
if (writable && !writableEnded) {
|
||||
if (!stream._writableState || !stream._writableState.ended) err = new ERR_STREAM_PREMATURE_CLOSE();
|
||||
return callback.call(stream, err);
|
||||
}
|
||||
};
|
||||
|
||||
var onrequest = function onrequest() {
|
||||
stream.req.on('finish', onfinish);
|
||||
};
|
||||
|
||||
if (isRequest(stream)) {
|
||||
stream.on('complete', onfinish);
|
||||
stream.on('abort', onclose);
|
||||
if (stream.req) onrequest();else stream.on('request', onrequest);
|
||||
} else if (writable && !stream._writableState) {
|
||||
// legacy streams
|
||||
stream.on('end', onlegacyfinish);
|
||||
stream.on('close', onlegacyfinish);
|
||||
}
|
||||
|
||||
stream.on('end', onend);
|
||||
stream.on('finish', onfinish);
|
||||
if (opts.error !== false) stream.on('error', onerror);
|
||||
stream.on('close', onclose);
|
||||
return function () {
|
||||
stream.removeListener('complete', onfinish);
|
||||
stream.removeListener('abort', onclose);
|
||||
stream.removeListener('request', onrequest);
|
||||
if (stream.req) stream.req.removeListener('finish', onfinish);
|
||||
stream.removeListener('end', onlegacyfinish);
|
||||
stream.removeListener('close', onlegacyfinish);
|
||||
stream.removeListener('finish', onfinish);
|
||||
stream.removeListener('end', onend);
|
||||
stream.removeListener('error', onerror);
|
||||
stream.removeListener('close', onclose);
|
||||
};
|
||||
}
|
||||
|
||||
module.exports = eos;
|
3
node_modules/readable-stream/lib/internal/streams/from-browser.js
generated
vendored
Normal file
3
node_modules/readable-stream/lib/internal/streams/from-browser.js
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
module.exports = function () {
|
||||
throw new Error('Readable.from is not available in the browser')
|
||||
};
|
64
node_modules/readable-stream/lib/internal/streams/from.js
generated
vendored
Normal file
64
node_modules/readable-stream/lib/internal/streams/from.js
generated
vendored
Normal file
@ -0,0 +1,64 @@
|
||||
'use strict';
|
||||
|
||||
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
||||
|
||||
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
||||
|
||||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
||||
|
||||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
||||
|
||||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
||||
|
||||
var ERR_INVALID_ARG_TYPE = require('../../../errors').codes.ERR_INVALID_ARG_TYPE;
|
||||
|
||||
function from(Readable, iterable, opts) {
|
||||
var iterator;
|
||||
|
||||
if (iterable && typeof iterable.next === 'function') {
|
||||
iterator = iterable;
|
||||
} else if (iterable && iterable[Symbol.asyncIterator]) iterator = iterable[Symbol.asyncIterator]();else if (iterable && iterable[Symbol.iterator]) iterator = iterable[Symbol.iterator]();else throw new ERR_INVALID_ARG_TYPE('iterable', ['Iterable'], iterable);
|
||||
|
||||
var readable = new Readable(_objectSpread({
|
||||
objectMode: true
|
||||
}, opts)); // Reading boolean to protect against _read
|
||||
// being called before last iteration completion.
|
||||
|
||||
var reading = false;
|
||||
|
||||
readable._read = function () {
|
||||
if (!reading) {
|
||||
reading = true;
|
||||
next();
|
||||
}
|
||||
};
|
||||
|
||||
function next() {
|
||||
return _next2.apply(this, arguments);
|
||||
}
|
||||
|
||||
function _next2() {
|
||||
_next2 = _asyncToGenerator(function* () {
|
||||
try {
|
||||
var _ref = yield iterator.next(),
|
||||
value = _ref.value,
|
||||
done = _ref.done;
|
||||
|
||||
if (done) {
|
||||
readable.push(null);
|
||||
} else if (readable.push((yield value))) {
|
||||
next();
|
||||
} else {
|
||||
reading = false;
|
||||
}
|
||||
} catch (err) {
|
||||
readable.destroy(err);
|
||||
}
|
||||
});
|
||||
return _next2.apply(this, arguments);
|
||||
}
|
||||
|
||||
return readable;
|
||||
}
|
||||
|
||||
module.exports = from;
|
97
node_modules/readable-stream/lib/internal/streams/pipeline.js
generated
vendored
Normal file
97
node_modules/readable-stream/lib/internal/streams/pipeline.js
generated
vendored
Normal file
@ -0,0 +1,97 @@
|
||||
// Ported from https://github.com/mafintosh/pump with
|
||||
// permission from the author, Mathias Buus (@mafintosh).
|
||||
'use strict';
|
||||
|
||||
var eos;
|
||||
|
||||
function once(callback) {
|
||||
var called = false;
|
||||
return function () {
|
||||
if (called) return;
|
||||
called = true;
|
||||
callback.apply(void 0, arguments);
|
||||
};
|
||||
}
|
||||
|
||||
var _require$codes = require('../../../errors').codes,
|
||||
ERR_MISSING_ARGS = _require$codes.ERR_MISSING_ARGS,
|
||||
ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED;
|
||||
|
||||
function noop(err) {
|
||||
// Rethrow the error if it exists to avoid swallowing it
|
||||
if (err) throw err;
|
||||
}
|
||||
|
||||
function isRequest(stream) {
|
||||
return stream.setHeader && typeof stream.abort === 'function';
|
||||
}
|
||||
|
||||
function destroyer(stream, reading, writing, callback) {
|
||||
callback = once(callback);
|
||||
var closed = false;
|
||||
stream.on('close', function () {
|
||||
closed = true;
|
||||
});
|
||||
if (eos === undefined) eos = require('./end-of-stream');
|
||||
eos(stream, {
|
||||
readable: reading,
|
||||
writable: writing
|
||||
}, function (err) {
|
||||
if (err) return callback(err);
|
||||
closed = true;
|
||||
callback();
|
||||
});
|
||||
var destroyed = false;
|
||||
return function (err) {
|
||||
if (closed) return;
|
||||
if (destroyed) return;
|
||||
destroyed = true; // request.destroy just do .end - .abort is what we want
|
||||
|
||||
if (isRequest(stream)) return stream.abort();
|
||||
if (typeof stream.destroy === 'function') return stream.destroy();
|
||||
callback(err || new ERR_STREAM_DESTROYED('pipe'));
|
||||
};
|
||||
}
|
||||
|
||||
function call(fn) {
|
||||
fn();
|
||||
}
|
||||
|
||||
function pipe(from, to) {
|
||||
return from.pipe(to);
|
||||
}
|
||||
|
||||
function popCallback(streams) {
|
||||
if (!streams.length) return noop;
|
||||
if (typeof streams[streams.length - 1] !== 'function') return noop;
|
||||
return streams.pop();
|
||||
}
|
||||
|
||||
function pipeline() {
|
||||
for (var _len = arguments.length, streams = new Array(_len), _key = 0; _key < _len; _key++) {
|
||||
streams[_key] = arguments[_key];
|
||||
}
|
||||
|
||||
var callback = popCallback(streams);
|
||||
if (Array.isArray(streams[0])) streams = streams[0];
|
||||
|
||||
if (streams.length < 2) {
|
||||
throw new ERR_MISSING_ARGS('streams');
|
||||
}
|
||||
|
||||
var error;
|
||||
var destroys = streams.map(function (stream, i) {
|
||||
var reading = i < streams.length - 1;
|
||||
var writing = i > 0;
|
||||
return destroyer(stream, reading, writing, function (err) {
|
||||
if (!error) error = err;
|
||||
if (err) destroys.forEach(call);
|
||||
if (reading) return;
|
||||
destroys.forEach(call);
|
||||
callback(error);
|
||||
});
|
||||
});
|
||||
return streams.reduce(pipe);
|
||||
}
|
||||
|
||||
module.exports = pipeline;
|
27
node_modules/readable-stream/lib/internal/streams/state.js
generated
vendored
Normal file
27
node_modules/readable-stream/lib/internal/streams/state.js
generated
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
'use strict';
|
||||
|
||||
var ERR_INVALID_OPT_VALUE = require('../../../errors').codes.ERR_INVALID_OPT_VALUE;
|
||||
|
||||
function highWaterMarkFrom(options, isDuplex, duplexKey) {
|
||||
return options.highWaterMark != null ? options.highWaterMark : isDuplex ? options[duplexKey] : null;
|
||||
}
|
||||
|
||||
function getHighWaterMark(state, options, duplexKey, isDuplex) {
|
||||
var hwm = highWaterMarkFrom(options, isDuplex, duplexKey);
|
||||
|
||||
if (hwm != null) {
|
||||
if (!(isFinite(hwm) && Math.floor(hwm) === hwm) || hwm < 0) {
|
||||
var name = isDuplex ? duplexKey : 'highWaterMark';
|
||||
throw new ERR_INVALID_OPT_VALUE(name, hwm);
|
||||
}
|
||||
|
||||
return Math.floor(hwm);
|
||||
} // Default value
|
||||
|
||||
|
||||
return state.objectMode ? 16 : 16 * 1024;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
getHighWaterMark: getHighWaterMark
|
||||
};
|
1
node_modules/readable-stream/lib/internal/streams/stream-browser.js
generated
vendored
Normal file
1
node_modules/readable-stream/lib/internal/streams/stream-browser.js
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
module.exports = require('events').EventEmitter;
|
1
node_modules/readable-stream/lib/internal/streams/stream.js
generated
vendored
Normal file
1
node_modules/readable-stream/lib/internal/streams/stream.js
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
module.exports = require('stream');
|
68
node_modules/readable-stream/package.json
generated
vendored
Normal file
68
node_modules/readable-stream/package.json
generated
vendored
Normal file
@ -0,0 +1,68 @@
|
||||
{
|
||||
"name": "readable-stream",
|
||||
"version": "3.6.0",
|
||||
"description": "Streams3, a user-land copy of the stream library from Node.js",
|
||||
"main": "readable.js",
|
||||
"engines": {
|
||||
"node": ">= 6"
|
||||
},
|
||||
"dependencies": {
|
||||
"inherits": "^2.0.3",
|
||||
"string_decoder": "^1.1.1",
|
||||
"util-deprecate": "^1.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/cli": "^7.2.0",
|
||||
"@babel/core": "^7.2.0",
|
||||
"@babel/polyfill": "^7.0.0",
|
||||
"@babel/preset-env": "^7.2.0",
|
||||
"airtap": "0.0.9",
|
||||
"assert": "^1.4.0",
|
||||
"bl": "^2.0.0",
|
||||
"deep-strict-equal": "^0.2.0",
|
||||
"events.once": "^2.0.2",
|
||||
"glob": "^7.1.2",
|
||||
"gunzip-maybe": "^1.4.1",
|
||||
"hyperquest": "^2.1.3",
|
||||
"lolex": "^2.6.0",
|
||||
"nyc": "^11.0.0",
|
||||
"pump": "^3.0.0",
|
||||
"rimraf": "^2.6.2",
|
||||
"tap": "^12.0.0",
|
||||
"tape": "^4.9.0",
|
||||
"tar-fs": "^1.16.2",
|
||||
"util-promisify": "^2.1.0"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "tap -J --no-esm test/parallel/*.js test/ours/*.js",
|
||||
"ci": "TAP=1 tap --no-esm test/parallel/*.js test/ours/*.js | tee test.tap",
|
||||
"test-browsers": "airtap --sauce-connect --loopback airtap.local -- test/browser.js",
|
||||
"test-browser-local": "airtap --open --local -- test/browser.js",
|
||||
"cover": "nyc npm test",
|
||||
"report": "nyc report --reporter=lcov",
|
||||
"update-browser-errors": "babel -o errors-browser.js errors.js"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/nodejs/readable-stream"
|
||||
},
|
||||
"keywords": [
|
||||
"readable",
|
||||
"stream",
|
||||
"pipe"
|
||||
],
|
||||
"browser": {
|
||||
"util": false,
|
||||
"worker_threads": false,
|
||||
"./errors": "./errors-browser.js",
|
||||
"./readable.js": "./readable-browser.js",
|
||||
"./lib/internal/streams/from.js": "./lib/internal/streams/from-browser.js",
|
||||
"./lib/internal/streams/stream.js": "./lib/internal/streams/stream-browser.js"
|
||||
},
|
||||
"nyc": {
|
||||
"include": [
|
||||
"lib/**.js"
|
||||
]
|
||||
},
|
||||
"license": "MIT"
|
||||
}
|
9
node_modules/readable-stream/readable-browser.js
generated
vendored
Normal file
9
node_modules/readable-stream/readable-browser.js
generated
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
exports = module.exports = require('./lib/_stream_readable.js');
|
||||
exports.Stream = exports;
|
||||
exports.Readable = exports;
|
||||
exports.Writable = require('./lib/_stream_writable.js');
|
||||
exports.Duplex = require('./lib/_stream_duplex.js');
|
||||
exports.Transform = require('./lib/_stream_transform.js');
|
||||
exports.PassThrough = require('./lib/_stream_passthrough.js');
|
||||
exports.finished = require('./lib/internal/streams/end-of-stream.js');
|
||||
exports.pipeline = require('./lib/internal/streams/pipeline.js');
|
16
node_modules/readable-stream/readable.js
generated
vendored
Normal file
16
node_modules/readable-stream/readable.js
generated
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
var Stream = require('stream');
|
||||
if (process.env.READABLE_STREAM === 'disable' && Stream) {
|
||||
module.exports = Stream.Readable;
|
||||
Object.assign(module.exports, Stream);
|
||||
module.exports.Stream = Stream;
|
||||
} else {
|
||||
exports = module.exports = require('./lib/_stream_readable.js');
|
||||
exports.Stream = Stream || exports;
|
||||
exports.Readable = exports;
|
||||
exports.Writable = require('./lib/_stream_writable.js');
|
||||
exports.Duplex = require('./lib/_stream_duplex.js');
|
||||
exports.Transform = require('./lib/_stream_transform.js');
|
||||
exports.PassThrough = require('./lib/_stream_passthrough.js');
|
||||
exports.finished = require('./lib/internal/streams/end-of-stream.js');
|
||||
exports.pipeline = require('./lib/internal/streams/pipeline.js');
|
||||
}
|
21
node_modules/safe-buffer/LICENSE
generated
vendored
Normal file
21
node_modules/safe-buffer/LICENSE
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Feross Aboukhadijeh
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
584
node_modules/safe-buffer/README.md
generated
vendored
Normal file
584
node_modules/safe-buffer/README.md
generated
vendored
Normal file
@ -0,0 +1,584 @@
|
||||
# safe-buffer [![travis][travis-image]][travis-url] [![npm][npm-image]][npm-url] [![downloads][downloads-image]][downloads-url] [![javascript style guide][standard-image]][standard-url]
|
||||
|
||||
[travis-image]: https://img.shields.io/travis/feross/safe-buffer/master.svg
|
||||
[travis-url]: https://travis-ci.org/feross/safe-buffer
|
||||
[npm-image]: https://img.shields.io/npm/v/safe-buffer.svg
|
||||
[npm-url]: https://npmjs.org/package/safe-buffer
|
||||
[downloads-image]: https://img.shields.io/npm/dm/safe-buffer.svg
|
||||
[downloads-url]: https://npmjs.org/package/safe-buffer
|
||||
[standard-image]: https://img.shields.io/badge/code_style-standard-brightgreen.svg
|
||||
[standard-url]: https://standardjs.com
|
||||
|
||||
#### Safer Node.js Buffer API
|
||||
|
||||
**Use the new Node.js Buffer APIs (`Buffer.from`, `Buffer.alloc`,
|
||||
`Buffer.allocUnsafe`, `Buffer.allocUnsafeSlow`) in all versions of Node.js.**
|
||||
|
||||
**Uses the built-in implementation when available.**
|
||||
|
||||
## install
|
||||
|
||||
```
|
||||
npm install safe-buffer
|
||||
```
|
||||
|
||||
## usage
|
||||
|
||||
The goal of this package is to provide a safe replacement for the node.js `Buffer`.
|
||||
|
||||
It's a drop-in replacement for `Buffer`. You can use it by adding one `require` line to
|
||||
the top of your node.js modules:
|
||||
|
||||
```js
|
||||
var Buffer = require('safe-buffer').Buffer
|
||||
|
||||
// Existing buffer code will continue to work without issues:
|
||||
|
||||
new Buffer('hey', 'utf8')
|
||||
new Buffer([1, 2, 3], 'utf8')
|
||||
new Buffer(obj)
|
||||
new Buffer(16) // create an uninitialized buffer (potentially unsafe)
|
||||
|
||||
// But you can use these new explicit APIs to make clear what you want:
|
||||
|
||||
Buffer.from('hey', 'utf8') // convert from many types to a Buffer
|
||||
Buffer.alloc(16) // create a zero-filled buffer (safe)
|
||||
Buffer.allocUnsafe(16) // create an uninitialized buffer (potentially unsafe)
|
||||
```
|
||||
|
||||
## api
|
||||
|
||||
### Class Method: Buffer.from(array)
|
||||
<!-- YAML
|
||||
added: v3.0.0
|
||||
-->
|
||||
|
||||
* `array` {Array}
|
||||
|
||||
Allocates a new `Buffer` using an `array` of octets.
|
||||
|
||||
```js
|
||||
const buf = Buffer.from([0x62,0x75,0x66,0x66,0x65,0x72]);
|
||||
// creates a new Buffer containing ASCII bytes
|
||||
// ['b','u','f','f','e','r']
|
||||
```
|
||||
|
||||
A `TypeError` will be thrown if `array` is not an `Array`.
|
||||
|
||||
### Class Method: Buffer.from(arrayBuffer[, byteOffset[, length]])
|
||||
<!-- YAML
|
||||
added: v5.10.0
|
||||
-->
|
||||
|
||||
* `arrayBuffer` {ArrayBuffer} The `.buffer` property of a `TypedArray` or
|
||||
a `new ArrayBuffer()`
|
||||
* `byteOffset` {Number} Default: `0`
|
||||
* `length` {Number} Default: `arrayBuffer.length - byteOffset`
|
||||
|
||||
When passed a reference to the `.buffer` property of a `TypedArray` instance,
|
||||
the newly created `Buffer` will share the same allocated memory as the
|
||||
TypedArray.
|
||||
|
||||
```js
|
||||
const arr = new Uint16Array(2);
|
||||
arr[0] = 5000;
|
||||
arr[1] = 4000;
|
||||
|
||||
const buf = Buffer.from(arr.buffer); // shares the memory with arr;
|
||||
|
||||
console.log(buf);
|
||||
// Prints: <Buffer 88 13 a0 0f>
|
||||
|
||||
// changing the TypedArray changes the Buffer also
|
||||
arr[1] = 6000;
|
||||
|
||||
console.log(buf);
|
||||
// Prints: <Buffer 88 13 70 17>
|
||||
```
|
||||
|
||||
The optional `byteOffset` and `length` arguments specify a memory range within
|
||||
the `arrayBuffer` that will be shared by the `Buffer`.
|
||||
|
||||
```js
|
||||
const ab = new ArrayBuffer(10);
|
||||
const buf = Buffer.from(ab, 0, 2);
|
||||
console.log(buf.length);
|
||||
// Prints: 2
|
||||
```
|
||||
|
||||
A `TypeError` will be thrown if `arrayBuffer` is not an `ArrayBuffer`.
|
||||
|
||||
### Class Method: Buffer.from(buffer)
|
||||
<!-- YAML
|
||||
added: v3.0.0
|
||||
-->
|
||||
|
||||
* `buffer` {Buffer}
|
||||
|
||||
Copies the passed `buffer` data onto a new `Buffer` instance.
|
||||
|
||||
```js
|
||||
const buf1 = Buffer.from('buffer');
|
||||
const buf2 = Buffer.from(buf1);
|
||||
|
||||
buf1[0] = 0x61;
|
||||
console.log(buf1.toString());
|
||||
// 'auffer'
|
||||
console.log(buf2.toString());
|
||||
// 'buffer' (copy is not changed)
|
||||
```
|
||||
|
||||
A `TypeError` will be thrown if `buffer` is not a `Buffer`.
|
||||
|
||||
### Class Method: Buffer.from(str[, encoding])
|
||||
<!-- YAML
|
||||
added: v5.10.0
|
||||
-->
|
||||
|
||||
* `str` {String} String to encode.
|
||||
* `encoding` {String} Encoding to use, Default: `'utf8'`
|
||||
|
||||
Creates a new `Buffer` containing the given JavaScript string `str`. If
|
||||
provided, the `encoding` parameter identifies the character encoding.
|
||||
If not provided, `encoding` defaults to `'utf8'`.
|
||||
|
||||
```js
|
||||
const buf1 = Buffer.from('this is a tést');
|
||||
console.log(buf1.toString());
|
||||
// prints: this is a tést
|
||||
console.log(buf1.toString('ascii'));
|
||||
// prints: this is a tC)st
|
||||
|
||||
const buf2 = Buffer.from('7468697320697320612074c3a97374', 'hex');
|
||||
console.log(buf2.toString());
|
||||
// prints: this is a tést
|
||||
```
|
||||
|
||||
A `TypeError` will be thrown if `str` is not a string.
|
||||
|
||||
### Class Method: Buffer.alloc(size[, fill[, encoding]])
|
||||
<!-- YAML
|
||||
added: v5.10.0
|
||||
-->
|
||||
|
||||
* `size` {Number}
|
||||
* `fill` {Value} Default: `undefined`
|
||||
* `encoding` {String} Default: `utf8`
|
||||
|
||||
Allocates a new `Buffer` of `size` bytes. If `fill` is `undefined`, the
|
||||
`Buffer` will be *zero-filled*.
|
||||
|
||||
```js
|
||||
const buf = Buffer.alloc(5);
|
||||
console.log(buf);
|
||||
// <Buffer 00 00 00 00 00>
|
||||
```
|
||||
|
||||
The `size` must be less than or equal to the value of
|
||||
`require('buffer').kMaxLength` (on 64-bit architectures, `kMaxLength` is
|
||||
`(2^31)-1`). Otherwise, a [`RangeError`][] is thrown. A zero-length Buffer will
|
||||
be created if a `size` less than or equal to 0 is specified.
|
||||
|
||||
If `fill` is specified, the allocated `Buffer` will be initialized by calling
|
||||
`buf.fill(fill)`. See [`buf.fill()`][] for more information.
|
||||
|
||||
```js
|
||||
const buf = Buffer.alloc(5, 'a');
|
||||
console.log(buf);
|
||||
// <Buffer 61 61 61 61 61>
|
||||
```
|
||||
|
||||
If both `fill` and `encoding` are specified, the allocated `Buffer` will be
|
||||
initialized by calling `buf.fill(fill, encoding)`. For example:
|
||||
|
||||
```js
|
||||
const buf = Buffer.alloc(11, 'aGVsbG8gd29ybGQ=', 'base64');
|
||||
console.log(buf);
|
||||
// <Buffer 68 65 6c 6c 6f 20 77 6f 72 6c 64>
|
||||
```
|
||||
|
||||
Calling `Buffer.alloc(size)` can be significantly slower than the alternative
|
||||
`Buffer.allocUnsafe(size)` but ensures that the newly created `Buffer` instance
|
||||
contents will *never contain sensitive data*.
|
||||
|
||||
A `TypeError` will be thrown if `size` is not a number.
|
||||
|
||||
### Class Method: Buffer.allocUnsafe(size)
|
||||
<!-- YAML
|
||||
added: v5.10.0
|
||||
-->
|
||||
|
||||
* `size` {Number}
|
||||
|
||||
Allocates a new *non-zero-filled* `Buffer` of `size` bytes. The `size` must
|
||||
be less than or equal to the value of `require('buffer').kMaxLength` (on 64-bit
|
||||
architectures, `kMaxLength` is `(2^31)-1`). Otherwise, a [`RangeError`][] is
|
||||
thrown. A zero-length Buffer will be created if a `size` less than or equal to
|
||||
0 is specified.
|
||||
|
||||
The underlying memory for `Buffer` instances created in this way is *not
|
||||
initialized*. The contents of the newly created `Buffer` are unknown and
|
||||
*may contain sensitive data*. Use [`buf.fill(0)`][] to initialize such
|
||||
`Buffer` instances to zeroes.
|
||||
|
||||
```js
|
||||
const buf = Buffer.allocUnsafe(5);
|
||||
console.log(buf);
|
||||
// <Buffer 78 e0 82 02 01>
|
||||
// (octets will be different, every time)
|
||||
buf.fill(0);
|
||||
console.log(buf);
|
||||
// <Buffer 00 00 00 00 00>
|
||||
```
|
||||
|
||||
A `TypeError` will be thrown if `size` is not a number.
|
||||
|
||||
Note that the `Buffer` module pre-allocates an internal `Buffer` instance of
|
||||
size `Buffer.poolSize` that is used as a pool for the fast allocation of new
|
||||
`Buffer` instances created using `Buffer.allocUnsafe(size)` (and the deprecated
|
||||
`new Buffer(size)` constructor) only when `size` is less than or equal to
|
||||
`Buffer.poolSize >> 1` (floor of `Buffer.poolSize` divided by two). The default
|
||||
value of `Buffer.poolSize` is `8192` but can be modified.
|
||||
|
||||
Use of this pre-allocated internal memory pool is a key difference between
|
||||
calling `Buffer.alloc(size, fill)` vs. `Buffer.allocUnsafe(size).fill(fill)`.
|
||||
Specifically, `Buffer.alloc(size, fill)` will *never* use the internal Buffer
|
||||
pool, while `Buffer.allocUnsafe(size).fill(fill)` *will* use the internal
|
||||
Buffer pool if `size` is less than or equal to half `Buffer.poolSize`. The
|
||||
difference is subtle but can be important when an application requires the
|
||||
additional performance that `Buffer.allocUnsafe(size)` provides.
|
||||
|
||||
### Class Method: Buffer.allocUnsafeSlow(size)
|
||||
<!-- YAML
|
||||
added: v5.10.0
|
||||
-->
|
||||
|
||||
* `size` {Number}
|
||||
|
||||
Allocates a new *non-zero-filled* and non-pooled `Buffer` of `size` bytes. The
|
||||
`size` must be less than or equal to the value of
|
||||
`require('buffer').kMaxLength` (on 64-bit architectures, `kMaxLength` is
|
||||
`(2^31)-1`). Otherwise, a [`RangeError`][] is thrown. A zero-length Buffer will
|
||||
be created if a `size` less than or equal to 0 is specified.
|
||||
|
||||
The underlying memory for `Buffer` instances created in this way is *not
|
||||
initialized*. The contents of the newly created `Buffer` are unknown and
|
||||
*may contain sensitive data*. Use [`buf.fill(0)`][] to initialize such
|
||||
`Buffer` instances to zeroes.
|
||||
|
||||
When using `Buffer.allocUnsafe()` to allocate new `Buffer` instances,
|
||||
allocations under 4KB are, by default, sliced from a single pre-allocated
|
||||
`Buffer`. This allows applications to avoid the garbage collection overhead of
|
||||
creating many individually allocated Buffers. This approach improves both
|
||||
performance and memory usage by eliminating the need to track and cleanup as
|
||||
many `Persistent` objects.
|
||||
|
||||
However, in the case where a developer may need to retain a small chunk of
|
||||
memory from a pool for an indeterminate amount of time, it may be appropriate
|
||||
to create an un-pooled Buffer instance using `Buffer.allocUnsafeSlow()` then
|
||||
copy out the relevant bits.
|
||||
|
||||
```js
|
||||
// need to keep around a few small chunks of memory
|
||||
const store = [];
|
||||
|
||||
socket.on('readable', () => {
|
||||
const data = socket.read();
|
||||
// allocate for retained data
|
||||
const sb = Buffer.allocUnsafeSlow(10);
|
||||
// copy the data into the new allocation
|
||||
data.copy(sb, 0, 0, 10);
|
||||
store.push(sb);
|
||||
});
|
||||
```
|
||||
|
||||
Use of `Buffer.allocUnsafeSlow()` should be used only as a last resort *after*
|
||||
a developer has observed undue memory retention in their applications.
|
||||
|
||||
A `TypeError` will be thrown if `size` is not a number.
|
||||
|
||||
### All the Rest
|
||||
|
||||
The rest of the `Buffer` API is exactly the same as in node.js.
|
||||
[See the docs](https://nodejs.org/api/buffer.html).
|
||||
|
||||
|
||||
## Related links
|
||||
|
||||
- [Node.js issue: Buffer(number) is unsafe](https://github.com/nodejs/node/issues/4660)
|
||||
- [Node.js Enhancement Proposal: Buffer.from/Buffer.alloc/Buffer.zalloc/Buffer() soft-deprecate](https://github.com/nodejs/node-eps/pull/4)
|
||||
|
||||
## Why is `Buffer` unsafe?
|
||||
|
||||
Today, the node.js `Buffer` constructor is overloaded to handle many different argument
|
||||
types like `String`, `Array`, `Object`, `TypedArrayView` (`Uint8Array`, etc.),
|
||||
`ArrayBuffer`, and also `Number`.
|
||||
|
||||
The API is optimized for convenience: you can throw any type at it, and it will try to do
|
||||
what you want.
|
||||
|
||||
Because the Buffer constructor is so powerful, you often see code like this:
|
||||
|
||||
```js
|
||||
// Convert UTF-8 strings to hex
|
||||
function toHex (str) {
|
||||
return new Buffer(str).toString('hex')
|
||||
}
|
||||
```
|
||||
|
||||
***But what happens if `toHex` is called with a `Number` argument?***
|
||||
|
||||
### Remote Memory Disclosure
|
||||
|
||||
If an attacker can make your program call the `Buffer` constructor with a `Number`
|
||||
argument, then they can make it allocate uninitialized memory from the node.js process.
|
||||
This could potentially disclose TLS private keys, user data, or database passwords.
|
||||
|
||||
When the `Buffer` constructor is passed a `Number` argument, it returns an
|
||||
**UNINITIALIZED** block of memory of the specified `size`. When you create a `Buffer` like
|
||||
this, you **MUST** overwrite the contents before returning it to the user.
|
||||
|
||||
From the [node.js docs](https://nodejs.org/api/buffer.html#buffer_new_buffer_size):
|
||||
|
||||
> `new Buffer(size)`
|
||||
>
|
||||
> - `size` Number
|
||||
>
|
||||
> The underlying memory for `Buffer` instances created in this way is not initialized.
|
||||
> **The contents of a newly created `Buffer` are unknown and could contain sensitive
|
||||
> data.** Use `buf.fill(0)` to initialize a Buffer to zeroes.
|
||||
|
||||
(Emphasis our own.)
|
||||
|
||||
Whenever the programmer intended to create an uninitialized `Buffer` you often see code
|
||||
like this:
|
||||
|
||||
```js
|
||||
var buf = new Buffer(16)
|
||||
|
||||
// Immediately overwrite the uninitialized buffer with data from another buffer
|
||||
for (var i = 0; i < buf.length; i++) {
|
||||
buf[i] = otherBuf[i]
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
### Would this ever be a problem in real code?
|
||||
|
||||
Yes. It's surprisingly common to forget to check the type of your variables in a
|
||||
dynamically-typed language like JavaScript.
|
||||
|
||||
Usually the consequences of assuming the wrong type is that your program crashes with an
|
||||
uncaught exception. But the failure mode for forgetting to check the type of arguments to
|
||||
the `Buffer` constructor is more catastrophic.
|
||||
|
||||
Here's an example of a vulnerable service that takes a JSON payload and converts it to
|
||||
hex:
|
||||
|
||||
```js
|
||||
// Take a JSON payload {str: "some string"} and convert it to hex
|
||||
var server = http.createServer(function (req, res) {
|
||||
var data = ''
|
||||
req.setEncoding('utf8')
|
||||
req.on('data', function (chunk) {
|
||||
data += chunk
|
||||
})
|
||||
req.on('end', function () {
|
||||
var body = JSON.parse(data)
|
||||
res.end(new Buffer(body.str).toString('hex'))
|
||||
})
|
||||
})
|
||||
|
||||
server.listen(8080)
|
||||
```
|
||||
|
||||
In this example, an http client just has to send:
|
||||
|
||||
```json
|
||||
{
|
||||
"str": 1000
|
||||
}
|
||||
```
|
||||
|
||||
and it will get back 1,000 bytes of uninitialized memory from the server.
|
||||
|
||||
This is a very serious bug. It's similar in severity to the
|
||||
[the Heartbleed bug](http://heartbleed.com/) that allowed disclosure of OpenSSL process
|
||||
memory by remote attackers.
|
||||
|
||||
|
||||
### Which real-world packages were vulnerable?
|
||||
|
||||
#### [`bittorrent-dht`](https://www.npmjs.com/package/bittorrent-dht)
|
||||
|
||||
[Mathias Buus](https://github.com/mafintosh) and I
|
||||
([Feross Aboukhadijeh](http://feross.org/)) found this issue in one of our own packages,
|
||||
[`bittorrent-dht`](https://www.npmjs.com/package/bittorrent-dht). The bug would allow
|
||||
anyone on the internet to send a series of messages to a user of `bittorrent-dht` and get
|
||||
them to reveal 20 bytes at a time of uninitialized memory from the node.js process.
|
||||
|
||||
Here's
|
||||
[the commit](https://github.com/feross/bittorrent-dht/commit/6c7da04025d5633699800a99ec3fbadf70ad35b8)
|
||||
that fixed it. We released a new fixed version, created a
|
||||
[Node Security Project disclosure](https://nodesecurity.io/advisories/68), and deprecated all
|
||||
vulnerable versions on npm so users will get a warning to upgrade to a newer version.
|
||||
|
||||
#### [`ws`](https://www.npmjs.com/package/ws)
|
||||
|
||||
That got us wondering if there were other vulnerable packages. Sure enough, within a short
|
||||
period of time, we found the same issue in [`ws`](https://www.npmjs.com/package/ws), the
|
||||
most popular WebSocket implementation in node.js.
|
||||
|
||||
If certain APIs were called with `Number` parameters instead of `String` or `Buffer` as
|
||||
expected, then uninitialized server memory would be disclosed to the remote peer.
|
||||
|
||||
These were the vulnerable methods:
|
||||
|
||||
```js
|
||||
socket.send(number)
|
||||
socket.ping(number)
|
||||
socket.pong(number)
|
||||
```
|
||||
|
||||
Here's a vulnerable socket server with some echo functionality:
|
||||
|
||||
```js
|
||||
server.on('connection', function (socket) {
|
||||
socket.on('message', function (message) {
|
||||
message = JSON.parse(message)
|
||||
if (message.type === 'echo') {
|
||||
socket.send(message.data) // send back the user's message
|
||||
}
|
||||
})
|
||||
})
|
||||
```
|
||||
|
||||
`socket.send(number)` called on the server, will disclose server memory.
|
||||
|
||||
Here's [the release](https://github.com/websockets/ws/releases/tag/1.0.1) where the issue
|
||||
was fixed, with a more detailed explanation. Props to
|
||||
[Arnout Kazemier](https://github.com/3rd-Eden) for the quick fix. Here's the
|
||||
[Node Security Project disclosure](https://nodesecurity.io/advisories/67).
|
||||
|
||||
|
||||
### What's the solution?
|
||||
|
||||
It's important that node.js offers a fast way to get memory otherwise performance-critical
|
||||
applications would needlessly get a lot slower.
|
||||
|
||||
But we need a better way to *signal our intent* as programmers. **When we want
|
||||
uninitialized memory, we should request it explicitly.**
|
||||
|
||||
Sensitive functionality should not be packed into a developer-friendly API that loosely
|
||||
accepts many different types. This type of API encourages the lazy practice of passing
|
||||
variables in without checking the type very carefully.
|
||||
|
||||
#### A new API: `Buffer.allocUnsafe(number)`
|
||||
|
||||
The functionality of creating buffers with uninitialized memory should be part of another
|
||||
API. We propose `Buffer.allocUnsafe(number)`. This way, it's not part of an API that
|
||||
frequently gets user input of all sorts of different types passed into it.
|
||||
|
||||
```js
|
||||
var buf = Buffer.allocUnsafe(16) // careful, uninitialized memory!
|
||||
|
||||
// Immediately overwrite the uninitialized buffer with data from another buffer
|
||||
for (var i = 0; i < buf.length; i++) {
|
||||
buf[i] = otherBuf[i]
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
### How do we fix node.js core?
|
||||
|
||||
We sent [a PR to node.js core](https://github.com/nodejs/node/pull/4514) (merged as
|
||||
`semver-major`) which defends against one case:
|
||||
|
||||
```js
|
||||
var str = 16
|
||||
new Buffer(str, 'utf8')
|
||||
```
|
||||
|
||||
In this situation, it's implied that the programmer intended the first argument to be a
|
||||
string, since they passed an encoding as a second argument. Today, node.js will allocate
|
||||
uninitialized memory in the case of `new Buffer(number, encoding)`, which is probably not
|
||||
what the programmer intended.
|
||||
|
||||
But this is only a partial solution, since if the programmer does `new Buffer(variable)`
|
||||
(without an `encoding` parameter) there's no way to know what they intended. If `variable`
|
||||
is sometimes a number, then uninitialized memory will sometimes be returned.
|
||||
|
||||
### What's the real long-term fix?
|
||||
|
||||
We could deprecate and remove `new Buffer(number)` and use `Buffer.allocUnsafe(number)` when
|
||||
we need uninitialized memory. But that would break 1000s of packages.
|
||||
|
||||
~~We believe the best solution is to:~~
|
||||
|
||||
~~1. Change `new Buffer(number)` to return safe, zeroed-out memory~~
|
||||
|
||||
~~2. Create a new API for creating uninitialized Buffers. We propose: `Buffer.allocUnsafe(number)`~~
|
||||
|
||||
#### Update
|
||||
|
||||
We now support adding three new APIs:
|
||||
|
||||
- `Buffer.from(value)` - convert from any type to a buffer
|
||||
- `Buffer.alloc(size)` - create a zero-filled buffer
|
||||
- `Buffer.allocUnsafe(size)` - create an uninitialized buffer with given size
|
||||
|
||||
This solves the core problem that affected `ws` and `bittorrent-dht` which is
|
||||
`Buffer(variable)` getting tricked into taking a number argument.
|
||||
|
||||
This way, existing code continues working and the impact on the npm ecosystem will be
|
||||
minimal. Over time, npm maintainers can migrate performance-critical code to use
|
||||
`Buffer.allocUnsafe(number)` instead of `new Buffer(number)`.
|
||||
|
||||
|
||||
### Conclusion
|
||||
|
||||
We think there's a serious design issue with the `Buffer` API as it exists today. It
|
||||
promotes insecure software by putting high-risk functionality into a convenient API
|
||||
with friendly "developer ergonomics".
|
||||
|
||||
This wasn't merely a theoretical exercise because we found the issue in some of the
|
||||
most popular npm packages.
|
||||
|
||||
Fortunately, there's an easy fix that can be applied today. Use `safe-buffer` in place of
|
||||
`buffer`.
|
||||
|
||||
```js
|
||||
var Buffer = require('safe-buffer').Buffer
|
||||
```
|
||||
|
||||
Eventually, we hope that node.js core can switch to this new, safer behavior. We believe
|
||||
the impact on the ecosystem would be minimal since it's not a breaking change.
|
||||
Well-maintained, popular packages would be updated to use `Buffer.alloc` quickly, while
|
||||
older, insecure packages would magically become safe from this attack vector.
|
||||
|
||||
|
||||
## links
|
||||
|
||||
- [Node.js PR: buffer: throw if both length and enc are passed](https://github.com/nodejs/node/pull/4514)
|
||||
- [Node Security Project disclosure for `ws`](https://nodesecurity.io/advisories/67)
|
||||
- [Node Security Project disclosure for`bittorrent-dht`](https://nodesecurity.io/advisories/68)
|
||||
|
||||
|
||||
## credit
|
||||
|
||||
The original issues in `bittorrent-dht`
|
||||
([disclosure](https://nodesecurity.io/advisories/68)) and
|
||||
`ws` ([disclosure](https://nodesecurity.io/advisories/67)) were discovered by
|
||||
[Mathias Buus](https://github.com/mafintosh) and
|
||||
[Feross Aboukhadijeh](http://feross.org/).
|
||||
|
||||
Thanks to [Adam Baldwin](https://github.com/evilpacket) for helping disclose these issues
|
||||
and for his work running the [Node Security Project](https://nodesecurity.io/).
|
||||
|
||||
Thanks to [John Hiesey](https://github.com/jhiesey) for proofreading this README and
|
||||
auditing the code.
|
||||
|
||||
|
||||
## license
|
||||
|
||||
MIT. Copyright (C) [Feross Aboukhadijeh](http://feross.org)
|
187
node_modules/safe-buffer/index.d.ts
generated
vendored
Normal file
187
node_modules/safe-buffer/index.d.ts
generated
vendored
Normal file
@ -0,0 +1,187 @@
|
||||
declare module "safe-buffer" {
|
||||
export class Buffer {
|
||||
length: number
|
||||
write(string: string, offset?: number, length?: number, encoding?: string): number;
|
||||
toString(encoding?: string, start?: number, end?: number): string;
|
||||
toJSON(): { type: 'Buffer', data: any[] };
|
||||
equals(otherBuffer: Buffer): boolean;
|
||||
compare(otherBuffer: Buffer, targetStart?: number, targetEnd?: number, sourceStart?: number, sourceEnd?: number): number;
|
||||
copy(targetBuffer: Buffer, targetStart?: number, sourceStart?: number, sourceEnd?: number): number;
|
||||
slice(start?: number, end?: number): Buffer;
|
||||
writeUIntLE(value: number, offset: number, byteLength: number, noAssert?: boolean): number;
|
||||
writeUIntBE(value: number, offset: number, byteLength: number, noAssert?: boolean): number;
|
||||
writeIntLE(value: number, offset: number, byteLength: number, noAssert?: boolean): number;
|
||||
writeIntBE(value: number, offset: number, byteLength: number, noAssert?: boolean): number;
|
||||
readUIntLE(offset: number, byteLength: number, noAssert?: boolean): number;
|
||||
readUIntBE(offset: number, byteLength: number, noAssert?: boolean): number;
|
||||
readIntLE(offset: number, byteLength: number, noAssert?: boolean): number;
|
||||
readIntBE(offset: number, byteLength: number, noAssert?: boolean): number;
|
||||
readUInt8(offset: number, noAssert?: boolean): number;
|
||||
readUInt16LE(offset: number, noAssert?: boolean): number;
|
||||
readUInt16BE(offset: number, noAssert?: boolean): number;
|
||||
readUInt32LE(offset: number, noAssert?: boolean): number;
|
||||
readUInt32BE(offset: number, noAssert?: boolean): number;
|
||||
readInt8(offset: number, noAssert?: boolean): number;
|
||||
readInt16LE(offset: number, noAssert?: boolean): number;
|
||||
readInt16BE(offset: number, noAssert?: boolean): number;
|
||||
readInt32LE(offset: number, noAssert?: boolean): number;
|
||||
readInt32BE(offset: number, noAssert?: boolean): number;
|
||||
readFloatLE(offset: number, noAssert?: boolean): number;
|
||||
readFloatBE(offset: number, noAssert?: boolean): number;
|
||||
readDoubleLE(offset: number, noAssert?: boolean): number;
|
||||
readDoubleBE(offset: number, noAssert?: boolean): number;
|
||||
swap16(): Buffer;
|
||||
swap32(): Buffer;
|
||||
swap64(): Buffer;
|
||||
writeUInt8(value: number, offset: number, noAssert?: boolean): number;
|
||||
writeUInt16LE(value: number, offset: number, noAssert?: boolean): number;
|
||||
writeUInt16BE(value: number, offset: number, noAssert?: boolean): number;
|
||||
writeUInt32LE(value: number, offset: number, noAssert?: boolean): number;
|
||||
writeUInt32BE(value: number, offset: number, noAssert?: boolean): number;
|
||||
writeInt8(value: number, offset: number, noAssert?: boolean): number;
|
||||
writeInt16LE(value: number, offset: number, noAssert?: boolean): number;
|
||||
writeInt16BE(value: number, offset: number, noAssert?: boolean): number;
|
||||
writeInt32LE(value: number, offset: number, noAssert?: boolean): number;
|
||||
writeInt32BE(value: number, offset: number, noAssert?: boolean): number;
|
||||
writeFloatLE(value: number, offset: number, noAssert?: boolean): number;
|
||||
writeFloatBE(value: number, offset: number, noAssert?: boolean): number;
|
||||
writeDoubleLE(value: number, offset: number, noAssert?: boolean): number;
|
||||
writeDoubleBE(value: number, offset: number, noAssert?: boolean): number;
|
||||
fill(value: any, offset?: number, end?: number): this;
|
||||
indexOf(value: string | number | Buffer, byteOffset?: number, encoding?: string): number;
|
||||
lastIndexOf(value: string | number | Buffer, byteOffset?: number, encoding?: string): number;
|
||||
includes(value: string | number | Buffer, byteOffset?: number, encoding?: string): boolean;
|
||||
|
||||
/**
|
||||
* Allocates a new buffer containing the given {str}.
|
||||
*
|
||||
* @param str String to store in buffer.
|
||||
* @param encoding encoding to use, optional. Default is 'utf8'
|
||||
*/
|
||||
constructor (str: string, encoding?: string);
|
||||
/**
|
||||
* Allocates a new buffer of {size} octets.
|
||||
*
|
||||
* @param size count of octets to allocate.
|
||||
*/
|
||||
constructor (size: number);
|
||||
/**
|
||||
* Allocates a new buffer containing the given {array} of octets.
|
||||
*
|
||||
* @param array The octets to store.
|
||||
*/
|
||||
constructor (array: Uint8Array);
|
||||
/**
|
||||
* Produces a Buffer backed by the same allocated memory as
|
||||
* the given {ArrayBuffer}.
|
||||
*
|
||||
*
|
||||
* @param arrayBuffer The ArrayBuffer with which to share memory.
|
||||
*/
|
||||
constructor (arrayBuffer: ArrayBuffer);
|
||||
/**
|
||||
* Allocates a new buffer containing the given {array} of octets.
|
||||
*
|
||||
* @param array The octets to store.
|
||||
*/
|
||||
constructor (array: any[]);
|
||||
/**
|
||||
* Copies the passed {buffer} data onto a new {Buffer} instance.
|
||||
*
|
||||
* @param buffer The buffer to copy.
|
||||
*/
|
||||
constructor (buffer: Buffer);
|
||||
prototype: Buffer;
|
||||
/**
|
||||
* Allocates a new Buffer using an {array} of octets.
|
||||
*
|
||||
* @param array
|
||||
*/
|
||||
static from(array: any[]): Buffer;
|
||||
/**
|
||||
* When passed a reference to the .buffer property of a TypedArray instance,
|
||||
* the newly created Buffer will share the same allocated memory as the TypedArray.
|
||||
* The optional {byteOffset} and {length} arguments specify a memory range
|
||||
* within the {arrayBuffer} that will be shared by the Buffer.
|
||||
*
|
||||
* @param arrayBuffer The .buffer property of a TypedArray or a new ArrayBuffer()
|
||||
* @param byteOffset
|
||||
* @param length
|
||||
*/
|
||||
static from(arrayBuffer: ArrayBuffer, byteOffset?: number, length?: number): Buffer;
|
||||
/**
|
||||
* Copies the passed {buffer} data onto a new Buffer instance.
|
||||
*
|
||||
* @param buffer
|
||||
*/
|
||||
static from(buffer: Buffer): Buffer;
|
||||
/**
|
||||
* Creates a new Buffer containing the given JavaScript string {str}.
|
||||
* If provided, the {encoding} parameter identifies the character encoding.
|
||||
* If not provided, {encoding} defaults to 'utf8'.
|
||||
*
|
||||
* @param str
|
||||
*/
|
||||
static from(str: string, encoding?: string): Buffer;
|
||||
/**
|
||||
* Returns true if {obj} is a Buffer
|
||||
*
|
||||
* @param obj object to test.
|
||||
*/
|
||||
static isBuffer(obj: any): obj is Buffer;
|
||||
/**
|
||||
* Returns true if {encoding} is a valid encoding argument.
|
||||
* Valid string encodings in Node 0.12: 'ascii'|'utf8'|'utf16le'|'ucs2'(alias of 'utf16le')|'base64'|'binary'(deprecated)|'hex'
|
||||
*
|
||||
* @param encoding string to test.
|
||||
*/
|
||||
static isEncoding(encoding: string): boolean;
|
||||
/**
|
||||
* Gives the actual byte length of a string. encoding defaults to 'utf8'.
|
||||
* This is not the same as String.prototype.length since that returns the number of characters in a string.
|
||||
*
|
||||
* @param string string to test.
|
||||
* @param encoding encoding used to evaluate (defaults to 'utf8')
|
||||
*/
|
||||
static byteLength(string: string, encoding?: string): number;
|
||||
/**
|
||||
* Returns a buffer which is the result of concatenating all the buffers in the list together.
|
||||
*
|
||||
* If the list has no items, or if the totalLength is 0, then it returns a zero-length buffer.
|
||||
* If the list has exactly one item, then the first item of the list is returned.
|
||||
* If the list has more than one item, then a new Buffer is created.
|
||||
*
|
||||
* @param list An array of Buffer objects to concatenate
|
||||
* @param totalLength Total length of the buffers when concatenated.
|
||||
* If totalLength is not provided, it is read from the buffers in the list. However, this adds an additional loop to the function, so it is faster to provide the length explicitly.
|
||||
*/
|
||||
static concat(list: Buffer[], totalLength?: number): Buffer;
|
||||
/**
|
||||
* The same as buf1.compare(buf2).
|
||||
*/
|
||||
static compare(buf1: Buffer, buf2: Buffer): number;
|
||||
/**
|
||||
* Allocates a new buffer of {size} octets.
|
||||
*
|
||||
* @param size count of octets to allocate.
|
||||
* @param fill if specified, buffer will be initialized by calling buf.fill(fill).
|
||||
* If parameter is omitted, buffer will be filled with zeros.
|
||||
* @param encoding encoding used for call to buf.fill while initalizing
|
||||
*/
|
||||
static alloc(size: number, fill?: string | Buffer | number, encoding?: string): Buffer;
|
||||
/**
|
||||
* Allocates a new buffer of {size} octets, leaving memory not initialized, so the contents
|
||||
* of the newly created Buffer are unknown and may contain sensitive data.
|
||||
*
|
||||
* @param size count of octets to allocate
|
||||
*/
|
||||
static allocUnsafe(size: number): Buffer;
|
||||
/**
|
||||
* Allocates a new non-pooled buffer of {size} octets, leaving memory not initialized, so the contents
|
||||
* of the newly created Buffer are unknown and may contain sensitive data.
|
||||
*
|
||||
* @param size count of octets to allocate
|
||||
*/
|
||||
static allocUnsafeSlow(size: number): Buffer;
|
||||
}
|
||||
}
|
65
node_modules/safe-buffer/index.js
generated
vendored
Normal file
65
node_modules/safe-buffer/index.js
generated
vendored
Normal file
@ -0,0 +1,65 @@
|
||||
/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
||||
/* eslint-disable node/no-deprecated-api */
|
||||
var buffer = require('buffer')
|
||||
var Buffer = buffer.Buffer
|
||||
|
||||
// alternative to using Object.keys for old browsers
|
||||
function copyProps (src, dst) {
|
||||
for (var key in src) {
|
||||
dst[key] = src[key]
|
||||
}
|
||||
}
|
||||
if (Buffer.from && Buffer.alloc && Buffer.allocUnsafe && Buffer.allocUnsafeSlow) {
|
||||
module.exports = buffer
|
||||
} else {
|
||||
// Copy properties from require('buffer')
|
||||
copyProps(buffer, exports)
|
||||
exports.Buffer = SafeBuffer
|
||||
}
|
||||
|
||||
function SafeBuffer (arg, encodingOrOffset, length) {
|
||||
return Buffer(arg, encodingOrOffset, length)
|
||||
}
|
||||
|
||||
SafeBuffer.prototype = Object.create(Buffer.prototype)
|
||||
|
||||
// Copy static methods from Buffer
|
||||
copyProps(Buffer, SafeBuffer)
|
||||
|
||||
SafeBuffer.from = function (arg, encodingOrOffset, length) {
|
||||
if (typeof arg === 'number') {
|
||||
throw new TypeError('Argument must not be a number')
|
||||
}
|
||||
return Buffer(arg, encodingOrOffset, length)
|
||||
}
|
||||
|
||||
SafeBuffer.alloc = function (size, fill, encoding) {
|
||||
if (typeof size !== 'number') {
|
||||
throw new TypeError('Argument must be a number')
|
||||
}
|
||||
var buf = Buffer(size)
|
||||
if (fill !== undefined) {
|
||||
if (typeof encoding === 'string') {
|
||||
buf.fill(fill, encoding)
|
||||
} else {
|
||||
buf.fill(fill)
|
||||
}
|
||||
} else {
|
||||
buf.fill(0)
|
||||
}
|
||||
return buf
|
||||
}
|
||||
|
||||
SafeBuffer.allocUnsafe = function (size) {
|
||||
if (typeof size !== 'number') {
|
||||
throw new TypeError('Argument must be a number')
|
||||
}
|
||||
return Buffer(size)
|
||||
}
|
||||
|
||||
SafeBuffer.allocUnsafeSlow = function (size) {
|
||||
if (typeof size !== 'number') {
|
||||
throw new TypeError('Argument must be a number')
|
||||
}
|
||||
return buffer.SlowBuffer(size)
|
||||
}
|
51
node_modules/safe-buffer/package.json
generated
vendored
Normal file
51
node_modules/safe-buffer/package.json
generated
vendored
Normal file
@ -0,0 +1,51 @@
|
||||
{
|
||||
"name": "safe-buffer",
|
||||
"description": "Safer Node.js Buffer API",
|
||||
"version": "5.2.1",
|
||||
"author": {
|
||||
"name": "Feross Aboukhadijeh",
|
||||
"email": "feross@feross.org",
|
||||
"url": "https://feross.org"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/feross/safe-buffer/issues"
|
||||
},
|
||||
"devDependencies": {
|
||||
"standard": "*",
|
||||
"tape": "^5.0.0"
|
||||
},
|
||||
"homepage": "https://github.com/feross/safe-buffer",
|
||||
"keywords": [
|
||||
"buffer",
|
||||
"buffer allocate",
|
||||
"node security",
|
||||
"safe",
|
||||
"safe-buffer",
|
||||
"security",
|
||||
"uninitialized"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"types": "index.d.ts",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/feross/safe-buffer.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "standard && tape test/*.js"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/feross"
|
||||
},
|
||||
{
|
||||
"type": "patreon",
|
||||
"url": "https://www.patreon.com/feross"
|
||||
},
|
||||
{
|
||||
"type": "consulting",
|
||||
"url": "https://feross.org/support"
|
||||
}
|
||||
]
|
||||
}
|
48
node_modules/string_decoder/LICENSE
generated
vendored
Normal file
48
node_modules/string_decoder/LICENSE
generated
vendored
Normal file
@ -0,0 +1,48 @@
|
||||
Node.js is licensed for use as follows:
|
||||
|
||||
"""
|
||||
Copyright Node.js contributors. All rights reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to
|
||||
deal in the Software without restriction, including without limitation the
|
||||
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
sell copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
IN THE SOFTWARE.
|
||||
"""
|
||||
|
||||
This license applies to parts of Node.js originating from the
|
||||
https://github.com/joyent/node repository:
|
||||
|
||||
"""
|
||||
Copyright Joyent, Inc. and other Node contributors. All rights reserved.
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to
|
||||
deal in the Software without restriction, including without limitation the
|
||||
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
sell copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
IN THE SOFTWARE.
|
||||
"""
|
||||
|
47
node_modules/string_decoder/README.md
generated
vendored
Normal file
47
node_modules/string_decoder/README.md
generated
vendored
Normal file
@ -0,0 +1,47 @@
|
||||
# string_decoder
|
||||
|
||||
***Node-core v8.9.4 string_decoder for userland***
|
||||
|
||||
|
||||
[](https://nodei.co/npm/string_decoder/)
|
||||
[](https://nodei.co/npm/string_decoder/)
|
||||
|
||||
|
||||
```bash
|
||||
npm install --save string_decoder
|
||||
```
|
||||
|
||||
***Node-core string_decoder for userland***
|
||||
|
||||
This package is a mirror of the string_decoder implementation in Node-core.
|
||||
|
||||
Full documentation may be found on the [Node.js website](https://nodejs.org/dist/v8.9.4/docs/api/).
|
||||
|
||||
As of version 1.0.0 **string_decoder** uses semantic versioning.
|
||||
|
||||
## Previous versions
|
||||
|
||||
Previous version numbers match the versions found in Node core, e.g. 0.10.24 matches Node 0.10.24, likewise 0.11.10 matches Node 0.11.10.
|
||||
|
||||
## Update
|
||||
|
||||
The *build/* directory contains a build script that will scrape the source from the [nodejs/node](https://github.com/nodejs/node) repo given a specific Node version.
|
||||
|
||||
## Streams Working Group
|
||||
|
||||
`string_decoder` is maintained by the Streams Working Group, which
|
||||
oversees the development and maintenance of the Streams API within
|
||||
Node.js. The responsibilities of the Streams Working Group include:
|
||||
|
||||
* Addressing stream issues on the Node.js issue tracker.
|
||||
* Authoring and editing stream documentation within the Node.js project.
|
||||
* Reviewing changes to stream subclasses within the Node.js project.
|
||||
* Redirecting changes to streams from the Node.js project to this
|
||||
project.
|
||||
* Assisting in the implementation of stream providers within Node.js.
|
||||
* Recommending versions of `readable-stream` to be included in Node.js.
|
||||
* Messaging about the future of streams to give the community advance
|
||||
notice of changes.
|
||||
|
||||
See [readable-stream](https://github.com/nodejs/readable-stream) for
|
||||
more details.
|
296
node_modules/string_decoder/lib/string_decoder.js
generated
vendored
Normal file
296
node_modules/string_decoder/lib/string_decoder.js
generated
vendored
Normal file
@ -0,0 +1,296 @@
|
||||
// Copyright Joyent, Inc. and other Node contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to permit
|
||||
// persons to whom the Software is furnished to do so, subject to the
|
||||
// following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
||||
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
||||
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
'use strict';
|
||||
|
||||
/*<replacement>*/
|
||||
|
||||
var Buffer = require('safe-buffer').Buffer;
|
||||
/*</replacement>*/
|
||||
|
||||
var isEncoding = Buffer.isEncoding || function (encoding) {
|
||||
encoding = '' + encoding;
|
||||
switch (encoding && encoding.toLowerCase()) {
|
||||
case 'hex':case 'utf8':case 'utf-8':case 'ascii':case 'binary':case 'base64':case 'ucs2':case 'ucs-2':case 'utf16le':case 'utf-16le':case 'raw':
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
function _normalizeEncoding(enc) {
|
||||
if (!enc) return 'utf8';
|
||||
var retried;
|
||||
while (true) {
|
||||
switch (enc) {
|
||||
case 'utf8':
|
||||
case 'utf-8':
|
||||
return 'utf8';
|
||||
case 'ucs2':
|
||||
case 'ucs-2':
|
||||
case 'utf16le':
|
||||
case 'utf-16le':
|
||||
return 'utf16le';
|
||||
case 'latin1':
|
||||
case 'binary':
|
||||
return 'latin1';
|
||||
case 'base64':
|
||||
case 'ascii':
|
||||
case 'hex':
|
||||
return enc;
|
||||
default:
|
||||
if (retried) return; // undefined
|
||||
enc = ('' + enc).toLowerCase();
|
||||
retried = true;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// Do not cache `Buffer.isEncoding` when checking encoding names as some
|
||||
// modules monkey-patch it to support additional encodings
|
||||
function normalizeEncoding(enc) {
|
||||
var nenc = _normalizeEncoding(enc);
|
||||
if (typeof nenc !== 'string' && (Buffer.isEncoding === isEncoding || !isEncoding(enc))) throw new Error('Unknown encoding: ' + enc);
|
||||
return nenc || enc;
|
||||
}
|
||||
|
||||
// StringDecoder provides an interface for efficiently splitting a series of
|
||||
// buffers into a series of JS strings without breaking apart multi-byte
|
||||
// characters.
|
||||
exports.StringDecoder = StringDecoder;
|
||||
function StringDecoder(encoding) {
|
||||
this.encoding = normalizeEncoding(encoding);
|
||||
var nb;
|
||||
switch (this.encoding) {
|
||||
case 'utf16le':
|
||||
this.text = utf16Text;
|
||||
this.end = utf16End;
|
||||
nb = 4;
|
||||
break;
|
||||
case 'utf8':
|
||||
this.fillLast = utf8FillLast;
|
||||
nb = 4;
|
||||
break;
|
||||
case 'base64':
|
||||
this.text = base64Text;
|
||||
this.end = base64End;
|
||||
nb = 3;
|
||||
break;
|
||||
default:
|
||||
this.write = simpleWrite;
|
||||
this.end = simpleEnd;
|
||||
return;
|
||||
}
|
||||
this.lastNeed = 0;
|
||||
this.lastTotal = 0;
|
||||
this.lastChar = Buffer.allocUnsafe(nb);
|
||||
}
|
||||
|
||||
StringDecoder.prototype.write = function (buf) {
|
||||
if (buf.length === 0) return '';
|
||||
var r;
|
||||
var i;
|
||||
if (this.lastNeed) {
|
||||
r = this.fillLast(buf);
|
||||
if (r === undefined) return '';
|
||||
i = this.lastNeed;
|
||||
this.lastNeed = 0;
|
||||
} else {
|
||||
i = 0;
|
||||
}
|
||||
if (i < buf.length) return r ? r + this.text(buf, i) : this.text(buf, i);
|
||||
return r || '';
|
||||
};
|
||||
|
||||
StringDecoder.prototype.end = utf8End;
|
||||
|
||||
// Returns only complete characters in a Buffer
|
||||
StringDecoder.prototype.text = utf8Text;
|
||||
|
||||
// Attempts to complete a partial non-UTF-8 character using bytes from a Buffer
|
||||
StringDecoder.prototype.fillLast = function (buf) {
|
||||
if (this.lastNeed <= buf.length) {
|
||||
buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, this.lastNeed);
|
||||
return this.lastChar.toString(this.encoding, 0, this.lastTotal);
|
||||
}
|
||||
buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, buf.length);
|
||||
this.lastNeed -= buf.length;
|
||||
};
|
||||
|
||||
// Checks the type of a UTF-8 byte, whether it's ASCII, a leading byte, or a
|
||||
// continuation byte. If an invalid byte is detected, -2 is returned.
|
||||
function utf8CheckByte(byte) {
|
||||
if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;
|
||||
return byte >> 6 === 0x02 ? -1 : -2;
|
||||
}
|
||||
|
||||
// Checks at most 3 bytes at the end of a Buffer in order to detect an
|
||||
// incomplete multi-byte UTF-8 character. The total number of bytes (2, 3, or 4)
|
||||
// needed to complete the UTF-8 character (if applicable) are returned.
|
||||
function utf8CheckIncomplete(self, buf, i) {
|
||||
var j = buf.length - 1;
|
||||
if (j < i) return 0;
|
||||
var nb = utf8CheckByte(buf[j]);
|
||||
if (nb >= 0) {
|
||||
if (nb > 0) self.lastNeed = nb - 1;
|
||||
return nb;
|
||||
}
|
||||
if (--j < i || nb === -2) return 0;
|
||||
nb = utf8CheckByte(buf[j]);
|
||||
if (nb >= 0) {
|
||||
if (nb > 0) self.lastNeed = nb - 2;
|
||||
return nb;
|
||||
}
|
||||
if (--j < i || nb === -2) return 0;
|
||||
nb = utf8CheckByte(buf[j]);
|
||||
if (nb >= 0) {
|
||||
if (nb > 0) {
|
||||
if (nb === 2) nb = 0;else self.lastNeed = nb - 3;
|
||||
}
|
||||
return nb;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Validates as many continuation bytes for a multi-byte UTF-8 character as
|
||||
// needed or are available. If we see a non-continuation byte where we expect
|
||||
// one, we "replace" the validated continuation bytes we've seen so far with
|
||||
// a single UTF-8 replacement character ('\ufffd'), to match v8's UTF-8 decoding
|
||||
// behavior. The continuation byte check is included three times in the case
|
||||
// where all of the continuation bytes for a character exist in the same buffer.
|
||||
// It is also done this way as a slight performance increase instead of using a
|
||||
// loop.
|
||||
function utf8CheckExtraBytes(self, buf, p) {
|
||||
if ((buf[0] & 0xC0) !== 0x80) {
|
||||
self.lastNeed = 0;
|
||||
return '\ufffd';
|
||||
}
|
||||
if (self.lastNeed > 1 && buf.length > 1) {
|
||||
if ((buf[1] & 0xC0) !== 0x80) {
|
||||
self.lastNeed = 1;
|
||||
return '\ufffd';
|
||||
}
|
||||
if (self.lastNeed > 2 && buf.length > 2) {
|
||||
if ((buf[2] & 0xC0) !== 0x80) {
|
||||
self.lastNeed = 2;
|
||||
return '\ufffd';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Attempts to complete a multi-byte UTF-8 character using bytes from a Buffer.
|
||||
function utf8FillLast(buf) {
|
||||
var p = this.lastTotal - this.lastNeed;
|
||||
var r = utf8CheckExtraBytes(this, buf, p);
|
||||
if (r !== undefined) return r;
|
||||
if (this.lastNeed <= buf.length) {
|
||||
buf.copy(this.lastChar, p, 0, this.lastNeed);
|
||||
return this.lastChar.toString(this.encoding, 0, this.lastTotal);
|
||||
}
|
||||
buf.copy(this.lastChar, p, 0, buf.length);
|
||||
this.lastNeed -= buf.length;
|
||||
}
|
||||
|
||||
// Returns all complete UTF-8 characters in a Buffer. If the Buffer ended on a
|
||||
// partial character, the character's bytes are buffered until the required
|
||||
// number of bytes are available.
|
||||
function utf8Text(buf, i) {
|
||||
var total = utf8CheckIncomplete(this, buf, i);
|
||||
if (!this.lastNeed) return buf.toString('utf8', i);
|
||||
this.lastTotal = total;
|
||||
var end = buf.length - (total - this.lastNeed);
|
||||
buf.copy(this.lastChar, 0, end);
|
||||
return buf.toString('utf8', i, end);
|
||||
}
|
||||
|
||||
// For UTF-8, a replacement character is added when ending on a partial
|
||||
// character.
|
||||
function utf8End(buf) {
|
||||
var r = buf && buf.length ? this.write(buf) : '';
|
||||
if (this.lastNeed) return r + '\ufffd';
|
||||
return r;
|
||||
}
|
||||
|
||||
// UTF-16LE typically needs two bytes per character, but even if we have an even
|
||||
// number of bytes available, we need to check if we end on a leading/high
|
||||
// surrogate. In that case, we need to wait for the next two bytes in order to
|
||||
// decode the last character properly.
|
||||
function utf16Text(buf, i) {
|
||||
if ((buf.length - i) % 2 === 0) {
|
||||
var r = buf.toString('utf16le', i);
|
||||
if (r) {
|
||||
var c = r.charCodeAt(r.length - 1);
|
||||
if (c >= 0xD800 && c <= 0xDBFF) {
|
||||
this.lastNeed = 2;
|
||||
this.lastTotal = 4;
|
||||
this.lastChar[0] = buf[buf.length - 2];
|
||||
this.lastChar[1] = buf[buf.length - 1];
|
||||
return r.slice(0, -1);
|
||||
}
|
||||
}
|
||||
return r;
|
||||
}
|
||||
this.lastNeed = 1;
|
||||
this.lastTotal = 2;
|
||||
this.lastChar[0] = buf[buf.length - 1];
|
||||
return buf.toString('utf16le', i, buf.length - 1);
|
||||
}
|
||||
|
||||
// For UTF-16LE we do not explicitly append special replacement characters if we
|
||||
// end on a partial character, we simply let v8 handle that.
|
||||
function utf16End(buf) {
|
||||
var r = buf && buf.length ? this.write(buf) : '';
|
||||
if (this.lastNeed) {
|
||||
var end = this.lastTotal - this.lastNeed;
|
||||
return r + this.lastChar.toString('utf16le', 0, end);
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
function base64Text(buf, i) {
|
||||
var n = (buf.length - i) % 3;
|
||||
if (n === 0) return buf.toString('base64', i);
|
||||
this.lastNeed = 3 - n;
|
||||
this.lastTotal = 3;
|
||||
if (n === 1) {
|
||||
this.lastChar[0] = buf[buf.length - 1];
|
||||
} else {
|
||||
this.lastChar[0] = buf[buf.length - 2];
|
||||
this.lastChar[1] = buf[buf.length - 1];
|
||||
}
|
||||
return buf.toString('base64', i, buf.length - n);
|
||||
}
|
||||
|
||||
function base64End(buf) {
|
||||
var r = buf && buf.length ? this.write(buf) : '';
|
||||
if (this.lastNeed) return r + this.lastChar.toString('base64', 0, 3 - this.lastNeed);
|
||||
return r;
|
||||
}
|
||||
|
||||
// Pass bytes on through for single-byte encodings (e.g. ascii, latin1, hex)
|
||||
function simpleWrite(buf) {
|
||||
return buf.toString(this.encoding);
|
||||
}
|
||||
|
||||
function simpleEnd(buf) {
|
||||
return buf && buf.length ? this.write(buf) : '';
|
||||
}
|
34
node_modules/string_decoder/package.json
generated
vendored
Normal file
34
node_modules/string_decoder/package.json
generated
vendored
Normal file
@ -0,0 +1,34 @@
|
||||
{
|
||||
"name": "string_decoder",
|
||||
"version": "1.3.0",
|
||||
"description": "The string_decoder module from Node core",
|
||||
"main": "lib/string_decoder.js",
|
||||
"files": [
|
||||
"lib"
|
||||
],
|
||||
"dependencies": {
|
||||
"safe-buffer": "~5.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"babel-polyfill": "^6.23.0",
|
||||
"core-util-is": "^1.0.2",
|
||||
"inherits": "^2.0.3",
|
||||
"tap": "~0.4.8"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "tap test/parallel/*.js && node test/verify-dependencies",
|
||||
"ci": "tap test/parallel/*.js test/ours/*.js --tap | tee test.tap && node test/verify-dependencies.js"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/nodejs/string_decoder.git"
|
||||
},
|
||||
"homepage": "https://github.com/nodejs/string_decoder",
|
||||
"keywords": [
|
||||
"string",
|
||||
"decoder",
|
||||
"browser",
|
||||
"browserify"
|
||||
],
|
||||
"license": "MIT"
|
||||
}
|
16
node_modules/util-deprecate/History.md
generated
vendored
Normal file
16
node_modules/util-deprecate/History.md
generated
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
|
||||
1.0.2 / 2015-10-07
|
||||
==================
|
||||
|
||||
* use try/catch when checking `localStorage` (#3, @kumavis)
|
||||
|
||||
1.0.1 / 2014-11-25
|
||||
==================
|
||||
|
||||
* browser: use `console.warn()` for deprecation calls
|
||||
* browser: more jsdocs
|
||||
|
||||
1.0.0 / 2014-04-30
|
||||
==================
|
||||
|
||||
* initial commit
|
24
node_modules/util-deprecate/LICENSE
generated
vendored
Normal file
24
node_modules/util-deprecate/LICENSE
generated
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
(The MIT License)
|
||||
|
||||
Copyright (c) 2014 Nathan Rajlich <nathan@tootallnate.net>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation
|
||||
files (the "Software"), to deal in the Software without
|
||||
restriction, including without limitation the rights to use,
|
||||
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following
|
||||
conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
OTHER DEALINGS IN THE SOFTWARE.
|
53
node_modules/util-deprecate/README.md
generated
vendored
Normal file
53
node_modules/util-deprecate/README.md
generated
vendored
Normal file
@ -0,0 +1,53 @@
|
||||
util-deprecate
|
||||
==============
|
||||
### The Node.js `util.deprecate()` function with browser support
|
||||
|
||||
In Node.js, this module simply re-exports the `util.deprecate()` function.
|
||||
|
||||
In the web browser (i.e. via browserify), a browser-specific implementation
|
||||
of the `util.deprecate()` function is used.
|
||||
|
||||
|
||||
## API
|
||||
|
||||
A `deprecate()` function is the only thing exposed by this module.
|
||||
|
||||
``` javascript
|
||||
// setup:
|
||||
exports.foo = deprecate(foo, 'foo() is deprecated, use bar() instead');
|
||||
|
||||
|
||||
// users see:
|
||||
foo();
|
||||
// foo() is deprecated, use bar() instead
|
||||
foo();
|
||||
foo();
|
||||
```
|
||||
|
||||
|
||||
## License
|
||||
|
||||
(The MIT License)
|
||||
|
||||
Copyright (c) 2014 Nathan Rajlich <nathan@tootallnate.net>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation
|
||||
files (the "Software"), to deal in the Software without
|
||||
restriction, including without limitation the rights to use,
|
||||
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following
|
||||
conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
OTHER DEALINGS IN THE SOFTWARE.
|
67
node_modules/util-deprecate/browser.js
generated
vendored
Normal file
67
node_modules/util-deprecate/browser.js
generated
vendored
Normal file
@ -0,0 +1,67 @@
|
||||
|
||||
/**
|
||||
* Module exports.
|
||||
*/
|
||||
|
||||
module.exports = deprecate;
|
||||
|
||||
/**
|
||||
* Mark that a method should not be used.
|
||||
* Returns a modified function which warns once by default.
|
||||
*
|
||||
* If `localStorage.noDeprecation = true` is set, then it is a no-op.
|
||||
*
|
||||
* If `localStorage.throwDeprecation = true` is set, then deprecated functions
|
||||
* will throw an Error when invoked.
|
||||
*
|
||||
* If `localStorage.traceDeprecation = true` is set, then deprecated functions
|
||||
* will invoke `console.trace()` instead of `console.error()`.
|
||||
*
|
||||
* @param {Function} fn - the function to deprecate
|
||||
* @param {String} msg - the string to print to the console when `fn` is invoked
|
||||
* @returns {Function} a new "deprecated" version of `fn`
|
||||
* @api public
|
||||
*/
|
||||
|
||||
function deprecate (fn, msg) {
|
||||
if (config('noDeprecation')) {
|
||||
return fn;
|
||||
}
|
||||
|
||||
var warned = false;
|
||||
function deprecated() {
|
||||
if (!warned) {
|
||||
if (config('throwDeprecation')) {
|
||||
throw new Error(msg);
|
||||
} else if (config('traceDeprecation')) {
|
||||
console.trace(msg);
|
||||
} else {
|
||||
console.warn(msg);
|
||||
}
|
||||
warned = true;
|
||||
}
|
||||
return fn.apply(this, arguments);
|
||||
}
|
||||
|
||||
return deprecated;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks `localStorage` for boolean values for the given `name`.
|
||||
*
|
||||
* @param {String} name
|
||||
* @returns {Boolean}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function config (name) {
|
||||
// accessing global.localStorage can trigger a DOMException in sandboxed iframes
|
||||
try {
|
||||
if (!global.localStorage) return false;
|
||||
} catch (_) {
|
||||
return false;
|
||||
}
|
||||
var val = global.localStorage[name];
|
||||
if (null == val) return false;
|
||||
return String(val).toLowerCase() === 'true';
|
||||
}
|
6
node_modules/util-deprecate/node.js
generated
vendored
Normal file
6
node_modules/util-deprecate/node.js
generated
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
|
||||
/**
|
||||
* For Node.js, simply re-export the core `util.deprecate` function.
|
||||
*/
|
||||
|
||||
module.exports = require('util').deprecate;
|
27
node_modules/util-deprecate/package.json
generated
vendored
Normal file
27
node_modules/util-deprecate/package.json
generated
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
{
|
||||
"name": "util-deprecate",
|
||||
"version": "1.0.2",
|
||||
"description": "The Node.js `util.deprecate()` function with browser support",
|
||||
"main": "node.js",
|
||||
"browser": "browser.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/TooTallNate/util-deprecate.git"
|
||||
},
|
||||
"keywords": [
|
||||
"util",
|
||||
"deprecate",
|
||||
"browserify",
|
||||
"browser",
|
||||
"node"
|
||||
],
|
||||
"author": "Nathan Rajlich <nathan@tootallnate.net> (http://n8.io/)",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/TooTallNate/util-deprecate/issues"
|
||||
},
|
||||
"homepage": "https://github.com/TooTallNate/util-deprecate"
|
||||
}
|
Binary file not shown.
Binary file not shown.
@ -1,156 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<!--
|
||||
Copyright (c) 2015, 2019, Gluon and/or its affiliates.
|
||||
All rights reserved. Use is subject to license terms.
|
||||
|
||||
This file is available and licensed under the following license:
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in
|
||||
the documentation and/or other materials provided with the distribution.
|
||||
- Neither the name of Oracle Corporation nor the names of its
|
||||
contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
-->
|
||||
|
||||
<?import javafx.geometry.Insets?>
|
||||
<?import javafx.scene.control.Button?>
|
||||
<?import javafx.scene.control.Label?>
|
||||
<?import javafx.scene.control.Menu?>
|
||||
<?import javafx.scene.control.MenuBar?>
|
||||
<?import javafx.scene.control.MenuItem?>
|
||||
<?import javafx.scene.control.SeparatorMenuItem?>
|
||||
<?import javafx.scene.control.SplitPane?>
|
||||
<?import javafx.scene.control.TextField?>
|
||||
<?import javafx.scene.layout.HBox?>
|
||||
<?import javafx.scene.layout.Pane?>
|
||||
<?import javafx.scene.layout.VBox?>
|
||||
<?import javafx.scene.paint.Color?>
|
||||
<?import javafx.scene.text.Font?>
|
||||
|
||||
<VBox prefHeight="600.0" prefWidth="900.0" xmlns="http://javafx.com/javafx/11.0.2" xmlns:fx="http://javafx.com/fxml/1">
|
||||
<children>
|
||||
<MenuBar VBox.vgrow="NEVER">
|
||||
<menus>
|
||||
<Menu mnemonicParsing="false" text="File">
|
||||
<items>
|
||||
<MenuItem mnemonicParsing="false" text="New" />
|
||||
<MenuItem mnemonicParsing="false" text="Open…" />
|
||||
<Menu mnemonicParsing="false" text="Open Recent" />
|
||||
<SeparatorMenuItem mnemonicParsing="false" />
|
||||
<MenuItem mnemonicParsing="false" text="Close" />
|
||||
<MenuItem mnemonicParsing="false" text="Save" />
|
||||
<MenuItem mnemonicParsing="false" text="Save As…" />
|
||||
<MenuItem mnemonicParsing="false" text="Revert" />
|
||||
<SeparatorMenuItem mnemonicParsing="false" />
|
||||
<MenuItem mnemonicParsing="false" text="Preferences…" />
|
||||
<SeparatorMenuItem mnemonicParsing="false" />
|
||||
<MenuItem mnemonicParsing="false" text="Quit" />
|
||||
</items>
|
||||
</Menu>
|
||||
<Menu mnemonicParsing="false" text="Edit">
|
||||
<items>
|
||||
<MenuItem mnemonicParsing="false" text="Undo" />
|
||||
<MenuItem mnemonicParsing="false" text="Redo" />
|
||||
<SeparatorMenuItem mnemonicParsing="false" />
|
||||
<MenuItem mnemonicParsing="false" text="Cut" />
|
||||
<MenuItem mnemonicParsing="false" text="Copy" />
|
||||
<MenuItem mnemonicParsing="false" text="Paste" />
|
||||
<MenuItem mnemonicParsing="false" text="Delete" />
|
||||
<SeparatorMenuItem mnemonicParsing="false" />
|
||||
<MenuItem mnemonicParsing="false" text="Select All" />
|
||||
<MenuItem mnemonicParsing="false" text="Unselect All" />
|
||||
</items>
|
||||
</Menu>
|
||||
<Menu mnemonicParsing="false" text="Options">
|
||||
<items>
|
||||
<MenuItem mnemonicParsing="false" text="Undo" />
|
||||
<MenuItem mnemonicParsing="false" text="Redo" />
|
||||
<SeparatorMenuItem mnemonicParsing="false" />
|
||||
<MenuItem mnemonicParsing="false" text="Cut" />
|
||||
<MenuItem mnemonicParsing="false" text="Copy" />
|
||||
<MenuItem mnemonicParsing="false" text="Paste" />
|
||||
<MenuItem mnemonicParsing="false" text="Delete" />
|
||||
<SeparatorMenuItem mnemonicParsing="false" />
|
||||
<MenuItem mnemonicParsing="false" text="Select All" />
|
||||
<MenuItem mnemonicParsing="false" text="Unselect All" />
|
||||
</items>
|
||||
</Menu>
|
||||
<Menu mnemonicParsing="false" text="Help">
|
||||
<items>
|
||||
<MenuItem mnemonicParsing="false" text="About MyHelloApp" />
|
||||
</items>
|
||||
</Menu>
|
||||
</menus>
|
||||
</MenuBar>
|
||||
<HBox id="HBox" alignment="CENTER_LEFT" layoutX="10.0" layoutY="588.0" spacing="5.0">
|
||||
<children>
|
||||
<Pane prefHeight="-1.0" prefWidth="-1.0" HBox.hgrow="ALWAYS" />
|
||||
<TextField text="Suche...." />
|
||||
<Button mnemonicParsing="false" text="Suchen" />
|
||||
</children>
|
||||
<padding>
|
||||
<Insets bottom="3.0" left="3.0" right="3.0" top="3.0" />
|
||||
</padding>
|
||||
</HBox>
|
||||
<SplitPane dividerPositions="0.5" focusTraversable="true" prefHeight="-1.0" prefWidth="-1.0" VBox.vgrow="ALWAYS">
|
||||
<items>
|
||||
<Pane prefHeight="200.0" prefWidth="200.0">
|
||||
<children>
|
||||
<Label layoutX="79.0" layoutY="57.0" text="Inhalt" />
|
||||
</children>
|
||||
</Pane>
|
||||
<SplitPane dividerPositions="0.5" orientation="VERTICAL" prefHeight="200.0" prefWidth="160.0">
|
||||
<items>
|
||||
<Pane prefHeight="200.0" prefWidth="200.0">
|
||||
<children>
|
||||
<Label text="Inhalt" />
|
||||
</children>
|
||||
</Pane>
|
||||
<Pane prefHeight="200.0" prefWidth="200.0">
|
||||
<children>
|
||||
<Label text="Inhalt" />
|
||||
</children>
|
||||
</Pane>
|
||||
</items>
|
||||
</SplitPane>
|
||||
</items>
|
||||
</SplitPane>
|
||||
<HBox id="HBox" alignment="CENTER_LEFT" spacing="5.0" VBox.vgrow="NEVER">
|
||||
<children>
|
||||
<Label maxHeight="1.7976931348623157E308" maxWidth="-1.0" text="Left status" HBox.hgrow="ALWAYS">
|
||||
<font>
|
||||
<Font size="11.0" fx:id="x3" />
|
||||
</font>
|
||||
<textFill>
|
||||
<Color red="0.625" green="0.625" blue="0.625" fx:id="x4" />
|
||||
</textFill>
|
||||
</Label>
|
||||
<Pane prefHeight="-1.0" prefWidth="-1.0" HBox.hgrow="ALWAYS" />
|
||||
<Label font="$x3" maxWidth="-1.0" text="Right status" textFill="$x4" HBox.hgrow="NEVER" />
|
||||
</children>
|
||||
<padding>
|
||||
<Insets bottom="3.0" left="3.0" right="3.0" top="3.0" />
|
||||
</padding>
|
||||
</HBox>
|
||||
</children>
|
||||
</VBox>
|
99
package-lock.json
generated
Normal file
99
package-lock.json
generated
Normal file
@ -0,0 +1,99 @@
|
||||
{
|
||||
"name": "tourplaner",
|
||||
"version": "1.0.0",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"version": "1.0.0",
|
||||
"dependencies": {
|
||||
"readable-stream": "^3.6.0"
|
||||
}
|
||||
},
|
||||
"node_modules/inherits": {
|
||||
"version": "2.0.4",
|
||||
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
|
||||
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
|
||||
},
|
||||
"node_modules/readable-stream": {
|
||||
"version": "3.6.0",
|
||||
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz",
|
||||
"integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==",
|
||||
"dependencies": {
|
||||
"inherits": "^2.0.3",
|
||||
"string_decoder": "^1.1.1",
|
||||
"util-deprecate": "^1.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 6"
|
||||
}
|
||||
},
|
||||
"node_modules/safe-buffer": {
|
||||
"version": "5.2.1",
|
||||
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
|
||||
"integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==",
|
||||
"funding": [
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/feross"
|
||||
},
|
||||
{
|
||||
"type": "patreon",
|
||||
"url": "https://www.patreon.com/feross"
|
||||
},
|
||||
{
|
||||
"type": "consulting",
|
||||
"url": "https://feross.org/support"
|
||||
}
|
||||
]
|
||||
},
|
||||
"node_modules/string_decoder": {
|
||||
"version": "1.3.0",
|
||||
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz",
|
||||
"integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==",
|
||||
"dependencies": {
|
||||
"safe-buffer": "~5.2.0"
|
||||
}
|
||||
},
|
||||
"node_modules/util-deprecate": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
|
||||
"integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8="
|
||||
}
|
||||
},
|
||||
"dependencies": {
|
||||
"inherits": {
|
||||
"version": "2.0.4",
|
||||
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
|
||||
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
|
||||
},
|
||||
"readable-stream": {
|
||||
"version": "3.6.0",
|
||||
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz",
|
||||
"integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==",
|
||||
"requires": {
|
||||
"inherits": "^2.0.3",
|
||||
"string_decoder": "^1.1.1",
|
||||
"util-deprecate": "^1.0.1"
|
||||
}
|
||||
},
|
||||
"safe-buffer": {
|
||||
"version": "5.2.1",
|
||||
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
|
||||
"integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ=="
|
||||
},
|
||||
"string_decoder": {
|
||||
"version": "1.3.0",
|
||||
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz",
|
||||
"integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==",
|
||||
"requires": {
|
||||
"safe-buffer": "~5.2.0"
|
||||
}
|
||||
},
|
||||
"util-deprecate": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
|
||||
"integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8="
|
||||
}
|
||||
}
|
||||
}
|
7
package.json
Normal file
7
package.json
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
"name": "tourplaner",
|
||||
"version": "1.0.0",
|
||||
"dependencies": {
|
||||
|
||||
}
|
||||
}
|
16
src/log4j.properties
Normal file
16
src/log4j.properties
Normal file
@ -0,0 +1,16 @@
|
||||
# Root logger option
|
||||
log4j.rootLogger=DEBUG, stdout, file
|
||||
|
||||
# Redirect log messages to console
|
||||
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
|
||||
log4j.appender.stdout.Target=System.out
|
||||
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
|
||||
log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n
|
||||
|
||||
# Redirect log messages to a log file, support file rolling.
|
||||
log4j.appender.file=org.apache.log4j.RollingFileAppender
|
||||
log4j.appender.file.File=log/log4j/log.out
|
||||
log4j.appender.file.MaxFileSize=5MB
|
||||
log4j.appender.file.MaxBackupIndex=10
|
||||
log4j.appender.file.layout=org.apache.log4j.PatternLayout
|
||||
log4j.appender.file.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n
|
@ -1,4 +0,0 @@
|
||||
package tourplaner;
|
||||
|
||||
public class Controller {
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user