11"use strict" ;
2- const path = require ( "path" ) ;
32const whatwgURL = require ( "whatwg-url" ) ;
43const { domSymbolTree } = require ( "./living/helpers/internal-constants" ) ;
54const SYMBOL_TREE_POSITION = require ( "symbol-tree" ) . TreePosition ;
65
7- exports . toFileUrl = function ( fileName ) {
8- // Beyond just the `path.resolve`, this is mostly for the benefit of Windows,
9- // where we need to convert "\" to "/" and add an extra "/" prefix before the
10- // drive letter.
11- let pathname = path . resolve ( process . cwd ( ) , fileName ) . replace ( / \\ / g, "/" ) ;
12- if ( pathname [ 0 ] !== "/" ) {
13- pathname = "/" + pathname ;
14- }
15-
16- // path might contain spaces, so convert those to %20
17- return "file://" + encodeURI ( pathname ) ;
18- } ;
19-
206/**
217 * Define a set of properties on an object, by copying the property descriptors
228 * from the original object.
@@ -31,29 +17,6 @@ exports.define = function define(object, properties) {
3117 }
3218} ;
3319
34- /**
35- * Define a list of constants on a constructor and its .prototype
36- *
37- * - `Constructor` {Function} the constructor to define the constants on
38- * - `propertyMap` {Object} key/value map of properties to define
39- */
40- exports . addConstants = function addConstants ( Constructor , propertyMap ) {
41- for ( const property in propertyMap ) {
42- const value = propertyMap [ property ] ;
43- addConstant ( Constructor , property , value ) ;
44- addConstant ( Constructor . prototype , property , value ) ;
45- }
46- } ;
47-
48- function addConstant ( object , property , value ) {
49- Object . defineProperty ( object , property , {
50- configurable : false ,
51- enumerable : true ,
52- writable : false ,
53- value
54- } ) ;
55- }
56-
5720exports . mixin = ( target , source ) => {
5821 const keys = Reflect . ownKeys ( source ) ;
5922 for ( let i = 0 ; i < keys . length ; ++ i ) {
0 commit comments