1- "use strict" ;
2-
3- const parse = require ( "./parser" ) ;
4- const print = require ( "./printer" ) ;
5- const clean = require ( "./clean" ) ;
6- const options = require ( "./options" ) ;
7- const comments = require ( "./comments" ) ;
8- const { join, hardline } = require ( "prettier" ) . doc . builders ;
9- const { hasPragma, insertPragma } = require ( "./pragma" ) ;
1+ import { doc } from "prettier" ;
2+ import {
3+ LINGUIST_LANGUAGES_PHP ,
4+ LINGUIST_LANGUAGES_HTML_PHP ,
5+ } from "./linguist-languages.cjs" ;
6+ import parse from "./parser.js" ;
7+ import print from "./printer.js" ;
8+ import clean from "./clean.js" ;
9+ import options from "./options.js" ;
10+ import {
11+ handleOwnLineComment ,
12+ handleEndOfLineComment ,
13+ handleRemainingComment ,
14+ getCommentChildNodes ,
15+ canAttachComment ,
16+ isBlockComment ,
17+ } from "./comments.js" ;
18+ import { hasPragma , insertPragma } from "./pragma.js" ;
19+
20+ const { join, hardline } = doc . builders ;
1021
1122function createLanguage ( linguistData , { extend, override } ) {
1223 const language = { } ;
@@ -30,13 +41,13 @@ function createLanguage(linguistData, { extend, override }) {
3041}
3142
3243const languages = [
33- createLanguage ( require ( "linguist-languages/data/PHP" ) , {
44+ createLanguage ( LINGUIST_LANGUAGES_PHP , {
3445 override : {
3546 parsers : [ "php" ] ,
3647 vscodeLanguageIds : [ "php" ] ,
3748 } ,
3849 } ) ,
39- createLanguage ( require ( "linguist-languages/data/HTML+PHP" ) , {
50+ createLanguage ( LINGUIST_LANGUAGES_HTML_PHP , {
4051 override : {
4152 parsers : [ "php" ] ,
4253 vscodeLanguageIds : [ "php" ] ,
@@ -81,13 +92,13 @@ const printers = {
8192 getVisitorKeys,
8293 insertPragma,
8394 massageAstNode : clean ,
84- getCommentChildNodes : comments . getCommentChildNodes ,
85- canAttachComment : comments . canAttachComment ,
86- isBlockComment : comments . isBlockComment ,
95+ getCommentChildNodes,
96+ canAttachComment,
97+ isBlockComment,
8798 handleComments : {
88- ownLine : comments . handleOwnLineComment ,
89- endOfLine : comments . handleEndOfLineComment ,
90- remaining : comments . handleRemainingComment ,
99+ ownLine : handleOwnLineComment ,
100+ endOfLine : handleEndOfLineComment ,
101+ remaining : handleRemainingComment ,
91102 } ,
92103 willPrintOwnComments ( path ) {
93104 const node = path . getValue ( ) ;
@@ -161,12 +172,8 @@ const printers = {
161172 } ,
162173} ;
163174
164- module . exports = {
165- languages,
166- printers,
167- parsers,
168- options,
169- defaultOptions : {
170- tabWidth : 4 ,
171- } ,
175+ const defaultOptions = {
176+ tabWidth : 4 ,
172177} ;
178+
179+ export { languages , printers , parsers , options , defaultOptions } ;
0 commit comments