-
Notifications
You must be signed in to change notification settings - Fork 3.7k
(chore) Deprecate the requireLanguage API
#2844
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
joshgoebel
merged 10 commits into
highlightjs:master
from
joshgoebel:no_more_require_language
Nov 13, 2020
+127
−97
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
5e2e5e7
(chore) static import vs runtime require
joshgoebel b82a9ce
(docs) we deprecated fixMarkup, say so in the docs
joshgoebel 7534666
(docs) document the deprecation of requireLanguage
joshgoebel 9a59f1d
add warn
joshgoebel 7e6595d
remove Requires: for runtime requires
joshgoebel c82a12d
linter
joshgoebel 083b7bf
introduce supersetOf concept
joshgoebel 59a9b0a
fix lint
joshgoebel 1f7d6d7
lint
joshgoebel 5a3f732
Merge branch 'master' into no_more_require_language
joshgoebel File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,109 +2,110 @@ | |
| Language: Arduino | ||
| Author: Stefania Mellai <[email protected]> | ||
| Description: The Arduino® Language is a superset of C++. This rules are designed to highlight the Arduino® source code. For info about language see http://www.arduino.cc. | ||
| Requires: cpp.js | ||
| Website: https://www.arduino.cc | ||
| */ | ||
|
|
||
| import cPlusPlus from './cpp.js'; | ||
|
|
||
| /** @type LanguageFn */ | ||
| export default function(hljs) { | ||
|
|
||
| var ARDUINO_KW = { | ||
| keyword: | ||
| 'boolean byte word String', | ||
| built_in: | ||
| 'setup loop ' + | ||
| 'KeyboardController MouseController SoftwareSerial ' + | ||
| 'EthernetServer EthernetClient LiquidCrystal ' + | ||
| 'RobotControl GSMVoiceCall EthernetUDP EsploraTFT ' + | ||
| 'HttpClient RobotMotor WiFiClient GSMScanner ' + | ||
| 'FileSystem Scheduler GSMServer YunClient YunServer ' + | ||
| 'IPAddress GSMClient GSMModem Keyboard Ethernet ' + | ||
| 'Console GSMBand Esplora Stepper Process ' + | ||
| 'WiFiUDP GSM_SMS Mailbox USBHost Firmata PImage ' + | ||
| 'Client Server GSMPIN FileIO Bridge Serial ' + | ||
| 'EEPROM Stream Mouse Audio Servo File Task ' + | ||
| 'GPRS WiFi Wire TFT GSM SPI SD ' + | ||
| 'runShellCommandAsynchronously analogWriteResolution ' + | ||
| 'retrieveCallingNumber printFirmwareVersion ' + | ||
| 'analogReadResolution sendDigitalPortPair ' + | ||
| 'noListenOnLocalhost readJoystickButton setFirmwareVersion ' + | ||
| 'readJoystickSwitch scrollDisplayRight getVoiceCallStatus ' + | ||
| 'scrollDisplayLeft writeMicroseconds delayMicroseconds ' + | ||
| 'beginTransmission getSignalStrength runAsynchronously ' + | ||
| 'getAsynchronously listenOnLocalhost getCurrentCarrier ' + | ||
| 'readAccelerometer messageAvailable sendDigitalPorts ' + | ||
| 'lineFollowConfig countryNameWrite runShellCommand ' + | ||
| 'readStringUntil rewindDirectory readTemperature ' + | ||
| 'setClockDivider readLightSensor endTransmission ' + | ||
| 'analogReference detachInterrupt countryNameRead ' + | ||
| 'attachInterrupt encryptionType readBytesUntil ' + | ||
| 'robotNameWrite readMicrophone robotNameRead cityNameWrite ' + | ||
| 'userNameWrite readJoystickY readJoystickX mouseReleased ' + | ||
| 'openNextFile scanNetworks noInterrupts digitalWrite ' + | ||
| 'beginSpeaker mousePressed isActionDone mouseDragged ' + | ||
| 'displayLogos noAutoscroll addParameter remoteNumber ' + | ||
| 'getModifiers keyboardRead userNameRead waitContinue ' + | ||
| 'processInput parseCommand printVersion readNetworks ' + | ||
| 'writeMessage blinkVersion cityNameRead readMessage ' + | ||
| 'setDataMode parsePacket isListening setBitOrder ' + | ||
| 'beginPacket isDirectory motorsWrite drawCompass ' + | ||
| 'digitalRead clearScreen serialEvent rightToLeft ' + | ||
| 'setTextSize leftToRight requestFrom keyReleased ' + | ||
| 'compassRead analogWrite interrupts WiFiServer ' + | ||
| 'disconnect playMelody parseFloat autoscroll ' + | ||
| 'getPINUsed setPINUsed setTimeout sendAnalog ' + | ||
| 'readSlider analogRead beginWrite createChar ' + | ||
| 'motorsStop keyPressed tempoWrite readButton ' + | ||
| 'subnetMask debugPrint macAddress writeGreen ' + | ||
| 'randomSeed attachGPRS readString sendString ' + | ||
| 'remotePort releaseAll mouseMoved background ' + | ||
| 'getXChange getYChange answerCall getResult ' + | ||
| 'voiceCall endPacket constrain getSocket writeJSON ' + | ||
| 'getButton available connected findUntil readBytes ' + | ||
| 'exitValue readGreen writeBlue startLoop IPAddress ' + | ||
| 'isPressed sendSysex pauseMode gatewayIP setCursor ' + | ||
| 'getOemKey tuneWrite noDisplay loadImage switchPIN ' + | ||
| 'onRequest onReceive changePIN playFile noBuffer ' + | ||
| 'parseInt overflow checkPIN knobRead beginTFT ' + | ||
| 'bitClear updateIR bitWrite position writeRGB ' + | ||
| 'highByte writeRed setSpeed readBlue noStroke ' + | ||
| 'remoteIP transfer shutdown hangCall beginSMS ' + | ||
| 'endWrite attached maintain noCursor checkReg ' + | ||
| 'checkPUK shiftOut isValid shiftIn pulseIn ' + | ||
| 'connect println localIP pinMode getIMEI ' + | ||
| 'display noBlink process getBand running beginSD ' + | ||
| 'drawBMP lowByte setBand release bitRead prepare ' + | ||
| 'pointTo readRed setMode noFill remove listen ' + | ||
| 'stroke detach attach noTone exists buffer ' + | ||
| 'height bitSet circle config cursor random ' + | ||
| 'IRread setDNS endSMS getKey micros ' + | ||
| 'millis begin print write ready flush width ' + | ||
| 'isPIN blink clear press mkdir rmdir close ' + | ||
| 'point yield image BSSID click delay ' + | ||
| 'read text move peek beep rect line open ' + | ||
| 'seek fill size turn stop home find ' + | ||
| 'step tone sqrt RSSI SSID ' + | ||
| 'end bit tan cos sin pow map abs max ' + | ||
| 'min get run put', | ||
| literal: | ||
| 'DIGITAL_MESSAGE FIRMATA_STRING ANALOG_MESSAGE ' + | ||
| 'REPORT_DIGITAL REPORT_ANALOG INPUT_PULLUP ' + | ||
| 'SET_PIN_MODE INTERNAL2V56 SYSTEM_RESET LED_BUILTIN ' + | ||
| 'INTERNAL1V1 SYSEX_START INTERNAL EXTERNAL ' + | ||
| 'DEFAULT OUTPUT INPUT HIGH LOW' | ||
| const ARDUINO_KW = { | ||
| keyword: | ||
| 'boolean byte word String', | ||
| built_in: | ||
| 'setup loop ' + | ||
| 'KeyboardController MouseController SoftwareSerial ' + | ||
| 'EthernetServer EthernetClient LiquidCrystal ' + | ||
| 'RobotControl GSMVoiceCall EthernetUDP EsploraTFT ' + | ||
| 'HttpClient RobotMotor WiFiClient GSMScanner ' + | ||
| 'FileSystem Scheduler GSMServer YunClient YunServer ' + | ||
| 'IPAddress GSMClient GSMModem Keyboard Ethernet ' + | ||
| 'Console GSMBand Esplora Stepper Process ' + | ||
| 'WiFiUDP GSM_SMS Mailbox USBHost Firmata PImage ' + | ||
| 'Client Server GSMPIN FileIO Bridge Serial ' + | ||
| 'EEPROM Stream Mouse Audio Servo File Task ' + | ||
| 'GPRS WiFi Wire TFT GSM SPI SD ' + | ||
| 'runShellCommandAsynchronously analogWriteResolution ' + | ||
| 'retrieveCallingNumber printFirmwareVersion ' + | ||
| 'analogReadResolution sendDigitalPortPair ' + | ||
| 'noListenOnLocalhost readJoystickButton setFirmwareVersion ' + | ||
| 'readJoystickSwitch scrollDisplayRight getVoiceCallStatus ' + | ||
| 'scrollDisplayLeft writeMicroseconds delayMicroseconds ' + | ||
| 'beginTransmission getSignalStrength runAsynchronously ' + | ||
| 'getAsynchronously listenOnLocalhost getCurrentCarrier ' + | ||
| 'readAccelerometer messageAvailable sendDigitalPorts ' + | ||
| 'lineFollowConfig countryNameWrite runShellCommand ' + | ||
| 'readStringUntil rewindDirectory readTemperature ' + | ||
| 'setClockDivider readLightSensor endTransmission ' + | ||
| 'analogReference detachInterrupt countryNameRead ' + | ||
| 'attachInterrupt encryptionType readBytesUntil ' + | ||
| 'robotNameWrite readMicrophone robotNameRead cityNameWrite ' + | ||
| 'userNameWrite readJoystickY readJoystickX mouseReleased ' + | ||
| 'openNextFile scanNetworks noInterrupts digitalWrite ' + | ||
| 'beginSpeaker mousePressed isActionDone mouseDragged ' + | ||
| 'displayLogos noAutoscroll addParameter remoteNumber ' + | ||
| 'getModifiers keyboardRead userNameRead waitContinue ' + | ||
| 'processInput parseCommand printVersion readNetworks ' + | ||
| 'writeMessage blinkVersion cityNameRead readMessage ' + | ||
| 'setDataMode parsePacket isListening setBitOrder ' + | ||
| 'beginPacket isDirectory motorsWrite drawCompass ' + | ||
| 'digitalRead clearScreen serialEvent rightToLeft ' + | ||
| 'setTextSize leftToRight requestFrom keyReleased ' + | ||
| 'compassRead analogWrite interrupts WiFiServer ' + | ||
| 'disconnect playMelody parseFloat autoscroll ' + | ||
| 'getPINUsed setPINUsed setTimeout sendAnalog ' + | ||
| 'readSlider analogRead beginWrite createChar ' + | ||
| 'motorsStop keyPressed tempoWrite readButton ' + | ||
| 'subnetMask debugPrint macAddress writeGreen ' + | ||
| 'randomSeed attachGPRS readString sendString ' + | ||
| 'remotePort releaseAll mouseMoved background ' + | ||
| 'getXChange getYChange answerCall getResult ' + | ||
| 'voiceCall endPacket constrain getSocket writeJSON ' + | ||
| 'getButton available connected findUntil readBytes ' + | ||
| 'exitValue readGreen writeBlue startLoop IPAddress ' + | ||
| 'isPressed sendSysex pauseMode gatewayIP setCursor ' + | ||
| 'getOemKey tuneWrite noDisplay loadImage switchPIN ' + | ||
| 'onRequest onReceive changePIN playFile noBuffer ' + | ||
| 'parseInt overflow checkPIN knobRead beginTFT ' + | ||
| 'bitClear updateIR bitWrite position writeRGB ' + | ||
| 'highByte writeRed setSpeed readBlue noStroke ' + | ||
| 'remoteIP transfer shutdown hangCall beginSMS ' + | ||
| 'endWrite attached maintain noCursor checkReg ' + | ||
| 'checkPUK shiftOut isValid shiftIn pulseIn ' + | ||
| 'connect println localIP pinMode getIMEI ' + | ||
| 'display noBlink process getBand running beginSD ' + | ||
| 'drawBMP lowByte setBand release bitRead prepare ' + | ||
| 'pointTo readRed setMode noFill remove listen ' + | ||
| 'stroke detach attach noTone exists buffer ' + | ||
| 'height bitSet circle config cursor random ' + | ||
| 'IRread setDNS endSMS getKey micros ' + | ||
| 'millis begin print write ready flush width ' + | ||
| 'isPIN blink clear press mkdir rmdir close ' + | ||
| 'point yield image BSSID click delay ' + | ||
| 'read text move peek beep rect line open ' + | ||
| 'seek fill size turn stop home find ' + | ||
| 'step tone sqrt RSSI SSID ' + | ||
| 'end bit tan cos sin pow map abs max ' + | ||
| 'min get run put', | ||
| literal: | ||
| 'DIGITAL_MESSAGE FIRMATA_STRING ANALOG_MESSAGE ' + | ||
| 'REPORT_DIGITAL REPORT_ANALOG INPUT_PULLUP ' + | ||
| 'SET_PIN_MODE INTERNAL2V56 SYSTEM_RESET LED_BUILTIN ' + | ||
| 'INTERNAL1V1 SYSEX_START INTERNAL EXTERNAL ' + | ||
| 'DEFAULT OUTPUT INPUT HIGH LOW' | ||
| }; | ||
|
|
||
| var ARDUINO = hljs.requireLanguage('cpp').rawDefinition(); | ||
| const ARDUINO = cPlusPlus(hljs); | ||
|
|
||
| var kws = ARDUINO.keywords; | ||
| const kws = /** @type {Record<string,any>} */ (ARDUINO.keywords); | ||
|
|
||
| kws.keyword += ' ' + ARDUINO_KW.keyword; | ||
| kws.literal += ' ' + ARDUINO_KW.literal; | ||
| kws.built_in += ' ' + ARDUINO_KW.built_in; | ||
|
|
||
| ARDUINO.name = 'Arduino'; | ||
| ARDUINO.aliases = ['ino']; | ||
| ARDUINO.supersetOf = "cpp"; | ||
|
|
||
| return ARDUINO; | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should there be some sort of check here for checking whether highlight.js is running a production environment?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The idea is that everyone can see it. It only shows up in console so it’s not disruptive. And after this PR it’s also immediately actionable so it’s not something that people have to wait till version 11. Someone can see it immediately make changes to that code base to make it go away.
I’m pretty sure this is consistent with the other deprecation notices.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do certainly wish there were some better way to handle this but like I can’t really think of what it would be too of my head.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't really feel strongly about this either way. My initial thought was someone using a plug-in in their CMS that had a bundled version of highlight.js or something similar and fixing the warning was beyond their control until the plug-in maintainer updated it.
Closest thing I can think of is webpack's support for
process.env.node_env === 'production'but I can't say I've ever bothered looking for a browser-only solution other than having*.production.min.jsand*.development.jsfilesThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is minified or not (perhaps could have a flag based on the build type) but there is no guarantee one is using minified in production and un-minified for development work. Unless you're hacking on the library you're probably just using the minified version everywhere.