Skip to content

Commit

Permalink
Fix no lazy require mode
Browse files Browse the repository at this point in the history
  • Loading branch information
cronvel committed May 31, 2021
1 parent d32f77a commit a34beb3
Show file tree
Hide file tree
Showing 10 changed files with 45 additions and 21 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG
@@ -1,4 +1,10 @@

v2.1.5
------

Fix no lazy require mode


v2.1.4
------

Expand Down
3 changes: 3 additions & 0 deletions Makefile
Expand Up @@ -7,6 +7,9 @@
# Build every buildable things
all: install

# Things to build
build: browser

# Just install things so it works, basicaly: it just performs a "npm install --production" ATM
install: log/npm-install.log

Expand Down
20 changes: 14 additions & 6 deletions browser/termkit.js
Expand Up @@ -21625,7 +21625,6 @@ if ( process.platform === 'win32' ) { require( './windows.js' )( termkit ) ; }



// Lazy submodules
termkit.image = require( './image.js' ) ;
termkit.Palette = require( './Palette.js' ) ;
termkit.Rect = require( './Rect.js' ) ;
Expand Down Expand Up @@ -21705,7 +21704,7 @@ lazy.properties( termkit , {

}).call(this)}).call(this,require('_process'))
},{"./Palette.js":1,"./Rect.js":2,"./ScreenBuffer.js":3,"./ScreenBufferHD.js":4,"./Terminal.js":5,"./TextBuffer.js":6,"./autoComplete.js":7,"./detectTerminal.js":12,"./document/AnimatedText.js":13,"./document/Bar.js":14,"./document/Button.js":16,"./document/ColumnMenu.js":17,"./document/ColumnMenuMulti.js":18,"./document/Container.js":19,"./document/Document.js":20,"./document/DropDownMenu.js":21,"./document/EditableTextBox.js":22,"./document/Element.js":23,"./document/Form.js":24,"./document/InlineInput.js":25,"./document/LabeledInput.js":26,"./document/Layout.js":27,"./document/RowMenu.js":28,"./document/SelectList.js":29,"./document/SelectListMulti.js":30,"./document/Slider.js":31,"./document/Text.js":32,"./document/TextBox.js":33,"./document/TextTable.js":34,"./document/ToggleButton.js":35,"./document/Window.js":36,"./image.js":40,"./misc.js":42,"./spChars.js":48,"./tty.js":51,"./vte/Vte.js":53,"./windows.js":56,"_process":179,"chroma-js":59,"lazyness":68}],50:[function(require,module,exports){
(function (process){(function (){
(function (process,__dirname){(function (){
/*
Terminal Kit

Expand Down Expand Up @@ -21736,6 +21735,16 @@ lazy.properties( termkit , {



const path = require( 'path' ) ;

if ( process.browser || require.cache[ path.join( __dirname , 'termkit-no-lazy-require.js' ) ] ) {
console.log( 'using termkit-no-lazy-require.js' ) ;
module.exports = require( './termkit-no-lazy-require.js' ) ;
return ;
}



const termkit = {} ;
module.exports = termkit ;

Expand Down Expand Up @@ -21848,8 +21857,8 @@ lazy.properties( termkit , {
} , true ) ;


}).call(this)}).call(this,require('_process'))
},{"./Terminal.js":5,"./detectTerminal.js":12,"./misc.js":42,"./windows.js":56,"_process":179,"lazyness":68}],51:[function(require,module,exports){
}).call(this)}).call(this,require('_process'),"/lib")
},{"./Terminal.js":5,"./detectTerminal.js":12,"./misc.js":42,"./termkit-no-lazy-require.js":49,"./windows.js":56,"_process":179,"lazyness":68,"path":178}],51:[function(require,module,exports){
(function (process){(function (){
/*
Terminal Kit
Expand Down Expand Up @@ -22395,7 +22404,6 @@ SequencesReader.prototype.streamToEvent = async function( stream ) {



const termkit = require( '../termkit.js' ) ;
const ScreenBuffer = require( '../ScreenBuffer.js' ) ;
const Rect = require( '../Rect.js' ) ;
const string = require( 'string-kit' ) ;
Expand Down Expand Up @@ -23373,7 +23381,7 @@ Vte.prototype.onChildOutputOSC = function( type , args ) {
} ;


},{"../Rect.js":2,"../ScreenBuffer.js":3,"../termkit.js":50,"./SequencesReader.js":52,"./toInputSequence.js":55,"child_process":136,"child_pty":136,"nextgen-events":72,"seventh":108,"string-kit":123}],54:[function(require,module,exports){
},{"../Rect.js":2,"../ScreenBuffer.js":3,"./SequencesReader.js":52,"./toInputSequence.js":55,"child_process":136,"child_pty":136,"nextgen-events":72,"seventh":108,"string-kit":123}],54:[function(require,module,exports){
/*
Terminal Kit

Expand Down
2 changes: 1 addition & 1 deletion browser/termkit.min.js

Large diffs are not rendered by default.

21 changes: 10 additions & 11 deletions lib/gpm.js
Expand Up @@ -34,11 +34,11 @@



var net = require( 'net' ) ;
var NextGenEvents = require( 'nextgen-events' ) ;
var termkit = require( './termkit.js' ) ;
const net = require( 'net' ) ;
const NextGenEvents = require( 'nextgen-events' ) ;
const termkit = require( './termkit.js' ) ;

var gpm = {} ;
const gpm = {} ;
module.exports = gpm ;


Expand All @@ -51,13 +51,13 @@ module.exports = gpm ;


// Can't figure out the usage of the GPM_MAGIC constant ATM
var gpmMagic = Buffer.allocUnsafe( 4 ) ;
const gpmMagic = Buffer.allocUnsafe( 4 ) ;
gpmMagic.writeUInt32LE( 0x47706D4C , 0 ) ;



// Return a Buffer containing a Gpm_Connect structure, using a pid and a ttyIndex
gpm.connectStructureBuffer = function connectStructureBuffer( gpmConnect ) {
gpm.connectStructureBuffer = gpmConnect => {
var buffer = Buffer.allocUnsafe( 16 ) ;

if ( gpmConnect.eventMask === undefined ) { gpmConnect.eventMask = 65535 ; }
Expand All @@ -81,7 +81,7 @@ gpm.connectStructureBuffer = function connectStructureBuffer( gpmConnect ) {


// Extract a Gpm_Event from a Buffer
gpm.eventStructure = function eventStructure( buffer ) {
gpm.eventStructure = buffer => {
var event = {} ;

//Looks like it is in Little Endian
Expand Down Expand Up @@ -152,7 +152,7 @@ gpm.Handler.prototype.constructor = gpm.Handler ;


// Create a new GPM Handler
gpm.createHandler = function createHandler( options ) {
gpm.createHandler = function( options ) {
if ( ! options || typeof options !== 'object' ) { options = {} ; }

if ( options.raw === undefined ) { options.raw = true ; }
Expand Down Expand Up @@ -217,7 +217,7 @@ gpm.createHandler = function createHandler( options ) {


// End/Close the underlying connection
gpm.Handler.prototype.close = function handlerClose() {
gpm.Handler.prototype.close = function() {
if ( this.socket ) {
this.socket.destroy() ;
this.socket = undefined ;
Expand All @@ -227,7 +227,7 @@ gpm.Handler.prototype.close = function handlerClose() {


// Transform raw GPM event to terminal-kit event
gpm.raw2terminalKitEvent = function raw2terminalKitEvent( event ) {
gpm.raw2terminalKitEvent = function( event ) {
var name ;

var terminalKitEvent = {
Expand Down Expand Up @@ -255,4 +255,3 @@ gpm.raw2terminalKitEvent = function raw2terminalKitEvent( event ) {
return [ name , terminalKitEvent ] ;
} ;


1 change: 0 additions & 1 deletion lib/termkit-no-lazy-require.js
Expand Up @@ -60,7 +60,6 @@ if ( process.platform === 'win32' ) { require( './windows.js' )( termkit ) ; }



// Lazy submodules
termkit.image = require( './image.js' ) ;
termkit.Palette = require( './Palette.js' ) ;
termkit.Rect = require( './Rect.js' ) ;
Expand Down
10 changes: 10 additions & 0 deletions lib/termkit.js
Expand Up @@ -28,6 +28,16 @@



const path = require( 'path' ) ;

if ( process.browser || require.cache[ path.join( __dirname , 'termkit-no-lazy-require.js' ) ] ) {
console.log( 'using termkit-no-lazy-require.js' ) ;
module.exports = require( './termkit-no-lazy-require.js' ) ;
return ;
}



const termkit = {} ;
module.exports = termkit ;

Expand Down
1 change: 0 additions & 1 deletion lib/vte/Vte.js
Expand Up @@ -28,7 +28,6 @@



const termkit = require( '../termkit.js' ) ;
const ScreenBuffer = require( '../ScreenBuffer.js' ) ;
const Rect = require( '../Rect.js' ) ;
const string = require( 'string-kit' ) ;
Expand Down
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "terminal-kit",
"version": "2.1.4",
"version": "2.1.5",
"description": "256 colors, keys and mouse, input field, progress bars, screen buffer (including 32-bit composition and image loading), text buffer, and many more... Whether you just need colors and styles, build a simple interactive command line tool or a complexe terminal app: this is the absolute terminal lib for Node.js!",
"main": "lib/termkit.js",
"directories": {
Expand Down
Empty file modified sample/key-config.js 100644 → 100755
Empty file.

0 comments on commit a34beb3

Please sign in to comment.